- Issue created by @andersmosshall
- 🇮🇳India vishal.kadam Mumbai
Thank you for applying!
Please read Review process for security advisory coverage: What to expect → for more details and Security advisory coverage application checklist → to understand what reviewers look for. Tips for ensuring a smooth review → gives some hints for a smoother review.
The important notes are the following.
- If you have not done it yet, you should run
phpcs --standard=Drupal,DrupalPractice
on the project, which alone fixes most of what reviewers would report. - For the time this application is open, only your commits are allowed.
- The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
- We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.
To the reviewers
Please read How to review security advisory coverage applications → , Application workflow → , What to cover in an application review → , and Tools to use for reviews → .
The important notes are the following.
- It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
- Reviewers should show the output of a CLI tool → only once per application.
- It may be best to have the applicant fix things before further review.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues → .
- If you have not done it yet, you should run
- 🇮🇳India vishal.kadam Mumbai
1. Fix phpcs issues.
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml autologout_alterable/ FILE: autologout_alterable/src/AutologoutManagerInterface.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Utility\AutologoutProfileInterface. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/src/Events/AutologoutProfileAlterEvent.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Utility\AutologoutProfileInterface. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/src/EventSubscriber/AutologoutSubscriber.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\AutologoutManagerInterface. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/src/AutologoutManager.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 19 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Events\AutologoutAlterEnabledEvent. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/src/Controller/AutologoutController.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\AutologoutManagerInterface. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutProfileAlterEventTest.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Events\AutologoutProfileAlterEvent. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutSetLastActivityEventTest.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Events\AutologoutSetLastActivityEvent. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutControllerTest.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\AutologoutManagerInterface. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutManagerTest.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 22 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\AutologoutManager. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutProfileTest.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Utility\AutologoutProfile. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutAlterEnabledEventTest.php ------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\Events\AutologoutAlterEnabledEvent. ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------- FILE: autologout_alterable/tests/src/Unit/AutologoutSubscriberTest.php ------------------------------------------------------------------------------- FOUND 3 ERRORS AFFECTING 3 LINES ------------------------------------------------------------------------------- 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\autologout_alterable\AutologoutManagerInterface. 111 | ERROR | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines 127 | ERROR | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines ------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------
2. FILE: autologout_alterable.libraries.yml
version: VERSION
VERSION is only used by Drupal core modules. Contributed modules should use a literal string that does not change with the Drupal core version a site is using.
3. FILE: autologout_alterable.module
/** * @file * Automated Logout Alterable - Module. */
The usual description for a .module file is Hook implementations for the [module name] module. where [module name] is the module name given in the .info.yml file.
/** * Implements hook_form_FORM_ID_alter(). * * Adds a field to user/edit to change that users logout. */ function autologout_alterable_form_user_form_alter(&$form, FormStateInterface $form_state) {
The description for that hook should also say for which form that hook is implemented, either by indicating that with the name of the class that implements the form (namespace included) or the form ID (which is usually indicated by
getFormId()
).4. FILE: src/EventSubscriber/AutologoutSubscriber.php
/** * AutologoutSubscriber constructor. * * @param \Drupal\autologout_alterable\AutologoutManagerInterface $autologoutManager * The autologout manager. * @param \Drupal\Core\Session\AccountInterface $currentUser * The current user. * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack * The request stack. */ public function __construct(
FILE: src/Utility/AutologoutProfile.php
/** * AutologoutProfile constructor. * * @param \DateTime|null $lastActivity * The last activity time. * @param \DateTime|null $sessionExpiration * The session expiration time. * @param \Drupal\Core\Url $redirectUrl * The redirect URL (after expired session). * @param bool $extendible * Whether the session is extendible. */ public function __construct(
The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.
- 🇸🇪Sweden andersmosshall
@vishal.kadam
Good inputs. I have now taken care of the suggested changes.But, the phpcs issue is a mysterium. When running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml autologout_alterable/ I also got the "Use statements should be sorted alphabetically." error and the order that has been updated now makes sence for a human.
But ci in gitlabs has a different opinion of what "sorted alphabetically" means.see: https://git.drupalcode.org/project/autologout_alterable/-/jobs/3129616
It seems like in gitlab ci "autologout_alterable" should be sorted after "Core", e.g. uppercase "C" goes before lowercase "a". Could that be system dependent?
I would very much keep it in the now updated order, which also is what phpstorm ide autoformat it to. But at the same time I dont want gitlab ci to fail on phpcs. Any idea how to resolve it?
- 🇮🇳India vishal.kadam Mumbai
If you have enabled GitLab CI for the project, and the phpcs job runs for each commit, fix what reported by that GitLab CI job. Clearly, that is valid if the phpcs job has not been customized to avoid most of the PHP_CodeSniffer errors/warnings.
- 🇸🇪Sweden andersmosshall
Yes, but that is the thing. If I make phpcs locally happy (with the alphabetical sort order) gitlab-ci complains and vice versa.
Phpcs locally, and for you obviously, want it sorted one way. Gitlab-ci want is sorted an other. Having different views of how uppercase/lowercase fits in the alphabetical order.
- 🇸🇪Sweden andersmosshall
Maybe its a bug in gitlab-ci phpcs? Worst case I could make a skip for that phpcs rule but thats is not ideal.
- 🇸🇪Sweden andersmosshall
Aha, it seems like there is not yet a consensus of what the use statement order should be
https://www.drupal.org/project/coding_standards/issues/1624564 📌 Coding standards for "use" statements RTBCIt makes sence that I implement it as gitlab-ci wants it (even if we don't really agree with it at the moment) and change once/if the standard gets in place in gitlab-ci.
I push a revert of the alphabetical sort now to the 1.0.x
- 🇮🇳India vishal.kadam Mumbai
Rest looks fine to me.
Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.