Work around RubyMine usability/productivity problems related to RuboCop Gitlab/NamespacedClass cop
What does this MR do and why?
This MR is related to the remaining unfixed Gitlab/NamespacedClass
cop warnings and their interaction with the REVEAL_RUBOCOP_TODO
functionality you added in !53162 (diffs)
In the RubyMine IDE, there's no way to selectively disable individual cops for the RuboCop plugin, which results in every single model
and lib
class having every line of the entire file underlined as an error.
This is not only hard to read, it masks all other warnings and errors within the class. Example:
Example of visual usability problems and masked warnings:

How to set up and validate locally
Open lib/gitlab/fips.rb
in RubyMine, see that the visual problems no longer exist.
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.
Merge request reports
Activity
changed milestone to %15.1
assigned to @cwoolley-gitlab
mentioned in commit 1b018d33
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
Suggested Reviewers (beta)
The individuals below may be good candidates to participate in the review based on various factors.
You can use slash commands in comments to quickly assign
/assign_reviewer @user1
.Suggested Reviewers @kerrizor
,@dbalexandre
,@reprazent
,@ifarkas
,@eread
If you do not believe these suggestions are useful, please apply the label Bad Suggested Reviewer. You can also provide feedback for this feature on this issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/357923
.Automatically generated by Suggested Reviewers Bot - an experimental ML-based recommendation engine created by ~"group::applied ml".
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Steve Abrams ( @sabrams
) (UTC-6, 1 hour ahead of@cwoolley-gitlab
)Alex Kalderimis ( @alexkalderimis
) (UTC-4, 3 hours ahead of@cwoolley-gitlab
)To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
Generated by
DangerEdited by Ghost User- Resolved by Peter Leitzen
@splattael I'd like you to review/discuss this MR related to the remaining unfixed
Gitlab/NamespacedClass
cop warnings and their interaction with theREVEAL_RUBOCOP_TODO
functionality you added in !53162 (diffs)In the RubyMine IDE, there's no way to selectively disable individual cops for the RuboCop plugin, which results in every single
model
andlib
class having every line of the entire file underlined as an error.This is not only hard to read, it masks all other warnings and errors within the class. Example:
And as you can see from that example (a new file added a few months ago), the current situation isn't preventing people from continuing to add new models which violate this rule.
I am definitely in favor of encouraging people to proactively fix these model errors, but in this case there's no easy way to eliminate these, even if I wanted to.
In addition to the large number of them, the nature of this cop means that it's not something you want to fix as part of an unrelated MR (or else I would fix them as I find them).
Adding a namespace to a model or lib file means updating any other dependencies which may refer to the class by name, and the possibility of introducing regressions if you miss anything.
Furthermore, even if you want to fix it, we don't have a disciplined approach to defining clear domain boundaries, so it's often unclear what namespace is appropriate to use (or create), even if you did want to take the time to fix it.
A search for
rubocop:disable GitLab/NamespacedClass
has several hits, which I believe indicates this confusion/reluctance.So, I would like to find some way to fix the problem of this cop making RubyMine lib/model classes hard to read and masking other errors.
Hence, this MR, which moves the the
Gitlab/NamespacedClass
exclusion TODOs outside of theREVEAL_RUBOCOP_TODO
unless
block.I know this is not an ideal situation, but it is the simplest way to solve this usability and productivity problem for all RubyMine users.
I'm happy to continue helping iterate on a better solution in follow-up MRs.
I don't know if we need a separate issue since we already have Fix remaining cop offenses for Gitlab/Namespace... (#321982). I think any further discussion can happen there. WDYT?
Thanks!
requested review from @splattael
mentioned in issue #321982
mentioned in merge request !53162 (merged)
added sectiondev label
- Resolved by Doug Stull
- Resolved by Chad Woolley
removed review request for @splattael
mentioned in commit ba8a1b9b
mentioned in commit b0f7f565