Skip to content

Resolve more RuboCop violations

Evan Read requested to merge eread/resolve-more-rubocop-violations into main

What does this MR do and why?

Continuing to resolve RuboCop violation. In this MR, resolve:

  • Style/AndOr and Performance/StringIdentifierArgument:

    lib/helpers/generic.rb:47:47: C: [Correctable] Style/AndOr: Use || instead of or.
          ENV['CI_PROJECT_NAME'] == 'gitlab-docs' or ENV['CI_PROJECT_NAME'].nil?
                                                  ^^
    lib/helpers/icons_helper.rb:9:66: C: [Correctable] Performance/StringIdentifierArgument: Use :ICONS_SVG instead of 'ICONS_SVG'.
        ICONS_SVG = '/assets/images/icons.svg' unless const_defined?('ICONS_SVG')
                                                                     ^^^^^^^^^^^
    lib/helpers/icons_helper.rb:11:27: C: [Correctable] Performance/StringIdentifierArgument: Use :GITLAB_SVGS_MAPPING instead of 'GITLAB_SVGS_MAPPING'.
        unless const_defined?('GITLAB_SVGS_MAPPING')
                              ^^^^^^^^^^^^^^^^^^^^^
  • Layout/ArrayAlignment:

    spec/lib/gitlab/docs/page_spec.rb:49:49: C: [Correctable] Layout/ArrayAlignment: Use one level of indentation for elements following the first line of a multi-line array.
                                                    #internal-anchor
                                                    ^^^^^^^^^^^^^^^^
    spec/lib/gitlab/docs/page_spec.rb:50:49: C: [Correctable] Layout/ArrayAlignment: Use one level of indentation for elements following the first line of a multi-line array.
                                                    #internal-anchor-2
                                                    ^^^^^^^^^^^^^^^^^^
    spec/lib/gitlab/docs/page_spec.rb:51:49: C: [Correctable] Layout/ArrayAlignment: Use one level of indentation for elements following the first line of a multi-line array.
                                                    #utf-8-id-✔]
                                                    ^^^^^^^^^^^
    spec/lib/gitlab/docs/page_spec.rb:58:47: C: [Correctable] Layout/ArrayAlignment: Use one level of indentation for elements following the first line of a multi-line array.
                                                  utf-8-id-✔]
                                                  ^^^^^^^^^^

Screenshots, screen recordings, or links to review app

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports