Hi ,

Please fix Coding Standarad issue.

GOTO https://pareview.sh : Enter 8.x-1.x branch url i.e. https://git.drupal.org/project/block_permissions 8.x-1.x

Review of the 8.x-1.x branch (commit 4b204ed):

The block_permissions.module does not implement hook_help(). See https://www.drupal.org/docs/develop/documenting-your-project/module-docu... .
Coder Sniffer has found some issues with your code (please check the Drupal coding standards). See attachment.
No automated test cases were found, did you consider writing PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script.

FILE: .../drupal/pareviewsh/pareview_temp/src/BlockPermissionsPermissions.php
--------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------
32 | ERROR | [ ] Parameter $block_manager is not described in comment
76 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: ...ndor/drupal/pareviewsh/pareview_temp/src/Routing/RouteSubscriber.php
--------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------
20 | ERROR | [x] Short array syntax must be used to define arrays
27 | ERROR | [x] Short array syntax must be used to define arrays
34 | ERROR | [x] Short array syntax must be used to define arrays
41 | ERROR | [x] Short array syntax must be used to define arrays
48 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: ...areviewsh/pareview_temp/src/BlockPermissionsAccessControlHandler.php
--------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------
98 | ERROR | [x] Short array syntax must be used to define arrays
111 | ERROR | [x] Return comment indentation must be 3 spaces, found 4
| | spaces
129 | ERROR | [x] Return comment indentation must be 3 spaces, found 4
| | spaces
148 | ERROR | [x] Return comment indentation must be 3 spaces, found 4
| | spaces
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: .../web/vendor/drupal/pareviewsh/pareview_temp/block_permissions.module
--------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------
8 | ERROR | [x] When importing a class with "use", do not include a
| | leading \
9 | ERROR | [x] When importing a class with "use", do not include a
| | leading \
10 | ERROR | [x] When importing a class with "use", do not include a
| | leading \
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

Time: 949ms; Memory: 4Mb

Comments

ankush_03’s picture

Category: Task » Bug report
ankush_03’s picture

Title: Coding Standarad issue » Coding Standarad issues
nishantghetiya’s picture

Assigned: Unassigned » nishantghetiya
nishantghetiya’s picture

Assigned: nishantghetiya » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.41 KB

@ankushgautam76@gmail.com

Please check below patch for fix coding standard issue.

Thanks

abhisekmazumdar’s picture

Status: Needs review » Needs work

Hi, @nishantghetiya thanks for fixing the coding standard issues. I have some suggestions to make.

+++ b/src/BlockPermissionsAccessControlHandler.php
@@ -95,7 +95,7 @@ class BlockPermissionsAccessControlHandler implements ContainerInjectionInterfac
+        \Drupal::logger('block_permissions')->error('User @user has the administer block settings permission but no access to the default theme @theme, this is required.', ['@user' => $account->getAccountName(), '@theme' => $theme]);

Using dependency injection will be a better option here, which will get covered under coding standards.
Ref: https://www.drupal.org/docs/8/api/logging-api/overview

ankush_03’s picture

@nishantghetiya

Add changes as suggested by @abhisekmazumdar and update the new patch.

ankush_03’s picture

Status: Needs work » Needs review
StatusFileSize
new6.75 KB
ankush_03’s picture

@nishantghetiya

I have applied your patch first, then add logger dependency and create a new patch, Kindly check, and review.

abhisekmazumdar’s picture

Status: Needs review » Needs work

Hi, @ankushgautam76@gmail.com thanks for the updated patch.
But there still a few issues left to cover kindly run phpcs for the files.

Some example:
File: /src/BlockPermissionsAccessControlHandler.php
30 | ERROR | [x] Whitespace found at end of line
49 | ERROR | [ ] Parameter $logger_factory is not described in comment
72 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
97 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead

nishantghetiya’s picture

StatusFileSize
new6.8 KB

@abhisekmazumdar @ankushgautam76@gmail.com

I have updated above patch with a solution of phpcs warning. Please review.

abhisekmazumdar’s picture

Status: Needs work » Reviewed & tested by the community

Hi @nishantghetiya
The patch looks good.

sinn’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new9.8 KB

Let's test patch.

  • sinn committed 48dacf0 on 8.x-1.x
    Issue #3104768 by nishantghetiya, ankushgautam76@gmail.com, sinn: Coding...
sinn’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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