Module: NYS Universal Navigation Integration
Description: Includes two blocks that are anchored to the top and bottom of every page to integrate the NYS universal navigation on all Drupal sites we maintain.

Project link

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

CommentFileSizeAuthor
#5 nys_unav-phpcs-errors.txt328.76 KBvishal.kadam

Comments

chrisvanwormer created an issue. See original summary.

chrisvanwormer’s picture

Title: D10 NYS Universal Navigation Integration » [2.0.7] NYS Universal Navigation Integration
Category: Support request » Task
vishal.kadam’s picture

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.

vishal.kadam’s picture

Title: [2.0.7] NYS Universal Navigation Integration » [2.0.x] NYS Universal Navigation Integration
Issue summary: View changes
vishal.kadam’s picture

Status: Needs review » Needs work
StatusFileSize
new328.76 KB

1. Fix phpcs issues.

See attached nys_unav-phpcs-errors.txt

2. FILE: nys_unav.info.yml

core_version_requirement: ^8 || ^9 || ^10

The Drupal Core versions before 8.7.7 do not recognize the core_version_requirement key.

3. FILE: README.md

The module uses a README.md file instead of a README.txt file. While the Drupal coding standards have not been yet updated about that, the Drupal.org community consider that positive.
Since there is a README.md file, that should follow the content and formatting described in README.md template.

4. FILE: templates/nys-unav-header.html.twig

    <script type="text/javascript">
        var _NY = {
            HOST: "static-assets.ny.gov",
            BASE_HOST: "www.ny.gov",
            hideSettings: false,
            hideSearch: false
        };
        (function (document, bundle, head) {
            head = document.getElementsByTagName('head')[0];
            bundle = document.createElement('script');
            bundle.type = 'text/javascript';
            bundle.async = true;
            bundle.src = "//static-assets.ny.gov/sites/all/widgets/universal-navigation/js/dist/global-nav-bundle.js";
            head.appendChild(bundle);
        }(document));
    </script>

In Drupal 8 and later versions, stylesheets (CSS) and JavaScript (JS) are loaded through asset libraries.

5. FILE: src/Form/NysUNavForm.php

    /**
     * {@inheritdoc}.
     */
    public function validateForm(array &$form, FormStateInterface $form_state)
    {

    }

Remove empty method.

chrisvanwormer’s picture

Good morning Vishal. Thank you for taking the time to do this.

I've gone ahead and updated the 2.0.x-dev branch. I've fixed all the PHPCS Errors, updated the core_version_requirement, used the template for the README.md, changed our loading of an offsite JS library to be within our libraries.yml file instead of the template and removed the empty method in the NysUNavForm.php file.

chrisvanwormer’s picture

Status: Needs work » Needs review
vishal.kadam’s picture

Status: Needs review » Needs work

1. FILE: src/Form/NysUNavForm.php

$config = \Drupal::configFactory()->getEditable('nys_unav.settings');

\Drupal calls should be avoided in classes, use dependency injection instead.

  /**
   * Implements getFormId() method.
   */
  public function getFormId() {
  /**
   * Implements buildForm() method.
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
  /**
   * Implements submitForm() method.
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
  /**
   * Implements getEditableConfigName() method.
   */
  protected function getEditableConfigNames() {

{@inheritdoc} is used if you are overriding or implementing a method from a base class or interface.

2. FILE: nys_unav.module

/**
 * @file
 * Nys_unav module file used to define basic hooks.
 */

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.

/**
 * Function nys_unav_preprocess.
 */
function nys_unav_preprocess(&$variables) {

When implementing a hook, use a short summary of the form "Implements hook_menu().". Omit the parameter and return value documentation in this case.

3. Code needs to be correctly indented. Drupal uses two spaces for indentation, not four spaces nor tabs.

FILE: templates/nys-unav-footer.html.twig
FILE: templates/nys-unav-header.html.twig
FILE: templates/nys-unav-smartling.html.twig
FILE: js/nys_unav_smartling.js

chrisvanwormer’s picture

Good morning once again Vishal.

Changes have been implemented into 2.0.x-dev.

I updated everything mentioned above. Upon fixing those I ran PHPCS again and had some minor additional changes needed. Those have been fixed as well.

Thanks again.

Updating the status to Needs Review.

chrisvanwormer’s picture

Status: Needs work » Needs review
vishal.kadam’s picture

Rest seems fine to me.

Let’s wait for other reviewers to take a look and if everything goes fine, you will get the role.

chrisvanwormer’s picture

Thanks. Look forward to it.

vishal.kadam’s picture

Priority: Normal » Major

I am changing priority as per Issue priorities.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Priority: Major » Normal
Status: Needs review » Reviewed & tested by the community

Thank you for your contribution and for your patience with the review process!

I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

These are some recommended readings to help you with maintainership:

You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
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 the dedicated reviewers as well.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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