Comments

patelmayank7552 created an issue. See original summary.

patelmayank7552’s picture

Assigned: Unassigned » patelmayank7552
patelmayank7552’s picture

Status: Active » Needs review
Issue tags: -Novice +IttHackathon
StatusFileSize
new89.76 KB
new11.22 KB

Hi,

I have fixed the coding standard for this module.
PFA:
screenshot.png
coding-standard-patch-fix-3076740-3.patch

patelmayank7552’s picture

Assigned: patelmayank7552 » Unassigned
xaiwant’s picture

Status: Needs review » Reviewed & tested by the community

Hi @patelmayank7552 marking this resolve. as i don't see any issue in code report

jaykandari’s picture

Issue tags: +DIACWJuly2020, +Novice
jaykandari’s picture

Version: 8.x-1.0 » 2.x-dev
rohittiwari’s picture

Steps to test the patch provided above https://www.drupal.org/files/issues/2019-08-23/coding-standard-patch-fix...
1. installed and configured phpcs for drupal using documentation https://www.drupal.org/docs/contributed-modules/code-review-module/insta...
2. ran the code phpcs --standard=Drupal,DrupalPractice . and received

FILE: /home/rohit/login_popup/src/Plugin/Block/LoginAndRegisterPopup.php
--------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 3 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------------------------------------------
  7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  7 | ERROR   | [x] When importing a class with "use", do not include a leading \
 24 | ERROR   | [x] Expected 1 blank line before function; 2 found
 27 | ERROR   | [x] Short array syntax must be used to define arrays
 28 | ERROR   | [x] Short array syntax must be used to define arrays
 29 | ERROR   | [x] Short array syntax must be used to define arrays
 38 | WARNING | [ ] t() calls should be avoided in classes, use
    |         |     \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 39 | WARNING | [ ] t() calls should be avoided in classes, use
    |         |     \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 41 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 44 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------
FILE: /home/rohit/login_popup/src/Plugin/Block/LoginFormPopup.php
--------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------------------------
  7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  7 | ERROR   | [x] When importing a class with "use", do not include a leading \
 24 | ERROR   | [x] Expected 1 blank line before function; 2 found
 26 | ERROR   | [x] Short array syntax must be used to define arrays
 27 | ERROR   | [x] Short array syntax must be used to define arrays
 28 | ERROR   | [x] Short array syntax must be used to define arrays
 36 | WARNING | [ ] t() calls should be avoided in classes, use
    |         |     \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------
FILE: /home/rohit/login_popup/src/Plugin/Block/RegisterFormPopup.php
--------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------------------------
  7 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  7 | ERROR   | [x] When importing a class with "use", do not include a leading \
 24 | ERROR   | [x] Expected 1 blank line before function; 2 found
 26 | ERROR   | [x] Short array syntax must be used to define arrays
 27 | ERROR   | [x] Short array syntax must be used to define arrays
 28 | ERROR   | [x] Short array syntax must be used to define arrays
 36 | WARNING | [ ] t() calls should be avoided in classes, use
    |         |     \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 38 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 41 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------
Time: 63ms; Memory: 8MB

3. applied patch using cmd

curl -O https://www.drupal.org/files/issues/2019-08-23/coding-standard-patch-fix-3076740-3.patch
 git apply coding-standard-patch-fix-3076740-3.patch

4. ran and tested the patch with following output

rohit@rohit-laptop ~/login_popup (2.x) $ git apply coding-standard-patch-fix-3076740-3.patch
rohit@rohit-laptop ~/login_popup (2.x) $ phpcs --standard=Drupal,DrupalPractice .
rohit@rohit-laptop ~/login_popup (2.x) $ 

5. So patch works as expected.

jaykandari’s picture

jaykandari’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all for contributing.

Merged & Pushed to 2.x branch.

jaykandari’s picture

jaykandari’s picture

jaykandari’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.