Skip to content

Enable Style/GlobalVars cop through all files in RuboCop

Takuya Noguchi requested to merge tnir-enable-style-global-vars-rubocop into master

What does this MR do?

Enables Style/GlobalVars cop through all files in RuboCop.

The enabled cop does work as follows:

$ time bundle exec rubocop -P
echo Inspecting 736 files
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

736 files inspected, no offenses detected

real    0m3.215s
user    0m3.625s
sys     0m1.482s
$ echo 'p $a' >> lib/gitlab/tasks/aws.rake
$ time bundle exec rubocop -P
Inspecting 736 files
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C...........................................................................................................................................................................................................................................................................

Offenses:

lib/gitlab/tasks/aws.rake:31:3: C: Style/GlobalVars: Do not introduce global variables.
p $a
  ^^

736 files inspected, 1 offense detected

real    0m4.890s
user    0m4.334s
sys     0m1.792s

This cop against some files was introduced in !1392 (merged).

Related issues

Follows up !6355 (merged)

Updates Run rubocop over lib directory (!1392 - merged)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • [n/a] Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • [n/a] trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • [n/a] Documentation created/updated
  • [n/a] Tests added
  • [n/a] Integration tests added to GitLab QA
  • [n/a] Equivalent MR/issue for the GitLab Chart opened
Edited by Takuya Noguchi

Merge request reports

Loading