Fix the issues reported by phpcs

Created on 13 April 2023, about 1 year ago
Updated 25 March 2024, 3 months ago

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

FILE: .../contrib/views_cumulative_field/src/Plugin/views/field/CumulativeField.php
--------------------------------------------------------------------------------
FOUND 25 ERRORS AFFECTING 17 LINES
--------------------------------------------------------------------------------
9 | ERROR | [x] There must be one blank line after the last USE statement; 2
| | found;
35 | ERROR | [ ] Missing parameter comment
36 | ERROR | [ ] Missing parameter comment
36 | ERROR | [ ] Missing parameter type
37 | ERROR | [ ] Missing parameter comment
37 | ERROR | [ ] Missing parameter type
38 | ERROR | [ ] Missing parameter comment
45 | ERROR | [ ] Missing member variable doc comment
86 | ERROR | [ ] Missing parameter comment
86 | ERROR | [ ] Missing parameter type
88 | ERROR | [ ] Description for the @return value is missing
105 | ERROR | [ ] Missing parameter comment
105 | ERROR | [ ] Missing parameter type
107 | ERROR | [ ] Description for the @return value is missing
124 | ERROR | [ ] Missing parameter comment
124 | ERROR | [ ] Missing parameter type
126 | ERROR | [ ] Description for the @return value is missing
140 | ERROR | [ ] Missing short description in doc comment
141 | ERROR | [ ] Missing parameter comment
141 | ERROR | [ ] Missing parameter type
142 | ERROR | [ ] Missing parameter comment
142 | ERROR | [ ] Missing parameter type
143 | ERROR | [ ] Missing parameter comment
143 | ERROR | [ ] Missing parameter type
145 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...eb/modules/contrib/views_cumulative_field/views_cumulative_field.views.inc
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
17 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
17 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
18 | WARNING | [x] A comma should follow the last multiline array item. Found:
| | TRUE
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 402ms; Memory: 12MB

๐Ÿ“Œ Task
Status

Fixed

Version

2.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
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

    I will work on this issue.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia saket-001

    thanks @dineshkumarbollu for the patch. Applied successfully and fixes all PHPCS error.
    sharing the SS.

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The patch could apply, but it is not correct.

    -   * @param $plugin_id
    -   * @param $plugin_definition
    +   *   The array of values.
    +   * @param int $plugin_id
    +   *   The Plugin_id value.
    +   * @param string $plugin_definition
    +   *   Definition of Plugin.

    array of values is too generic for that parameter.
    Plugin_id is not an English word.
    The last line is missing an article and misspelling Plugin, since that word is not at the sentence beginning.

        * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    +   *   EntityTypeMangager service.

    There is still a missing article.
    The service name is also misspelled.
    The entity type manager. is a better description; there is no need to say that a manager is a service, since in Drupal that is normal.

        * @return string
    +   *   Return the value of type string

    That description does not make sense. Furthermore, saying that the returned value is a string (which I guess is what that comment is supposed to say) is quite vague and useless, since that is information already given from the parameter type-hinting. The correct description should say what exactly the returned value is, not its type.

    -   * @param $field
    +   * @param string $field
    +   *   Define field value.

    That is a too generic description.

        * @return mixed
    +   *   Reurns the value of Mixed

    There is a typo.
    value of Mixed does not make sense and it does not say what the method returns.

    +   * @param array $values
    +   *   The array of values.
    +   * @param string $field
    +   *   Define field value.
    +   * @param string $relationship
    +   *   Define relationship value.

    Those descriptions are not helpful at all.
    It is not that, for a $random_value parameter, the description can be Define random_value value. because that is wrong and too generic.

    +/**
    + * @file
    + * Define the Hooks of the module.
    + */
    +

    The usual comment is Hook implementations for the [module name] module.
    Hooks is misspelled, since it is not at the beginning of the sentence.

  • Status changed to Needs work about 1 year ago
  • First commit to issue fork.
  • Assigned to shalini_jha
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia shalini_jha

    I will work on this issue.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia shalini_jha

    Added the patch for fixes of listed issues. please review.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia djsagar

    Hi @all,

    After applied patch #10, all phpcs issue are fixed.

    RTBC ++

  • Status changed to RTBC 10 months ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    Hi I also reviewed it.

    Patch applies cleanly.

    I ran phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml

    All the phpcs errors has been removed.

    Module keeps good.

    Moving to RTBC.

  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
        * @param array $configuration
    -   * @param $plugin_id
    -   * @param $plugin_definition
    +   *   An array of configuration used by the plugin.
    +   * @param int $plugin_id
    +   *   The plugin_id for the handler.
    +   * @param string $plugin_definition
    +   *   The plugin implementation definition.

    The type and description of the first three parameters need to be:

    • array $configuration: A configuration array containing information about the plugin instance.
    • string $plugin_id: The plugin ID.
    • mixed $plugin_definition: The plugin implementation definition.
        * Determine if the field comes from a relationship.
        *
    -   * @param $field
    +   * @param string $field
    +   *   The name of the field for which to retrieve the relationship.
       /**
        * Determine if the field is rewritten/altered.
        *
    -   * @param $field
    +   * @param string $field
    +   *   The name of the field to retrieve the rewrite status.
        *
        * @return mixed
    +   *   The rewrite status for the provided field,which can be mixed value.
        */

    Since those documentation comments are changed, Determine must be declined on the third person singular.

    -   * @param $values
    -   * @param $field
    -   * @param $relationship
    +   * Defining the values.
    +   *
    +   * @param array $values
    +   *   An array of values used by the plugin.
    +   * @param string $field
    +   *   The name of the field to retrieve the relationship entity.
    +   * @param string $relationship
    +   *   The name of the relationship to retrieve.
        *
        * @return \Drupal\Core\Entity\EntityInterface|null
    +   *   An entity representing the relationship, or null if not found.
    +   *
        * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
        * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
        */
    -  protected function getRelationshipEntity($values, $field, $relationship) {
    +  protected function getRelationshipEntity(array $values, $field, $relationship) {

    Defining the values. is not the correct description for a getRelationshipEntity() method.

    +/**
    + * @file
    + * Hook implementations for the views_cumulative_field module.

    views_cumulative_field must be replaced from the module name, which is different from the module machine name.

    +      // Allow users to specify how precise the results should be.
    +      // Useful for divisions.

    Allow must be declined on the third person singular.
    The other sentence is missing verb and subject (It is).

  • bindu r โ†’ made their first commit to this issueโ€™s fork.

  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    Addressed above comments in this patch. Please review.

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shank115

    I applied patch provided in #16, applies cleanly. Ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig views_cumulative_field/, found no phpcs errors.

    Checking patch src/Plugin/views/field/CumulativeField.php...
    Checking patch views_cumulative_field.views.inc...
    Applied patch src/Plugin/views/field/CumulativeField.php cleanly.
    Applied patch views_cumulative_field.views.inc cleanly.
  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States andileco

    Would someone please make a merge request from the latest patch? The code looks good, but I like to see the pipeline results that run on merge requests.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Preethy_ray

    pray_12 โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !5Resolve #3353889 "Fix the issues" โ†’ (Merged) created by Unnamed author
  • Status changed to Needs review 3 months ago
  • Pipeline finished with Skipped
    3 months ago
    #116522
  • Status changed to Fixed 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States andileco
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024