- Issue created by @bobi-mel
- 🇮🇳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
- 🇮🇹Italy apaderno Brescia, 🇮🇹
I do not have time to make a deeper review. I just wanted to point out that the following lines (in the src/Form/DarkmodeConfigurationForm.php file) must be changed.
$form['bottom'] = [ '#type' => 'textfield', '#title' => $this->t('Bottom'), '#default_value' => $config->get('bottom') ?? $config->get('bottom'), '#description' => $this->t('Enter number of pixel for Bottom or unset'), ]; $form['right'] = [ '#type' => 'textfield', '#title' => $this->t('Right'), '#default_value' => $config->get('right') ?? $config->get('right'), '#description' => $this->t('Enter number of pixel for Right or unset'), ];
An expression like
$config->get('right') ?? $config->get('right')
is exactly equivalent to$config->get('right')
.
When the null coalescing operator is used, the two expressions must be different. - Status changed to Needs work
12 months ago 3:43pm 29 December 2023 - Status changed to Needs review
12 months ago 4:32pm 30 December 2023 - 🇺🇦Ukraine bobi-mel
I have checked the code of the module and fixed it. Please check one more time.
- Status changed to Needs work
12 months ago 6:20am 2 January 2024 - 🇮🇳India vishal.kadam Mumbai
FILE: darkmode.info.yml
core_version_requirement: ^8 || ^9 || ^10
The Drupal Core versions before 8.7.7 do not recognize the core_version_requirement: key.
The minimum core version requirement should be 9.2.0 since the core/once library is used, which was introduced in version 9.2.0.
- Status changed to Needs review
12 months ago 7:34am 2 January 2024 - 🇺🇦Ukraine bobi-mel
Hi @vishal.kadam @apaderno
I fixed your remarks. Could you check them one more time? - 🇮🇳India rushiraval
I am changing the issue priority as per issue priorities → .
- 🇮🇳India rushiraval
I have reviewed this project findings in comment #3 and #6 are fixed. 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.
- Status changed to RTBC
8 months ago 6:06pm 7 May 2024 This is a minor nuance, but there's a newer version of the .gitlab-ci.yml template available.
There are some coding standards issues. There should be a space before the return type declarations. There are more occurrences that need fixing, but here are some examples:
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition):static { return new static($configuration, $plugin_id, $plugin_definition, $container->get('config.factory') ); } /** * {@inheritdoc} */ public function build():array {
- Status changed to Needs work
7 months ago 4:03pm 20 May 2024 - Status changed to Needs review
7 months ago 4:40pm 20 May 2024 - 🇮🇹Italy apaderno Brescia, 🇮🇹
To make the previous comment clearer, there should be a space after the colon and before the return type hinting, like in the following example.
public function myMethod(MyClass $myClass, string $id): array { // Method code here. }
Is there anything more to be changed? Updating the .gitlab-ci-yml file to latest version from the template file does not change what the GitLab CI jobs do.
That's all that I saw. Did anyone run PAReview.sh against the codebase?
- Status changed to Needs work
7 months ago 5:07pm 20 May 2024 - 🇮🇹Italy apaderno Brescia, 🇮🇹
- The following points are just a start and don't necessarily encompass all of the changes that may be necessary
- A specific point may just be an example and may apply in other places
- A review is about code that doesn't follow the coding standards, contains possible security issue, or does not correctly use the Drupal API; the single points are not ordered, not even by importance
darkmode.module
$output .= '<p>' . t('The Dark Mode module allows users to enable a dark color scheme for') . '</p>'; $output .= '<p>' . t('the website, making it easier on the eyes in low-light environments.') . '</p>';
Sentences to translated are not split in two or more phrases. The full sentence must be used in a translatable string, or translators will lose any context to provide a better translation.
src/Form/DarkmodeConfigurationForm.php
/** * Configure forum settings for Darkmode Switcher block. */
The class does not configure any forum settings. They are settings for the DarkmodeJS library integration.
/** * The config factory. * * @var \Drupal\Core\Config\ConfigFactoryInterface */ private ConfigFactoryInterface $config;
That property is already defined from the parent class, via the trait it uses. There is no need to define it again.
public function __construct(ConfigFactoryInterface $config_factory) { $this->config = $config_factory; parent::__construct($config_factory); }
It is sufficient to call the constructor for the parent class.
/** * {@inheritdoc} */ public static function create(ContainerInterface $container):static { return new static( $container->get('config.factory'), ); } /** * {@inheritdoc} */ public function getFormId():string { return 'darkmode_options_settings'; } /** * {@inheritdoc} */ protected function getEditableConfigNames():array { return [ 'darkmode.options_settings', ]; }
There should be a space after the colons and before
static
,string
, orarray
(as already reported from the previous review).If the purpose of this class is just to provide settings for the block, there is no need to use a new class. A block form is returned by
buildConfigurationForm()
.src/Plugin/Block/DarkmodeSwitcherBlock.php
$config = $this->config->get('darkmode.config'); $build['content'] = [ '#attached' => [ 'drupalSettings' => [ 'darkmode' => [ 'bottom' => $config->get('bottom'), 'right' => $config->get('right'), 'left' => $config->get('left'), 'time' => $config->get('time'), 'mixColor' => $config->get('mix_color'), 'backgroundColor' => $config->get('background_color'), 'buttonColorDark' => $config->get('button_color_dark'), 'buttonColorLight' => $config->get('button_color_light'), 'saveInCookies' => $config->get('save_in_cookies'), 'autoMatchOsTheme' => $config->get('auto_match_os_theme'), ], ], 'library' => [ 'darkmode/initiator', 'darkmode/darkmodecss', ], ], ];
A block configuration is contained in
$this->configuration
. - 🇮🇳India vishal.kadam Mumbai
I am changing priority as per Issue priorities → .
- Status changed to Closed: won't fix
3 months ago 8:16am 24 September 2024 - 🇮🇳India vishal.kadam Mumbai
This thread has been idle, in the Needs work state with no activity for several months. Therefore, I am assuming that you are no longer pursuing this application, and I marked it as Closed (won't fix).
If this is incorrect, and you are still pursuing this application, then please feel free to re-open it and set the issue status to Needs work or Needs review, depending on the current status of your code.