RuboCop: Ignore parent exclusions when RuboCop is run within gems/
What does this MR do and why?
With this MR, we no longer need to run rubocop
with --config .rubocop.yml
in monorepo or gem directory.
Now, running rubocop
in both monorepo and gems/ directories behaves as
expected:
- In monorepo, inspecting files with
--force-exclusion
from gems/ is a no-op - In gems/, inspect files works without passing
--config .rubocop.yml
Please see #417281 (closed) for much context and further investigation.
How to set up and validate locally
$ cd gitlab # monorepo
$ bundle exec rubocop --force-exclusion gems/gitlab-utils/lib/gitlab/utils/strong_memoize.rb
Inspecting 0 files
0 files inspected, no offenses detected
$ for i in $(ls gems/*/.rubocop.yml); do (cd $(dirname $i) && pwd && bundle --quiet && bundle exec rubocop
); done
/home/peter/devel/gitlab/gdk/gitlab/gems/activerecord-gitlab
Inspecting 8 files
........
8 files inspected, no offenses detected
/home/peter/devel/gitlab/gdk/gitlab/gems/click_house-client
Inspecting 0 files
0 files inspected, no offenses detected
/home/peter/devel/gitlab/gdk/gitlab/gems/gitlab-rspec
Inspecting 9 files
.........
9 files inspected, no offenses detected
/home/peter/devel/gitlab/gdk/gitlab/gems/gitlab-schema-validation
Inspecting 66 files
..................................................................
66 files inspected, no offenses detected
/home/peter/devel/gitlab/gdk/gitlab/gems/gitlab-utils
Inspecting 12 files
............
12 files inspected, no offenses detected
/home/peter/devel/gitlab/gdk/gitlab/gems/ipynbdiff
Inspecting 15 files
...............
15 files inspected, no offenses detected
/home/peter/devel/gitlab/gdk/gitlab/gems/rspec_flaky
Inspecting 17 files
.................
17 files inspected, no offenses detected
gems/click_house-client
. This is addressed in !126183 (comment 1467108888).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen