Loading
chore: #3636948 Fix the coding standards and check merge requests with GitLab CI
Closes https://www.drupal.org/project/earkiv/issues/3636948
One commit per step. The behaviour of the module does not change, except for the help page fix in commit 3. After the last commit, phpcs with the new phpcs.xml.dist (Drupal and DrupalPractice, all file types including Markdown and YAML) reports nothing; before it reported 107 errors and 117 warnings.
Commits
- Apply the automatic fixes of phpcbf. Formatting only, made by phpcbf.
- Add the missing comments and fix the other findings. Comments for properties, classes, parameters and return values; unused variables and an unused
buildEntity()call inArchiveForm::validateForm()removed; long comment lines wrapped. - Use the plugin manager getters instead of
\Drupalcalls. The forms use the getters ofPluginOptionsTrait. The Filter module is optional, so the Markdown rendering on the help page keeps its\Drupal::service()call with aphpcs:ignoreand an explanation. The help page read the README from__DIR__ . '../../../README.md', without a slash, so it was never found; it now usesdirname(__DIR__, 2). - Move the install hooks to
earkiv.install.hook_schema()andhook_requirements()must be in the install file;earkiv.modulehad nothing else and is renamed. - Wrap the README at 80 characters. The text is unchanged.
- Add phpcs configuration and GitLab CI.
phpcs.xml.dist, and.gitlab-ci.ymlfromproject/gitlab_templates, so that every merge request is checked. The module has no tests yet, and cspell may report words such as the module name.
Testing
- All PHP files lint, also in each commit.
- The status report still shows the HTTrack requirement from
hook_requirements()inearkiv.install. - The settings form and the archive form still validate the plugin settings (e.g. an ftp:// URL and 500 connections are refused).
- The archive list, schedule list, schedule form, settings page, status report and help page answer 200; the help page shows the README.
- A job whose start page returns 404 runs through and fails as expected.
AI-Generated: Yes (Used Claude Code to fix the findings, test the module and write this merge request.)