Coding Standards Improvements

Created on 4 March 2024, 9 months ago
Updated 9 September 2024, 2 months ago

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.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany guido_s Cologne

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

Merge Requests

Comments & Activities

  • Issue created by @guido_s
  • Status changed to Needs review 9 months ago
  • πŸ‡©πŸ‡ͺGermany guido_s Cologne

    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.

  • Assigned to _shy
  • Status changed to Needs work 9 months ago
  • πŸ‡ΊπŸ‡¦Ukraine _shy Ukraine, Lutsk πŸ‡ΊπŸ‡¦

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

  • Pipeline finished with Failed
    8 months ago
    #112684
  • πŸ‡ΊπŸ‡¦Ukraine _shy Ukraine, Lutsk πŸ‡ΊπŸ‡¦

    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.

  • Status changed to Fixed 3 months ago
  • πŸ‡©πŸ‡ͺGermany guido_s Cologne

    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
      
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024