Personal Access Restriction module provides the ability to restrict access to a particular Node or Taxonomy Term by UID or User role.
Also, it provides the ability to select the type of response ("Access denied" or "Page not found").

Project link

https://www.drupal.org/project/par

Git instructions

git clone --branch 8.x-2.x https://git.drupalcode.org/project/par.git

PAReview checklist

https://pareview.sh/pareview/https-git.drupal.org-project-par-8.x-2.x

Comments

rsych created an issue. See original summary.

rksyravi’s picture

Issue summary: View changes

Hi @rsych,
Thank you for your contribution!!!

Initially, you'll need to fix coding standards and all the errors & warnings mentioned below.
Along with that, I am adding the link of PAReview checklist here as well as in the issue summary which will help in fixes.

PAReview checklist

https://pareview.sh/pareview/https-git.drupal.org-project-par-8.x-2.x

Your README.md does not follow best practices (headings need to be uppercase). See https://www.drupal.org/node/2181737 .
The INTRODUCTION section is missing.
The REQUIREMENTS section is missing.
The INSTALLATION section is missing.
The CONFIGURATION section is missing.
The par.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.
DrupalPractice has found some issues with your code, but could be false positives.

FILE: ...te1101/web/vendor/drupal/pareviewsh/pareview_temp/src/ParService.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 13 WARNINGS AFFECTING 12 LINES
--------------------------------------------------------------------------
  29 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
  38 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
  57 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
  65 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
  81 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
  96 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
  99 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 117 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 148 | WARNING | User::load calls should be avoided in classes, use
     |         | dependency injection instead
 148 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 174 | WARNING | t() calls should be avoided in classes, use dependency
     |         | injection and $this->t() instead
 175 | WARNING | t() calls should be avoided in classes, use dependency
     |         | injection and $this->t() instead
 176 | WARNING | t() calls should be avoided in classes, use dependency
     |         | injection and $this->t() instead
--------------------------------------------------------------------------


FILE: ...1/web/vendor/drupal/pareviewsh/pareview_temp/src/Form/ConfigForm.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------
 33 | WARNING | \Drupal calls should be avoided in classes, use
    |         | dependency injection instead
 35 | WARNING | \Drupal calls should be avoided in classes, use
    |         | dependency injection instead
--------------------------------------------------------------------------


FILE: ...00000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/par.module
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------
  9 | WARNING | Global constants should not be used, move it to a class
    |         | or interface
 10 | WARNING | Global constants should not be used, move it to a class
    |         | or interface
 11 | WARNING | Global constants should not be used, move it to a class
    |         | or interface
--------------------------------------------------------------------------

Time: 823ms; Memory: 4Mb
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: ...000000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/README.md
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------
  5 | WARNING | Line exceeds 80 characters; contains 132 characters
  6 | WARNING | Line exceeds 80 characters; contains 99 characters
 12 | WARNING | Line exceeds 80 characters; contains 162 characters
 13 | WARNING | Line exceeds 80 characters; contains 155 characters
 14 | WARNING | Line exceeds 80 characters; contains 135 characters
 15 | WARNING | Line exceeds 80 characters; contains 109 characters
 16 | WARNING | Line exceeds 80 characters; contains 276 characters
 17 | WARNING | Line exceeds 80 characters; contains 165 characters
 18 | WARNING | Line exceeds 80 characters; contains 258 characters
--------------------------------------------------------------------------


FILE: ...0000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/par.install
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: ...te1101/web/vendor/drupal/pareviewsh/pareview_temp/src/ParService.php
--------------------------------------------------------------------------
FOUND 53 ERRORS AFFECTING 36 LINES
--------------------------------------------------------------------------
  15 | ERROR | [ ] Missing parameter comment
  15 | ERROR | [ ] Missing parameter type
  16 | ERROR | [ ] Missing parameter comment
  16 | ERROR | [ ] Missing parameter type
  17 | ERROR | [ ] Missing parameter comment
  18 | ERROR | [ ] Missing parameter comment
  19 | ERROR | [ ] Missing parameter comment
  21 | ERROR | [ ] Type hint "array" missing for $uids
  21 | ERROR | [ ] Type hint "array" missing for $roles
  31 | ERROR | [x] Array indentation error, expected 12 spaces but found
     |       |     14
  32 | ERROR | [x] Array closing indentation error, expected 10 spaces
     |       |     but found 12
  40 | ERROR | [x] Array indentation error, expected 12 spaces but found
     |       |     14
  41 | ERROR | [x] Array closing indentation error, expected 10 spaces
     |       |     but found 12
  50 | ERROR | [ ] Missing parameter comment
  50 | ERROR | [ ] Missing parameter type
  51 | ERROR | [ ] Missing parameter comment
  51 | ERROR | [ ] Missing parameter type
  52 | ERROR | [ ] Missing parameter comment
  53 | ERROR | [ ] Missing parameter comment
  54 | ERROR | [ ] Missing parameter comment
  56 | ERROR | [ ] Type hint "array" missing for $uids
  56 | ERROR | [ ] Type hint "array" missing for $roles
  77 | ERROR | [ ] Missing parameter comment
  77 | ERROR | [ ] Missing parameter type
  78 | ERROR | [x] Separate the @param and @return sections by a blank
     |       |     line.
  78 | ERROR | [ ] Description for the @return value is missing
  89 | ERROR | [x] Doc comment short description must start with a
     |       |     capital letter
  91 | ERROR | [ ] Missing parameter comment
  92 | ERROR | [x] Separate the @param and @return sections by a blank
     |       |     line.
  92 | ERROR | [ ] Description for the @return value is missing
  94 | ERROR | [ ] Type hint "null" missing for $uid
 109 | ERROR | [ ] Missing parameter comment
 110 | ERROR | [ ] Missing parameter comment
 111 | ERROR | [ ] Missing parameter comment
 112 | ERROR | [ ] Missing parameter comment
 113 | ERROR | [ ] Missing parameter comment
 114 | ERROR | [x] Separate the @param and @return sections by a blank
     |       |     line.
 114 | ERROR | [ ] Description for the @return value is missing
 116 | ERROR | [ ] Type hint "null" missing for $uid
 116 | ERROR | [ ] Type hint "null" missing for $role
 116 | ERROR | [ ] Type hint "null" missing for $action
 142 | ERROR | [ ] Missing parameter comment
 142 | ERROR | [ ] Missing parameter type
 143 | ERROR | [ ] Missing parameter comment
 143 | ERROR | [ ] Missing parameter type
 144 | ERROR | [ ] Missing parameter comment
 145 | ERROR | [x] Separate the @param and @return sections by a blank
     |       |     line.
 145 | ERROR | [ ] Description for the @return value is missing
 147 | ERROR | [ ] Type hint "null" missing for $uid
 169 | ERROR | [ ] Missing parameter comment
 169 | ERROR | [ ] Missing parameter type
 170 | ERROR | [x] Separate the @param and @return sections by a blank
     |       |     line.
 170 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: ...1/web/vendor/drupal/pareviewsh/pareview_temp/src/Form/ConfigForm.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------
 201 | WARNING | Possible useless method overriding detected
--------------------------------------------------------------------------


FILE: ...00000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/par.module
--------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------
  1 | ERROR | [x] Missing file doc comment
 95 | ERROR | [x] Missing function doc comment
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

Time: 1.26 secs; Memory: 6Mb
rksyravi’s picture

Status: Active » Needs work
rksyravi’s picture

Issue summary: View changes

Hi,

also, git branch should be 8.x-2.x instead master

rsych’s picture

Hi, I pushed my changes to the 8.x-2.x branch. Can you check or tell me are these changes available for you?

avpaderno’s picture

Remember to change status after you change the code as reported, or reviewers will not know the project is ready to be reviewed again.

rsych’s picture

Status: Needs work » Needs review

@kiamlaluno, thanks

maheshkp92’s picture

Status: Needs review » Needs work
StatusFileSize
new379.08 KB

PAReview issues haven't been fixed yet.

Changing status back to "Needs Work" state.

PFA

avpaderno’s picture

Status: Needs work » Needs review

A review should point out what needs to be changed, not showing a screenshot of what a tool reports.

ankush_03’s picture

Status: Needs review » Needs work

Still some issue pending :

Git errors:
There is still a master branch, make sure to set the correct default branch: https://www.drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in https://www.drupal.org/node/1127732
Review of the 8.x-2.x branch (commit 44019b9):
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: ...0000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/par.install
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------
5 | WARNING | Line exceeds 80 characters; contains 86 characters
--------------------------------------------------------------------------

FILE: ...te1101/web/vendor/drupal/pareviewsh/pareview_temp/src/ParService.php
--------------------------------------------------------------------------
FOUND 64 ERRORS AND 2 WARNINGS AFFECTING 46 LINES
--------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
27 | ERROR | [x] Data types in @var tags need to be fully namespaced
34 | ERROR | [x] Data types in @var tags need to be fully namespaced
34 | ERROR | [x] Data types in @var tags need to be fully namespaced
36 | ERROR | [ ] Class property $user_storage should use lowerCamel
| | naming without underscores
41 | ERROR | [x] Data types in @var tags need to be fully namespaced
48 | ERROR | [ ] Missing parameter comment
48 | ERROR | [x] Data types in @param tags need to be fully
| | namespaced
49 | ERROR | [x] Separate the @param and @return sections by a blank
| | line.
59 | ERROR | [ ] Parameter $current_user is not described in comment
59 | ERROR | [ ] Parameter $user_storage is not described in comment
62 | ERROR | [x] Data types in @param tags need to be fully
| | namespaced
74 | ERROR | [ ] Missing parameter comment
74 | ERROR | [ ] Missing parameter type
75 | ERROR | [ ] Missing parameter comment
75 | ERROR | [ ] Missing parameter type
76 | ERROR | [ ] Missing parameter comment
77 | ERROR | [ ] Missing parameter comment
78 | ERROR | [ ] Missing parameter comment
80 | ERROR | [ ] Type hint "array" missing for $uids
80 | ERROR | [ ] Type hint "array" missing for $roles
90 | ERROR | [x] Array indentation error, expected 12 spaces but
| | found 14
91 | ERROR | [x] Array closing indentation error, expected 10 spaces
| | but found 12
99 | ERROR | [x] Array indentation error, expected 12 spaces but
| | found 14
100 | ERROR | [x] Array closing indentation error, expected 10 spaces
| | but found 12
109 | ERROR | [ ] Missing parameter comment
109 | ERROR | [ ] Missing parameter type
110 | ERROR | [ ] Missing parameter comment
110 | ERROR | [ ] Missing parameter type
111 | ERROR | [ ] Missing parameter comment
112 | ERROR | [ ] Missing parameter comment
113 | ERROR | [ ] Missing parameter comment
115 | ERROR | [ ] Type hint "array" missing for $uids
115 | ERROR | [ ] Type hint "array" missing for $roles
136 | ERROR | [ ] Missing parameter comment
136 | ERROR | [ ] Missing parameter type
137 | ERROR | [x] Separate the @param and @return sections by a blank
| | line.
137 | ERROR | [ ] Description for the @return value is missing
148 | ERROR | [x] Doc comment short description must start with a
| | capital letter
150 | ERROR | [ ] Missing parameter comment
151 | ERROR | [x] Separate the @param and @return sections by a blank
| | line.
151 | ERROR | [ ] Description for the @return value is missing
153 | ERROR | [ ] Type hint "null" missing for $uid
168 | ERROR | [ ] Missing parameter comment
169 | ERROR | [ ] Missing parameter comment
170 | ERROR | [ ] Missing parameter comment
171 | ERROR | [ ] Missing parameter comment
172 | ERROR | [ ] Missing parameter comment
173 | ERROR | [x] Separate the @param and @return sections by a blank
| | line.
173 | ERROR | [ ] Description for the @return value is missing
175 | ERROR | [ ] Type hint "null" missing for $uid
175 | ERROR | [ ] Type hint "null" missing for $role
175 | ERROR | [ ] Type hint "null" missing for $action
201 | ERROR | [ ] Missing parameter comment
201 | ERROR | [ ] Missing parameter type
202 | ERROR | [ ] Missing parameter comment
202 | ERROR | [ ] Missing parameter type
203 | ERROR | [ ] Missing parameter comment
204 | ERROR | [x] Separate the @param and @return sections by a blank
| | line.
204 | ERROR | [ ] Description for the @return value is missing
206 | ERROR | [ ] Type hint "null" missing for $uid
228 | ERROR | [ ] Missing parameter comment
228 | ERROR | [ ] Missing parameter type
229 | ERROR | [x] Separate the @param and @return sections by a blank
| | line.
229 | ERROR | [ ] Description for the @return value is missing
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

Time: 1.51 secs; Memory: 6Mb

shaktik’s picture

Please fix also some drupal-check error.

 4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------
  Line   par.module
 ------ --------------------------------------------
  89     Variable $uids_value might not be defined.
  137    Variable $id might not be defined.
 ------ --------------------------------------------

 ------ -------------------------------------------------------
  Line   src/Form/ConfigForm.php
 ------ -------------------------------------------------------
  45     Unsafe usage of new static().
         💡 Consider making the class or the constructor final.
  116    Variable $roles_options might not be defined.
  189    Variable $entity_link might not be defined.
  190    Variable $user_link_rendered might not be defined.
  197    Variable $user_link_rendered might not be defined.
  200    Variable $roles_options might not be defined.
 ------ -------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------------------
  Line   src/ParService.php
 ------ --------------------------------------------------------------------------------------------------------------------------------------
  52     Unsafe usage of new static().
         💡 Consider making the class or the constructor final.
  67     Property Drupal\par\ParService::$currentUser (Drupal\user\Entity\User) does not accept Drupal\Core\Session\AccountProxyInterface.
  80     PHPDoc tag @param has invalid value ($entity_id): Unexpected token "$entity_id", expected type at offset 87
  80     PHPDoc tag @param has invalid value ($entity_type): Unexpected token "$entity_type", expected type at offset 62
  115    PHPDoc tag @param has invalid value ($entity_id): Unexpected token "$entity_id", expected type at offset 96
  115    PHPDoc tag @param has invalid value ($entity_type): Unexpected token "$entity_type", expected type at offset 71
  139    PHPDoc tag @param has invalid value ($entity_id): Unexpected token "$entity_id", expected type at offset 52
  154    Negated boolean expression is always true.
         💡 Because the type is coming from a PHPDoc, you can turn off this check by setting treatPhpDocTypesAsCertain: false in your
         /var/folders/7b/58x5q1ls1qd2_f13nq14bft80000gp/T/drupal_check_phpstan_1586165891.neon.
  175    Default value of the parameter #3 $uid (0) of method Drupal\par\ParService::getRecords() is incompatible with type null.
  175    Default value of the parameter #4 $role ('') of method Drupal\par\ParService::getRecords() is incompatible with type null.
  175    Default value of the parameter #5 $action ('') of method Drupal\par\ParService::getRecords() is incompatible with type null.
  185    If condition is always false.
         💡 Because the type is coming from a PHPDoc, you can turn off this check by setting treatPhpDocTypesAsCertain: false in your
         /var/folders/7b/58x5q1ls1qd2_f13nq14bft80000gp/T/drupal_check_phpstan_1586165891.neon.
  188    If condition is always false.
         💡 Because the type is coming from a PHPDoc, you can turn off this check by setting treatPhpDocTypesAsCertain: false in your
         /var/folders/7b/58x5q1ls1qd2_f13nq14bft80000gp/T/drupal_check_phpstan_1586165891.neon.
  191    If condition is always false.
         💡 Because the type is coming from a PHPDoc, you can turn off this check by setting treatPhpDocTypesAsCertain: false in your
         /var/folders/7b/58x5q1ls1qd2_f13nq14bft80000gp/T/drupal_check_phpstan_1586165891.neon.
  206    Default value of the parameter #3 $uid (0) of method Drupal\par\ParService::getContentAccessStatus() is incompatible with type null.
  206    PHPDoc tag @param has invalid value ($entity_id): Unexpected token "$entity_id", expected type at offset 111
  206    PHPDoc tag @param has invalid value ($entity_type): Unexpected token "$entity_type", expected type at offset 86
  207    Ternary operator condition is always false.
         💡 Because the type is coming from a PHPDoc, you can turn off this check by setting treatPhpDocTypesAsCertain: false in your
         /var/folders/7b/58x5q1ls1qd2_f13nq14bft80000gp/T/drupal_check_phpstan_1586165891.neon.
  231    PHPDoc tag @param has invalid value ($id): Unexpected token "$id", expected type at offset 63
  233    Call to an undefined method Drupal\par\ParService::t().
  234    Call to an undefined method Drupal\par\ParService::t().
  235    Call to an undefined method Drupal\par\ParService::t().
 ------ --------------------------------------------------------------------------------------------------------------------------------------


 [ERROR] Found 30 errors
avpaderno’s picture

Priority: Normal » Minor
avpaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application due to lack of replies.
The last commit has been done 9 months ago, before the last two reviews.