Fix the issues reported by phpcs

Created on 23 February 2023, over 1 year ago
Updated 8 May 2024, 7 months ago

Problem/Motivation

Getting following error.

FILE: /var/www/html/modules/contrib/preload_font/preload_font.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------------------
29 | ERROR | All functions defined in a module file must be prefixed with the module's name, found "_preload_fonts" but expected "preload_font__preload_fonts"
----------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 1.17 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/preload_font/

Proposed resolution

Above error need to be fixed.

📌 Task
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

  • Issue created by @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India samit.310@gmail.com

    Above error is fixed.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
       if (!empty($font_paths) && is_array($font_paths)) {
    -    _preload_fonts($font_paths, $attachments);
    +    preload_font_preload_fonts($font_paths, $attachments);
       }

    I can understand that _preload_fonts() could be a function implemented by a project whose machine name is preload_fonts, but functions are allowed to start with an underscore, and that is considered by the coding standards.

  • Status changed to Closed: works as designed 7 months ago
Production build 0.71.5 2024