Issues reported by phpcs

Created on 21 August 2025, 3 days ago

Problem/Motivation

PHP CODE SNIFFER REPORT SUMMARY
---------------------------------------------------------------------------------------------------------------------------------
FILE                                                                                                             ERRORS  WARNINGS
---------------------------------------------------------------------------------------------------------------------------------
/var/www/html/web/modules/custom/office_hours/office_hours.api.php                                               0       1
/var/www/html/web/modules/custom/office_hours/office_hours.module                                                2       2
/var/www/html/web/modules/custom/office_hours/src/OfficeHoursCacheHelper.php                                     2       0
/var/www/html/web/modules/custom/office_hours/src/OfficeHoursDateHelper.php                                      5       2
/var/www/html/web/modules/custom/office_hours/src/OfficeHoursItemListFormatter.php                               2       3
/var/www/html/web/modules/custom/office_hours/src/OfficeHoursItemListSorter.php                                  1       0
/var/www/html/web/modules/custom/office_hours/src/OfficeHoursSeason.php                                          1       2
/var/www/html/web/modules/custom/office_hours/src/Controller/StatusUpdateController.php                          0       1
/var/www/html/web/modules/custom/office_hours/src/Element/OfficeHoursBaseSlot.php                                1       1
/var/www/html/web/modules/custom/office_hours/src/Element/OfficeHoursDatetime.php                                2       0
/var/www/html/web/modules/custom/office_hours/src/Element/OfficeHoursExceptionsSlot.php                          0       1
/var/www/html/web/modules/custom/office_hours/src/Element/OfficeHoursSeasonHeader.php                            4       1
/var/www/html/web/modules/custom/office_hours/src/Element/OfficeHoursTable.php                                   0       2
/var/www/html/web/modules/custom/office_hours/src/Element/OfficeHoursWeekSlot.php                                0       1
/var/www/html/web/modules/custom/office_hours/src/Hook/OfficeHoursFieldHooks.php                                 1       0
/var/www/html/web/modules/custom/office_hours/src/Hook/OfficeHoursThemeHooks.php                                 7       0
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldFormatter/OfficeHoursFormatterBase.php       27      7
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldFormatter/OfficeHoursFormatterSchema.php     3       0
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldFormatter/OfficeHoursFormatterTable.php      1       2
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldType/OfficeHoursExceptionsItem.php           0       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldType/OfficeHoursItem.php                     4       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldType/OfficeHoursItemBase.php                 1       0
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldType/OfficeHoursItemList.php                 7       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldType/OfficeHoursItemListInterface.php        0       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldType/OfficeHoursStatus.php                   0       3
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldWidget/OfficeHoursComplexWeekWidget.php      0       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldWidget/OfficeHoursExceptionsWidget.php       2       5
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldWidget/OfficeHoursWeekWidget.php             3       2
/var/www/html/web/modules/custom/office_hours/src/Plugin/Field/FieldWidget/OfficeHoursWidgetBase.php             3       0
/var/www/html/web/modules/custom/office_hours/src/Plugin/views/field/FieldBase.php                               1       0
/var/www/html/web/modules/custom/office_hours/src/Plugin/views/field/Season.php                                  1       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/views/field/TimeSlot.php                                1       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/views/field/ViewsDataProvider.php                       0       1
/var/www/html/web/modules/custom/office_hours/src/Plugin/views/filter/OfficeHoursStatusFilter.php                1       0
/var/www/html/web/modules/custom/office_hours/src/Plugin/WebformElement/WebformOfficeHours.php                   2       1
/var/www/html/web/modules/custom/office_hours/tests/src/Kernel/OfficeHoursItemTest.php                           0       1
---------------------------------------------------------------------------------------------------------------------------------
A TOTAL OF 85 ERRORS AND 46 WARNINGS WERE FOUND IN 36 FILES
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX 82 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

1.28

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States bluegeek9

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @bluegeek9
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • πŸ‡³πŸ‡±Netherlands johnv

    Yeah, I know, do not try to resolve them.
    Ther are stupid rules:
    - max 80 char per line
    - no empty line after inline comments
    - no inline comments after a code line.
    - code in inline comments is regardes as text.

    Unless you can tell me a way to exclude such nonsense from the phpcs jobs, i will leave it this way.

    Thanks, anyway

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    bluegeek9 β†’ changed the visibility of the branch 8.x-1.x to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • Pipeline finished with Success
    3 days ago
    Total: 171s
    #578358
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    code in inline comments is regarded as text.

    I am not sure about that one. I think code might need to be in multi line comments.

    I add a phpcs.xml.dist to handle:
    - max 80 char per line
    - no empty line after inline comments
    - no inline comments after a code line.

  • Pipeline finished with Success
    3 days ago
    Total: 198s
    #578376
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9
  • πŸ‡³πŸ‡±Netherlands johnv

    Let us see what happens.

  • πŸ‡³πŸ‡±Netherlands johnv

    wow, what a relief. The below difference may not seem so much, but it will make a big difference on my other modules, too.
    I now will add other errors at some other time, if needed. Thanks.

    before: https://git.drupalcode.org/project/office_hours/-/jobs/6276228

    PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
    -----------------------------------------------------------------------
        SOURCE                                                        COUNT
    -----------------------------------------------------------------------
    [x] Drupal.WhiteSpace.ScopeIndent.IncorrectExact                  30
    [x] Drupal.Commenting.PostStatementComment.Found                  14
    [ ] Drupal.Semantics.FunctionT.NotLiteralString                   12
    [ ] Drupal.Files.LineLength.TooLong                               11
    [x] Drupal.Commenting.InlineComment.InvalidEndChar                9
    [x] Drupal.Classes.UnusedUseStatement.UnusedUse                   8
    [ ] Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  8
    [x] Drupal.Commenting.InlineComment.NotCapital                    7
    [ ] Generic.CodeAnalysis.UselessOverridingMethod.Found            6
    [x] Drupal.Commenting.InlineComment.SpacingAfter                  5
    [ ] Drupal.Semantics.FunctionT.ConcatString                       4
    [ ] Drupal.Commenting.DocComment.MissingShort                     3
    [ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition      2
    [x] Drupal.Commenting.FunctionComment.SeePunctuation              2
    [x] Drupal.Classes.ClassDeclaration.CloseBraceAfterBody           1
    [ ] Drupal.Commenting.DocComment.ParamGroup                       1
    [ ] Drupal.Commenting.FunctionComment.MissingReturnComment        1
    [ ] Drupal.Commenting.FunctionComment.ParamNameNoMatch            1
    [x] Drupal.Commenting.FunctionComment.ReturnVarName               1
    [x] Drupal.Commenting.InlineComment.NoSpaceBefore                 1
    [x] Drupal.Commenting.InlineComment.SpacingBefore                 1
    [x] Drupal.Commenting.VariableComment.IncorrectVarType            1
    [x] Squiz.WhiteSpace.FunctionSpacing.AfterLast                    1
    [x] Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore                1
    -----------------------------------------------------------------------
    A TOTAL OF 131 SNIFF VIOLATIONS WERE FOUND IN 24 SOURCES

    After: https://git.drupalcode.org/project/office_hours/-/jobs/6277048

    PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
    -----------------------------------------------------------------------
        SOURCE                                                        COUNT
    -----------------------------------------------------------------------
    [x] Drupal.WhiteSpace.ScopeIndent.IncorrectExact                  30
    [ ] Drupal.Semantics.FunctionT.NotLiteralString                   12
    [x] Drupal.Commenting.InlineComment.InvalidEndChar                9
    [x] Drupal.Classes.UnusedUseStatement.UnusedUse                   8
    [ ] Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  8
    [x] Drupal.Commenting.InlineComment.NotCapital                    7
    [ ] Generic.CodeAnalysis.UselessOverridingMethod.Found            6
    [ ] Drupal.Semantics.FunctionT.ConcatString                       4
    [ ] Drupal.Commenting.DocComment.MissingShort                     3
    [ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition      2
    [x] Drupal.Commenting.FunctionComment.SeePunctuation              2
    [x] Drupal.Classes.ClassDeclaration.CloseBraceAfterBody           1
    [ ] Drupal.Commenting.DocComment.ParamGroup                       1
    [ ] Drupal.Commenting.FunctionComment.MissingReturnComment        1
    [ ] Drupal.Commenting.FunctionComment.ParamNameNoMatch            1
    [x] Drupal.Commenting.FunctionComment.ReturnVarName               1
    [x] Drupal.Commenting.InlineComment.NoSpaceBefore                 1
    [x] Drupal.Commenting.InlineComment.SpacingBefore                 1
    [x] Drupal.Commenting.VariableComment.IncorrectVarType            1
    [x] Squiz.WhiteSpace.FunctionSpacing.AfterLast                    1
    [x] Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore                1
    -----------------------------------------------------------------------
    A TOTAL OF 101 SNIFF VIOLATIONS WERE FOUND IN 21 SOURCES
  • Merge request !68Resolve #3542418 "Phpcbf" β†’ (Open) created by bluegeek9
  • Pipeline finished with Canceled
    3 days ago
    Total: 221s
    #578495
  • Pipeline finished with Success
    3 days ago
    Total: 163s
    #578497
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    I addressed obvious items reported by phpcs.

    I left commented code alone.

    Some of the Hooks have non camel casing. I can fix it but wasn't sure if the change will be welcomed.

    Public method name "OfficeHoursThemeHooks::preprocess_field" is not in lowerCamel format
    | | (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)

  • πŸ‡³πŸ‡±Netherlands johnv

    "Some of the Hooks have non camel casing. I can fix it but wasn't sure if the change will be welcomed."
    Fixing that would be nice. Thank you.

    I really appreciate your efforts. I can learn from that and build upon it!

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    bluegeek9 β†’ changed the visibility of the branch 3542418-phpcs-xml-dist to hidden.

  • Pipeline finished with Success
    2 days ago
    Total: 137s
    #578724
  • Pipeline finished with Success
    2 days ago
    #578730
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    I fixed Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps and added a unit test form the office_hours.module file.

    • johnv β†’ committed 63fe1273 on 8.x-1.x
      Issue #3542418 by bluegeek9: Add tests/src/Unit/HookModuleUnitTest.php
      
  • πŸ‡³πŸ‡±Netherlands johnv

    Thanks, committed. Let us await the jobs.

    You are fast, I assume you have some tool?

Production build 0.71.5 2024