Problem/Motivation

Lots of phpcs issues are reported, at least fix the most common ones.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Gábor Hojtsy created an issue. See original summary.

nilesh.addweb’s picture

Assigned: Unassigned » nilesh.addweb
gábor hojtsy’s picture

These are top ones

[x] Drupal.Arrays.Array.CommaLastItem                                      44
[ ] Drupal.Files.LineLength.TooLong                                        30
[x] Generic.PHP.UpperCaseConstant.Found                                    17
[ ] Drupal.Commenting.FunctionComment.MissingReturnComment                 16
[x] Drupal.Commenting.InlineComment.SpacingAfter                           13
[ ] Drupal.Arrays.Array.LongLineDeclaration                                10

I think the ones marked [x] with a fixer would be low hanging fruit to fix and easy to review.

hetal.solanki’s picture

gábor hojtsy’s picture

@Hetal.Solanki: @nilesh.addweb already assigned this to themselevs, are you two in contact?

hetal.solanki’s picture

Assigned: hetal.solanki » Unassigned

@Gábor Hojtsy

No, we are not in contact.

dhruv.mittal’s picture

Assigned: Unassigned » dhruv.mittal

Working on it

dhruv.mittal’s picture

Assigned: dhruv.mittal » Unassigned
Status: Active » Needs review

I have solved all the phpcs error mentioned above and most common phpcs error but there phpunit error persist,
can someone look into it
Thanks !!

clarkssquared’s picture

Hi

I applied the MR !104 and I can see some PHPCS issues

 upgrade_status git:(4.x) curl https://git.drupalcode.org/project/upgrade_status/-/merge_requests/104.diff | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 92837    0 92837    0     0   165k      0 --:--:-- --:--:-- --:--:--  167k
patching file README.md
patching file 'css/upgrade_status.admin.theme.css'
patching file 'src/CSSDeprecationAnalyzer.php'
patching file 'src/ConfigSchemaDeprecationAnalyzer.php'
patching file 'src/Controller/ScanResultController.php'
patching file 'src/DeprecationAnalyzer.php'
patching file 'src/DeprecationMessage.php'
patching file 'src/Drush/Commands/UpgradeStatusCommands.php'
patching file 'src/ExtensionMetadataDeprecationAnalyzer.php'
patching file 'src/Form/UpgradeStatusForm.php'
patching file 'src/LibraryDeprecationAnalyzer.php'
patching file 'src/ProjectCollector.php'
patching file 'src/RouteDeprecationAnalyzer.php'
patching file 'src/ScanResultFormatter.php'
patching file 'src/ThemeFunctionDeprecationAnalyzer.php'
patching file 'src/TwigDeprecationAnalyzer.php'
patching file 'tests/modules/upgrade_status_test_11_compatible/node_modules/upgrade_status_test_11_compatible.inc'
patching file 'tests/modules/upgrade_status_test_contrib_error/src/Controller/UpgradeStatusTestContribErrorController.php'
patching file 'tests/modules/upgrade_status_test_contrib_error/upgrade_status_test_contrib_error.module'
patching file 'tests/modules/upgrade_status_test_error/config/views.view.remove_default_argument_skip_url.yml'
patching file 'tests/modules/upgrade_status_test_error/src/Controller/UpgradeStatusTestErrorController.php'
patching file 'tests/modules/upgrade_status_test_library/upgrade_status_test_library.module'
patching file 'tests/modules/upgrade_status_test_theme_functions/upgrade_status_test_theme_functions.module'
patching file 'tests/modules/upgrade_status_test_twig/src/TwigExtension/DeprecatedFilter.php'
patching file 'tests/src/Functional/UpgradeStatusAnalyzeTest.php'
patching file 'tests/src/Functional/UpgradeStatusCommandsTest.php'
patching file 'tests/src/Functional/UpgradeStatusUiTest.php'
patching file 'tests/src/Kernel/TwigDeprecationAnalyzerTest.php'
patching file 'tests/themes/upgrade_status_test_theme/upgrade_status_test_theme.theme'
patching file upgrade_status.api.php
patching file upgrade_status.module
➜  upgrade_status git:(4.x) ✗ ..
➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml upgrade_status 

FILE: ...sts/modules/upgrade_status_test_library/upgrade_status_test_library.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 3 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------


FILE: ...atus/tests/modules/upgrade_status_test_error/upgrade_status_test_error.css
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 1 | ERROR | Class definition is empty
 5 | ERROR | Class definition is empty
 9 | ERROR | Class definition is empty
--------------------------------------------------------------------------------


FILE: ...tests/modules/upgrade_status_test_error/upgrade_status_test_error.info.yml
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 5 | ERROR | "dependencies" should be an array in the info yaml file
--------------------------------------------------------------------------------


FILE: ...rade_status_test_error/src/Controller/UpgradeStatusTestErrorController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...status/tests/modules/upgrade_status_test_error/src/DeprecatedBaseClass.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 10 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
--------------------------------------------------------------------------------


FILE: ...atus_test_11_compatible/node_modules/upgrade_status_test_11_compatible.inc
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 3 | ERROR | Missing short description in doc comment
 7 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...ade_status_test_theme_functions/upgrade_status_test_theme_functions.module
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  3 | ERROR | Missing short description in doc comment
 31 | ERROR | All functions defined in a module file must be prefixed with the
    |       | module's name, found "upgrade_status_test_theme_function" but
    |       | expected
    |       | "upgrade_status_test_theme_functions_upgrade_status_test_theme_function"
--------------------------------------------------------------------------------


FILE: ...ts/modules/upgrade_status_test_twig/src/TwigExtension/DeprecatedFilter.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  8 | ERROR | Doc comment is empty
 13 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...t_contrib_11_compatible/upgrade_status_test_contrib_11_compatible.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by
   |         | drupal.org packaging automatically
--------------------------------------------------------------------------------


FILE: ...grade_status_test_contrib_error/upgrade_status_test_contrib_error.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by
   |         | drupal.org packaging automatically
--------------------------------------------------------------------------------


FILE: ...upgrade_status_test_contrib_error/upgrade_status_test_contrib_error.module
--------------------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 11 LINES
--------------------------------------------------------------------------------
  3 | ERROR | Missing short description in doc comment
 10 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
 14 | ERROR | The trigger_error message
    |       | 'upgrade_status_test_contrib_error_function_9_to_10() is
    |       | deprecated in Drupal 9.1.0 and will be removed before Drupal
    |       | 10.0.0. Use the replacement instead. See LINK' does not match the
    |       | strict standard format: %thing% is deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%. See %cr-link%
 20 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
 24 | ERROR | The trigger_error message
    |       | 'upgrade_status_test_contrib_error_function_9_to_11() is
    |       | deprecated in Drupal 9.1.0 and will be removed before Drupal
    |       | 11.0.0. Use the replacement instead. See LINK' does not match the
    |       | strict standard format: %thing% is deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%. See %cr-link%
 30 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
 34 | ERROR | The trigger_error message
    |       | 'upgrade_status_test_contrib_error_function_10_to_11() is
    |       | deprecated in Drupal 10.3.0 and will be removed before Drupal
    |       | 11.0.0. Use the replacement instead. See LINK' does not match the
    |       | strict standard format: %thing% is deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%. See %cr-link%
 40 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
 44 | ERROR | The trigger_error message
    |       | 'upgrade_status_test_contrib_error_function_10_to_12() is
    |       | deprecated in Drupal 10.0.0 and will be removed before Drupal
    |       | 12.0.0. Use the replacement instead. See LINK' does not match the
    |       | strict standard format: %thing% is deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%. See %cr-link%
 50 | ERROR | Each @deprecated tag must have a @see tag immediately following
    |       | it
 54 | ERROR | The trigger_error message
    |       | 'upgrade_status_test_contrib_error_function_11_to_13() is
    |       | deprecated in Drupal 11.1.0 and will be removed before Drupal
    |       | 13.0.0. Use the replacement instead. See LINK' does not match the
    |       | strict standard format: %thing% is deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%. See %cr-link%
--------------------------------------------------------------------------------


FILE: ...t_contrib_error/src/Controller/UpgradeStatusTestContribErrorController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...tus/tests/themes/upgrade_status_test_theme/upgrade_status_test_theme.theme
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 3 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------


FILE: ...s/contrib/upgrade_status/tests/src/Functional/UpgradeStatusAnalyzeTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...les/contrib/upgrade_status/tests/src/Kernel/CSSDeprecationAnalyzerTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 18 | ERROR | Missing @var tag in member variable comment
 46 | ERROR | Public method name
    |       | "CSSDeprecationAnalyzerTest::testGetAllCSSFiles" is not in
    |       | lowerCamel format
--------------------------------------------------------------------------------


FILE: ...es/contrib/upgrade_status/tests/src/Kernel/TwigDeprecationAnalyzerTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 15 | ERROR | Missing member variable doc comment
 20 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...l/drupal/web/modules/contrib/upgrade_status/src/Form/UpgradeStatusForm.php
--------------------------------------------------------------------------------
FOUND 11 ERRORS AND 14 WARNINGS AFFECTING 23 LINES
--------------------------------------------------------------------------------
   28 | ERROR   | Doc comment is empty
  144 | ERROR   | Parameter $database is not described in comment
  167 | ERROR   | Doc comment for parameter $connection does not match actual
      |         | variable name $kernel
  239 | WARNING | t() calls should be avoided in classes, use
      |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
      |         | $this->t() instead
  336 | WARNING | Translatable strings must not begin or end with white spaces,
      |         | use placeholders with t() for variables
  336 | ERROR   | Concatenating translatable strings is not allowed, use
      |         | placeholders instead and only one string literal
  339 | WARNING | Translatable strings must not begin or end with white spaces,
      |         | use placeholders with t() for variables
  339 | ERROR   | Concatenating translatable strings is not allowed, use
      |         | placeholders instead and only one string literal
  561 | ERROR   | Public method name
      |         | "UpgradeStatusForm::upgrade_status_preprocess_table_custom_header"
      |         | is not in lowerCamel format
  899 | WARNING | Role::loadMultiple calls should be avoided in classes, use
      |         | dependency injection instead
  900 | WARNING | \Drupal calls should be avoided in classes, use dependency
      |         | injection instead
  940 | ERROR   | join() is a function name alias, use implode() instead
 1015 | WARNING | Avoid backslash escaping in translatable strings when
      |         | possible, use "" quotes instead
 1105 | WARNING | Unused variable $addendum.
 1124 | WARNING | Line exceeds 80 characters; contains 94 characters
 1147 | WARNING | Line exceeds 80 characters; contains 93 characters
 1160 | WARNING | Unused variable $addendum.
 1166 | WARNING | Unused variable $addendum.
 1229 | ERROR   | join() is a function name alias, use implode() instead
 1422 | ERROR   | Public method name "UpgradeStatusForm::exportReportASCII" is
      |         | not in lowerCamel format
 1482 | ERROR   | Missing parameter type
 1484 | ERROR   | Missing parameter type
 1586 | WARNING | Unused variable $config.
 1587 | WARNING | Unused variable $databases.
 1588 | WARNING | Unused variable $class_loader.
--------------------------------------------------------------------------------


FILE: .../drupal/drupal/web/modules/contrib/upgrade_status/src/ProjectCollector.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
 521 | WARNING | Avoid backslash escaping in translatable strings when
     |         | possible, use "" quotes instead
 564 | ERROR   | Public method name "ProjectCollector::isCompatibleWithPHP" is
     |         | not in lowerCamel format
--------------------------------------------------------------------------------


FILE: ...upal/drupal/web/modules/contrib/upgrade_status/src/ScanResultFormatter.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
  12 | ERROR | [x] Use statements should be sorted alphabetically. The first
     |       |     wrong one is dekor\ArrayToTextTable.
 205 | ERROR | [ ] join() is a function name alias, use implode() instead
 329 | ERROR | [ ] join() is a function name alias, use implode() instead
 484 | ERROR | [ ] join() is a function name alias, use implode() instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...eb/modules/contrib/upgrade_status/src/ThemeFunctionDeprecationAnalyzer.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
  37 | ERROR | Parameter $container is not described in comment
  40 | ERROR | Doc comment for parameter $this->container does not match actual
     |       | variable name $container
  53 | ERROR | Description for the @return value is missing
  96 | ERROR | Missing parameter type
 101 | ERROR | Description for the @return value is missing
--------------------------------------------------------------------------------


FILE: ...web/modules/contrib/upgrade_status/src/Controller/ScanResultController.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
  13 | ERROR   | Doc comment is empty
 141 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: ...rupal/drupal/web/modules/contrib/upgrade_status/src/DeprecationMessage.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 41 | ERROR | Parameter $analyzer is not described in comment
--------------------------------------------------------------------------------


FILE: ...upal/web/modules/contrib/upgrade_status/src/LibraryDeprecationAnalyzer.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
 120 | ERROR   | Unnecessarily gendered language in a comment
 353 | WARNING | The use of function fnmatch() is discouraged
 439 | ERROR   | Unnecessarily gendered language in a comment
--------------------------------------------------------------------------------


FILE: ...l/drupal/web/modules/contrib/upgrade_status/src/CSSDeprecationAnalyzer.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 50 | ERROR | Private method name "CSSDeprecationAnalyzer::getAllCSSFiles" is
    |       | not in lowerCamel format
--------------------------------------------------------------------------------


FILE: ...upal/drupal/web/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  15 | ERROR   | Doc comment is empty
 130 | ERROR   | Class property $CSSDeprecationAnalyzer should use lowerCamel
     |         | naming without underscores
 661 | WARNING | Line exceeds 80 characters; contains 83 characters
--------------------------------------------------------------------------------


FILE: ...odules/contrib/upgrade_status/src/ExtensionMetadataDeprecationAnalyzer.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 62 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
--------------------------------------------------------------------------------


FILE: ...odules/contrib/upgrade_status/src/Drush/Commands/UpgradeStatusCommands.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
  13 | WARNING | [x] Unused use statement
 280 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
 284 | ERROR   | [ ] The array declaration extends to column 247 (the limit is
     |         |     120). The array content should be split up over multiple
     |         |     lines
 363 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
     |         |     injection instead
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: .../drupal/web/modules/contrib/upgrade_status/src/TwigDeprecationAnalyzer.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 11 | ERROR | Doc comment is empty
 39 | ERROR | Description for the @return value is missing
--------------------------------------------------------------------------------

Time: 1.68 secs; Memory: 20MB

➜  contrib git:(main) ✗ 
kalash-j’s picture

Status: Needs review » Needs work

benstallings made their first commit to this issue’s fork.

benstallings’s picture

Status: Needs work » Needs review
gábor hojtsy’s picture

Title: Fix most common phpcs issues » Fix all phpcs issues

I updated the scope of issues to fix everything here, since we were doing almost everything :) Now making sure the tests still pass properly.

gábor hojtsy’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.