Coding standards

Created on 21 April 2023, over 1 year ago

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/markdown_field_formatter/

FILE: /var/www/html/drupalvb/web/modules/contrib/markdown_field_formatter/src/Plugin/Field/FieldFormatter/MarkdownFileFormatter.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 20 ERRORS AND 1 WARNING AFFECTING 14 LINES
-----------------------------------------------------------------------------------------------------------------------------------
26 | ERROR | [ ] Missing short description in doc comment
27 | ERROR | [x] Data types in @var tags need to be fully namespaced
33 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
33 | ERROR | [ ] Missing parameter comment
33 | ERROR | [ ] Missing parameter type
34 | ERROR | [ ] Missing parameter comment
34 | ERROR | [ ] Missing parameter type
35 | ERROR | [ ] Missing parameter comment
35 | ERROR | [x] Data types in @param tags need to be fully namespaced
36 | ERROR | [ ] Missing parameter comment
37 | ERROR | [ ] Missing parameter comment
37 | ERROR | [ ] Missing parameter type
38 | ERROR | [ ] Missing parameter comment
38 | ERROR | [ ] Missing parameter type
39 | ERROR | [ ] Missing parameter comment
40 | ERROR | [ ] Missing parameter comment
40 | ERROR | [x] Data types in @param tags need to be fully namespaced
80 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
92 | WARNING | [x] A comma should follow the last multiline array item. Found: $output
96 | ERROR | [x] Expected 1 blank line after function; 0 found
97 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/drupalvb/web/modules/contrib/markdown_field_formatter/markdown_field_formatter.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-----------------------------------------------------------------------------------------------------------

Time: 181ms; Memory: 10MB

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India dineshkumarbollu

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

Merge Requests

Comments & Activities

  • Issue created by @dineshkumarbollu
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India chanderbhushan

    Added patch for fix coding standards .

  • 🇮🇳India Raveen Kumar

    I have reviewed patch #2. And it seems as per coding standards. Thank you.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    I am reviewing the patch in comment #2.

    +   * @param string $plugin_id
    +   *   The plugin_id parameter.
    +   * @param mixed $plugin_definition
    +   *   The Plugin_definition parameter.
    

    It is not how parameters are described. For example, there is no need to say that a parameter is... a parameter.

    +   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
    +   *   The FeildDefintion service.

    There are two typos.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Soham Sengupta

    Hi, I have updated the parameter comments.

  • 🇮🇳India chanderbhushan

    @apaderno, could you please check in Drupal core code there also same defined

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -   * @var EntityTypeManagerInterface
    +   * Entity Type Manager service.
    +   *
    +   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
        */

    In English, there are rules about which words are written capitalized. On Entity Type Manager only the first word is correctly spelled.
    There is a missing article, in the short description.

    +   * @param string $plugin_id
    +   *   The plugin_id for the formatter.
    +   * @param mixed $plugin_definition
    +   *   The plugin implementation definition.

    It is redundant to say that the $plugin_id parameter is the plugin_id of the formatter, since that is repeating the parameter name.
    The correct description for those parameters can be seen in constructors like PluginBase::__construct(), for example.

    +   * @param string $label
    +   *   The formatter label display setting.

    It is sufficient to say The formatter label.

        * @param array $third_party_settings
    -   * @param EntityTypeManagerInterface $entity_type_manager
    +   *   Any third party settings.
    +   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    +   *   The Entity type manager service.

    Any>/em> is not necessary.
    Entity is misspelled, since it is not at the beginning of the sentence (contrary to The).

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Akram Khan Cuttack, Odisha

    addressed #9

  • Status changed to Needs work 4 months ago
  • Hi @Akram Khan,

    The patch you provided was applied successfully, but there is a file that has 2 errors reported. Please see below:

    markdown_field_formatter git:(1.0.0-beta1) curl https://www.drupal.org/files/issues/2023-04-24/3355535-10.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2687  100  2687    0     0  30198      0 --:--:-- --:--:-- --:--:-- 34448
    patching file markdown_field_formatter.info.yml
    patching file src/Plugin/Field/FieldFormatter/MarkdownFileFormatter.php
    ➜  markdown_field_formatter git:(1.0.0-beta1) ✗ cd ..
    ➜  contrib git:(master) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig markdown_field_formatter
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue-v9/web/modules/contrib/markdown_field_formatter/src/Plugin/Field/FieldFormatter/MarkdownFileFormatter.php
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is League\CommonMark\CommonMarkConverter.
     61 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 134ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • First commit to issue fork.
  • Merge request !1Issue #3355535:fixed phpcs issues. → (Open) created by Unnamed author
  • Status changed to Needs review 4 months ago
  • Status changed to RTBC 4 months ago
  • Hi @atul_ghate,

    The changes you committed on MR !1 was applied not-so successfully, but it fixed all errors.

    markdown_field_formatter git:(1.0.0-beta1) curl https://git.drupalcode.org/project/markdown_field_formatter/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3664    0  3664    0     0  10441      0 --:--:-- --:--:-- --:--:-- 10682
    patching file markdown_field_formatter.info.yml
    Hunk #1 FAILED at 3.
    1 out of 1 hunk FAILED -- saving rejects to file markdown_field_formatter.info.yml.rej
    patching file src/Plugin/Field/FieldFormatter/MarkdownFileFormatter.php
    ➜  markdown_field_formatter git:(1.0.0-beta1) ✗ cd ..
    ➜  contrib git:(master) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig markdown_field_formatter
    ➜  contrib git:(master) ✗

    Will now move this to RTBC

    Thanks,
    Jake

  • Status changed to Needs work 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Let's create a merge request, now that patches are no longer tested.

  • Status changed to RTBC 4 months ago
  • Pipeline finished with Success
    4 months ago
    Total: 129s
    #233242
  • Pipeline finished with Success
    4 months ago
    #233243
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    avpaderno changed the visibility of the branch 3355535-gitlab-ci-reports to hidden.

  • First commit to issue fork.
Production build 0.71.5 2024