Hi @rsych
I've tested the module, so it does a great job!
I like the way you followed the coding but there is still some minor stuff to adjust:

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

FILE: C:\Ampps\www\my_coding_review\web\modules\contrib\simple_percentage_field\README.md
-----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 27 | WARNING | Line exceeds 80 characters; contains 97 characters
-----------------------------------------------------------------------------------------


FILE: C:\Ampps\www\my_coding_review\web\modules\contrib\simple_percentage_field\simple_percentage_field.info.yml
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" 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
----------------------------------------------------------------------------------------------------------------


FILE: C:\Ampps\www\my_coding_review\web\modules\contrib\simple_percentage_field\src\Plugin\Field\FieldFormatter\SimplePercentageDefaultFormatter.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------
 34 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 35 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 36 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 37 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 38 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 39 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
----------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\Ampps\www\my_coding_review\web\modules\contrib\simple_percentage_field\src\Plugin\Field\FieldType\SimplePercentageItem.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------
 71 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 72 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
 73 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: C:\Ampps\www\my_coding_review\web\modules\contrib\simple_percentage_field\src\Plugin\Field\FieldWidget\SimplePercentageDefaultWidget.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------
 46 | ERROR | [x] Separate the @param and @return sections by a blank line.
 46 | ERROR | [ ] Description for the @return value is missing
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

Time: 189ms; Memory: 10MB

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

FILE: C:\Ampps\www\my_coding_review\web\modules\contrib\simple_percentage_field\src\Plugin\Field\FieldType\SimplePercentageItem.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 84 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 91 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Time: 435ms; Memory: 8MB

Thanks!

Comments

LuongGiap created an issue. See original summary.

rsych’s picture

Assigned: Unassigned » rsych

  • rsych committed 63eb500 on 1.0.x
    Resolve #3276362 'Review Coding standard modules'.
    
rsych’s picture

Status: Active » Fixed

Hi @LuongGiap, thank you for your help! I updated the code and released it in the 1.0.1 release: https://www.drupal.org/project/simple_percentage_field/releases/1.0.1

Regarding the info.yml file - I didn't add those lines of code, they were added by Drupal.

rsych’s picture

Status: Fixed » Closed (fixed)