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
- Run
phpcbfand commit its fixes on their own, so that they can be reviewed as formatting only. - Add the missing comments and fix the remaining findings in the PHP code by hand.
- Inject the services in the forms and the hook class instead of calling
\Drupal. - Move
hook_schema()andhook_requirements()toearkiv.install. - Wrap
README.mdat 80 characters. - Add a
phpcs.xml.distwith 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
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
Comment #4
thomas alsén commentedMerged into 1.0.x!