Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
9 Sep 2021 at 15:42 UTC
Updated:
10 Oct 2021 at 08:09 UTC
Jump to comment: Most recent
Comments
Comment #2
pjotr.savitski commentedComment #3
pjotr.savitski commentedComment #4
pjotr.savitski commentedComment #5
avpadernoComment #6
marijan gudeljin your composer.json please also add the drupal core dependency
Comment #7
marijan gudeljComment #8
pjotr.savitski commentedI've updated the composer.json to include the Drupal Core dependency.
Comment #9
marijan gudeljAutomated test
Passed
Manual test
Individual user account:Yes
No duplication:Yes
Master Branch:Yes
Licensing:Yes
3rd party assets/code:Yes
README.txt/README.md:Yes
Code long/complex enough for review:Yes
Secure code: Yes
Coding style & Drupal API usage:
- Recommendation: in the .module
can go under one if statement.
- Recommendation in the .module and .install
Replace
\Drupal::By adding on top
use DrupalIt is used more that 1 time so this implementation will have a faster execution time.
openid_connect_harid.info.yml
Consider placing the min php version to 7.2 as it is the min recommended version of Drupal 8.8
OpenIDConnectHarIDClient.php
In this part of the code
use Url::fromUri
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Url.php/f...
Comment #10
pjotr.savitski commented@marijan-gudelj I've applied most of the suggested coding style and Drupal API usage changes. There is one thing I didn't understand though. This is in relation to
OpenIDConnectHarIDClient::getEndpoints()method. I'm not sure what would be the win from using aUrl::fromUri()approach. The expected result would still have to be an array with URL strings. Example:I've checked the code behind the
URL::fromUri()and it does seem to apply some checks and possible fixes to the resulting URL, though the result of a call togetBaseUrl()will return the contents of one of the predefined class constants that will already be a correctly formed base URL. I can rewrite the code with ease and just want to know what is the main difference and benefit?It also seems that both .module and .install files already are in the Drupal namespace, which makes
use Drupalunneeded, and even problematic for running tests.Comment #11
marijan gudeljAs for the Url::fromUrl
This is from the documentation:
Same name and namespace in other branches
Creates a new Url object from a URI.
This method is for generating URLs for URIs that:
do not have Drupal routes: both external URLs and unrouted local URIs like base:robots.txt
Replacing \Drupal with use Drupal.
Each time you use a \Drupal you are trying to access the Class or call it.
When you have it one time in the code it makes sense that it is only in that method/function.
When it is repeating it is better to "use Drupal"
Basically it is like you are setting an variable and just reusing it vs. reinitializing the variable.
Hope that this makes sense.
Comment #12
marijan gudeljComment #13
pjotr.savitski commentedI've added the
Url::fromUri()to the plugin code.The
use Drupal;is a bit complicated as IDE is reporting thatThe 'use' statement with non-compound name 'Drupal' has no effectfor both .module and .install files. Running tests also fails with the same message. It seems that those files are already running in the Drupal namespace and class has already been made available.Importing and reusing something makes a lot of sense.
Comment #14
pjotr.savitski commentedComment #15
marijan gudeljThat was more of an advice than an error. It was returned because of the Url Class.
I have rechecked both automated test and redid a manual checkup. I see no other problems here.Unless someone else finds someting.
Comment #16
marijan gudeljComment #17
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.