Coding standards issue

Created on 6 December 2024, 7 months ago

Problem/Motivation

Currently, the module contains inconsistencies in code formatting that do not adhere to the Drupal Coding Standards (Drupal Coding Standards and DrupalPractice). These inconsistencies make the code less readable and can create challenges during code review, in addition to impacting long-term maintainability.

The motivation for this issue is to align the module's code with the recommended standards, making it easier for the community to contribute and ensuring the code is clearer, more maintainable, and compatible with static analysis tools.

By implementing these changes, the module will better align with the Drupal community’s policies, and the effort required for future updates or reviews will be reduced.

Steps to reproduce

  1. Clone the repo
  2. cd file_entity
  3. run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css .

Proposed resolution

Fix reported errors and warnings

FILE                                                  ERRORS  WARNINGS
----------------------------------------------------------------------
...b/modules/contrib/file_entity/file_entity.api.php  4       0
.../modules/contrib/file_entity/file_entity.file.inc  3       0
...b/modules/contrib/file_entity/file_entity.install  11      3
...eb/modules/contrib/file_entity/file_entity.module  75      6
...dules/contrib/file_entity/file_entity.routing.yml  1       0
...modules/contrib/file_entity/file_entity.theme.inc  3       0
...odules/contrib/file_entity/file_entity.tokens.inc  11      1
...modules/contrib/file_entity/file_entity.views.inc  33      0
/app/web/modules/contrib/file_entity/README.md        1       1
...ile_entity/src/FileEntityAccessControlHandler.php  7       2
...s/contrib/file_entity/src/FileEntityInterface.php  3       0
...contrib/file_entity/src/FileEntityPermissions.php  20      0
...rib/file_entity/src/FileEntityServiceProvider.php  7       0
...les/contrib/file_entity/src/FileTypeInterface.php  3       0
...s/contrib/file_entity/src/FileTypeListBuilder.php  7       6
...web/modules/contrib/file_entity/src/Mimetypes.php  3       0
...contrib/file_entity/src/UploadValidatorsTrait.php  3       0
...rib/file_entity/src/Controller/FileController.php  22      6
...les/contrib/file_entity/src/Entity/FileEntity.php  23      3
.../file_entity/src/Entity/FileEntityViewBuilder.php  3       3
...dules/contrib/file_entity/src/Entity/FileType.php  6       0
...ntrib/file_entity/src/Form/FileAddArchiveForm.php  11      5
...ules/contrib/file_entity/src/Form/FileAddForm.php  63      26
...b/file_entity/src/Form/FileDeleteMultipleForm.php  3       1
...les/contrib/file_entity/src/Form/FileEditForm.php  11      12
...contrib/file_entity/src/Form/FileSettingsForm.php  15      30
...trib/file_entity/src/Form/FileTypeDisableForm.php  5       4
...ntrib/file_entity/src/Form/FileTypeEnableForm.php  5       4
...les/contrib/file_entity/src/Form/FileTypeForm.php  15      17
...le_entity/src/Normalizer/FileEntityNormalizer.php  13      0
...file_entity/src/Normalizer/FileItemNormalizer.php  0       1
...trib/file_entity/src/Plugin/Action/FileDelete.php  4       0
...ile_entity/src/Plugin/Action/FileSetPermanent.php  4       1
...ile_entity/src/Plugin/Action/FileSetTemporary.php  2       1
...lugin/Field/FieldFormatter/FileAudioFormatter.php  22      14
...ield/FieldFormatter/FileDownloadLinkFormatter.php  14      4
...lugin/Field/FieldFormatter/FileImageFormatter.php  2       4
...d/FieldFormatter/FileImageResponsiveFormatter.php  11      8
...Plugin/Field/FieldFormatter/FileSizeFormatter.php  4       1
...lugin/Field/FieldFormatter/FileVideoFormatter.php  31      28
...c/Plugin/Field/FieldWidget/FileEditableWidget.php  1       0
...tity/src/Plugin/QueueWorker/FileDetermineType.php  1       0
...ib/file_entity/src/Plugin/views/argument/Type.php  5       1
...b/file_entity/src/Plugin/views/field/FileName.php  5       2
...file_entity/src/Plugin/views/field/LinkDelete.php  0       1
...le_entity/src/Plugin/views/field/LinkDownload.php  0       1
...b/file_entity/src/Plugin/views/field/LinkEdit.php  0       1
...ntrib/file_entity/src/Plugin/views/field/Type.php  1       1
...ile_entity/src/Plugin/views/filter/SchemeType.php  7       1
...trib/file_entity/src/Plugin/views/filter/Type.php  2       0
...ntrib/file_entity/src/Routing/RouteSubscriber.php  2       0
...ity/tests/src/Functional/FileEntityAccessTest.php  60      3
...tity/tests/src/Functional/FileEntityAdminTest.php  52      5
.../tests/src/Functional/FileEntityCacheTagsTest.php  19      1
...y/tests/src/Functional/FileEntityCreationTest.php  12      5
...ntity/tests/src/Functional/FileEntityEditTest.php  21      13
...nctional/FileEntityFileTypeClassificationTest.php  6       5
...ty/tests/src/Functional/FileEntityReplaceTest.php  13      9
...y/tests/src/Functional/FileEntityServicesTest.php  7       1
...ntity/tests/src/Functional/FileEntityTestBase.php  35      3
...tity/tests/src/Functional/FileEntityTokenTest.php  20      4
...ntity/tests/src/Functional/FileEntityTypeTest.php  44      39
...ntity/tests/src/Functional/FileEntityUnitTest.php  14      1
...c/FunctionalJavascript/FileEntitySettingsTest.php  3       2
...ity/tests/src/Kernel/FileEntityNormalizerTest.php  19      1
...ntity/views/views_handler_field_file_rendered.inc  15      4
...b/file_entity/views/views_plugin_row_file_rss.inc  52      8
----------------------------------------------------------------------
A TOTAL OF 900 ERRORS AND 304 WARNINGS WERE FOUND IN 67 FILES

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia

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

Comments & Activities

  • Issue created by @ismaelromero
  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia

    I'm taking a look and working on it

  • 🇨🇴Colombia ismaelromero Somewhere in the exotic Colombia

    Hi everyone,

    I've started addressing the coding standard issues reported by phpcs and just committed the first batch of corrections. The automatic fixes have been applied successfully, and I'll continue working on the remaining issues.

    Here's a summary of the outstanding issues reported by phpcs:

    PHP CODE SNIFFER REPORT SUMMARY
    ----------------------------------------------------------------------
    FILE                                                  ERRORS  WARNINGS
    ----------------------------------------------------------------------
    ...b/modules/contrib/file_entity/file_entity.api.php  2       0
    ...b/modules/contrib/file_entity/file_entity.install  1       2
    ...eb/modules/contrib/file_entity/file_entity.module  5       4
    /app/web/modules/contrib/file_entity/README.md        0       1
    ...s/contrib/file_entity/src/FileEntityInterface.php  1       0
    ...s/contrib/file_entity/src/FileTypeListBuilder.php  0       5
    ...les/contrib/file_entity/src/Entity/FileEntity.php  1       2
    ...dules/contrib/file_entity/src/Entity/FileType.php  1       0
    ...ntrib/file_entity/src/Form/FileAddArchiveForm.php  1       4
    ...ules/contrib/file_entity/src/Form/FileAddForm.php  15      23
    ...ntrib/file_entity/src/Form/FileTypeEnableForm.php  0       3
    ...lugin/Field/FieldFormatter/FileAudioFormatter.php  0       14
    ...ield/FieldFormatter/FileDownloadLinkFormatter.php  3       4
    ...d/FieldFormatter/FileImageResponsiveFormatter.php  1       4
    ...lugin/Field/FieldFormatter/FileVideoFormatter.php  0       27
    ...c/Plugin/Field/FieldWidget/FileEditableWidget.php  1       0
    ...tity/src/Plugin/QueueWorker/FileDetermineType.php  1       0
    ...ib/file_entity/src/Plugin/views/argument/Type.php  0       1
    ...b/file_entity/src/Plugin/views/field/FileName.php  0       2
    ...file_entity/src/Plugin/views/field/LinkDelete.php  0       1
    ...le_entity/src/Plugin/views/field/LinkDownload.php  0       1
    ...b/file_entity/src/Plugin/views/field/LinkEdit.php  0       1
    ...ntrib/file_entity/src/Plugin/views/field/Type.php  0       1
    ...ile_entity/src/Plugin/views/filter/SchemeType.php  1       1
    ...trib/file_entity/src/Plugin/views/filter/Type.php  1       0
    ...ity/tests/src/Functional/FileEntityAccessTest.php  4       1
    ...tity/tests/src/Functional/FileEntityAdminTest.php  5       2
    .../tests/src/Functional/FileEntityCacheTagsTest.php  5       0
    ...y/tests/src/Functional/FileEntityCreationTest.php  3       4
    ...ntity/tests/src/Functional/FileEntityEditTest.php  6       13
    ...nctional/FileEntityFileTypeClassificationTest.php  2       5
    ...ty/tests/src/Functional/FileEntityReplaceTest.php  1       9
    ...y/tests/src/Functional/FileEntityServicesTest.php  1       0
    ...ntity/tests/src/Functional/FileEntityTestBase.php  7       2
    ...tity/tests/src/Functional/FileEntityTokenTest.php  6       4
    ...ntity/tests/src/Functional/FileEntityTypeTest.php  2       39
    ...ntity/tests/src/Functional/FileEntityUnitTest.php  3       1
    ...ntity/views/views_handler_field_file_rendered.inc  6       4
    ...b/file_entity/views/views_plugin_row_file_rss.inc  18      5
    ----------------------------------------------------------------------
    A TOTAL OF 104 ERRORS AND 190 WARNINGS WERE FOUND IN 39 FILES

    I'll keep working on resolving these manually and will update the progress soon.

    Thanks

Production build 0.71.5 2024