Problem/Motivation

PHP_CodeSniffer with the Drupal and DrupalPractice standards reports 107 errors and 117 warnings in 29 files of the module. 83 of them can be fixed automatically. The rest are mostly missing comments on properties, classes, parameters and return values (about 45), lines in README.md longer than 80 characters (83 warnings), \Drupal calls in classes instead of dependency injection (5), and hook_schema() and hook_requirements() in earkiv.module instead of earkiv.install.

The many old findings also make new ones easy to miss in a review, and the module has no GitLab CI configuration, so nothing checks merge requests.

Proposed resolution

  1. Run phpcbf and commit its fixes on their own, so that they can be reviewed as formatting only.
  2. Add the missing comments and fix the remaining findings in the PHP code by hand.
  3. Inject the services in the forms and the hook class instead of calling \Drupal.
  4. Move hook_schema() and hook_requirements() to earkiv.install.
  5. Wrap README.md at 80 characters.
  6. Add a phpcs.xml.dist with the standards and file extensions, and the Drupal GitLab CI template in .gitlab-ci.yml, so that every merge request is checked.

Each step is a separate commit. The behaviour of the module does not change.

Remaining tasks

  • Implement and check that phpcs reports nothing.
  • Review.

User interface changes

None.

API changes

None.

Data model changes

None.

AI-Generated: Yes (Used Claude Code to run phpcs and draft this issue.)

Issue fork earkiv-3636948

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

thomas alsén created an issue. See original summary.

  • thomas alsén committed 887eef9e on 1.0.x
    chore: #3636948 Fix the coding standards and check merge requests with...
thomas alsén’s picture

Status: Active » Fixed

Merged into 1.0.x!

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.