Problem/Motivation

While reviewing another Issue, I noticed that some files have coding standards violations.
Especially .module files and other files without the .php file extension.

Steps to reproduce

Check the code with php code sniffer using Drupal,Drupal Practice coding standards.

Proposed resolution

Resolve coding standard issues.

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

Guido_S created an issue. See original summary.

guido_s’s picture

Status: Active » Needs review

I applied coding standards to all files in the project and added a phpcs.xml for this project.
phpcs -v coookies_addons resulted in 0 warnings and 0 errors.

Project needs to be tested if nothing is broken after those code changes.

_shy’s picture

Assigned: guido_s » _shy
Status: Needs review » Needs work

Still experienced some coding standard issues. I'll take a look at it.

_shy’s picture

For now, I stack with ESlint check. We have .eslintrc.json file which is has the following line: "extends": "drupal"
This causes the following error on the ESlint job:

ESLint couldn't find the config "drupal" to extend from. Please check that the name of the config is correct.
The config "drupal" was referenced from the config file in "/builds/project/cookies_addons/web/modules/custom/cookies_addons/.eslintrc.json".

This file does not strictly need to exist in contrib, because eslint config files placed further up in the directory structure will be merged and inherited. The top-level .eslintrc.json extends ./core/.eslintrc.json.

guido_s’s picture

Status: Needs work » Fixed

I couldn't get eslint checks running as intended.
It's a known issue with extending eslint configs.
https://www.drupal.org/project/gitlab_templates/issues/3438843

So for now I specified another .eslintrc.json to extend.
This leads to issues when working locally on the project as this .eslintrc.json can't be found there while not used in a complete drupal setup, but at least checks are passing now.
Should be refactored in the future if a solution is found in the mentioned issue.

  • Guido_S committed 14198653 on 1.0.x
    #3425468 applied coding standards to the project and added phpcs.xml
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.