- Issue created by @mark_fullmer
- Status changed to Closed: duplicate
about 1 year ago 5:00pm 21 December 2023 - πΊπΈUnited States mark_fullmer Tucson
Duplicate of π Fix the issues reported by phpcs Needs review
With testing now running on Gitlab CI, eslint, phpcs, and phpstan coding standards warnings are appearing. Let's update the code!
/builds/project/addtocal_augment/web/modules/custom/addtocal_augment/js/modal.js
10:2 warning Unexpected unnamed function func-names
10:15 warning 'Drupal' is defined but never used no-unused-vars
11:44 warning Unexpected unnamed function func-names
12:9 error 'id' is never reassigned. Use 'const' instead prefer-const
12:27 error Replace `"target"` with `'target'` prettier/prettier
13:9 error 'options' is never reassigned. Use 'const' instead prefer-const
17:31 error Insert `,` prettier/prettier
19:9 error 'theDialog' is never reassigned. Use 'const' instead prefer-const
20:7 error Replace `"#"` with `'#'` prettier/prettier
20:7 error Unexpected string concatenation prefer-template
20:23 warning Unexpected unnamed function func-names
21:24 error Replace `"open"` with `'open'` prettier/prettier
FILE: ...ugment/web/modules/custom/addtocal_augment/tests/src/Unit/TestAddToCal.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
8 | ERROR | [x] Missing class doc comment
| | (Drupal.Commenting.ClassComment.Missing)
12 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
| | (Drupal.Commenting.DocComment.ShortSingleLine)
29 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
| | (Drupal.Commenting.DocComment.ShortSingleLine)
35 | ERROR | [x] Expected 1 blank line after function; 0 found
| | (Squiz.WhiteSpace.FunctionSpacing.AfterLast)
36 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
| | (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...gment/web/modules/custom/addtocal_augment/tests/src/Unit/BasicLinkTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Datetime\DrupalDateTime.
| | (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../web/modules/custom/addtocal_augment/src/Plugin/DateAugmenter/AddToCal.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
--------------------------------------------------------------------------------
12 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is
| | Drupal\Core\Config\ConfigFactoryInterface.
| | (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
29 | ERROR | [ ] Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
30 | ERROR | [ ] Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
31 | ERROR | [ ] Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
32 | ERROR | [ ] Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
371 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
| | (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
397 | WARNING | [x] 'TODO: support other field types?' should match the format
| | '@todo Fix problem X here.'
| | (Drupal.Commenting.TodoComment.TodoFormat)
------ ------------------------------------------------------------------------------
Line src/Plugin/DateAugmenter/AddToCal.php
------ ------------------------------------------------------------------------------
54 Unsafe usage of new static().
π‘ See:
https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
79 Method
Drupal\addtocal_augment\Plugin\DateAugmenter\AddToCal::augmentOutput()
should return array but return statement is missing.
284 \Drupal calls should be avoided in classes, use dependency injection
instead
285 \Drupal calls should be avoided in classes, use dependency injection
instead
411 Method
Drupal\addtocal_augment\Plugin\DateAugmenter\AddToCal::configurationFields()
invoked with 2 parameters, 3 required.
------ ------------------------------------------------------------------------------
Closed: duplicate
1.1
Code
Duplicate of π Fix the issues reported by phpcs Needs review