Ignore inline rubocop disable/todos that have a comment on reasoning in danger
With the merging of !134385 (merged), we now have a documented way for accepted disabling of rubocop rules.
We can now add this logic to our danger rubocop suggestor to ignore the lines that have a proper comment format for the reasoning.
original description
The following discussion from !134385 (merged) should be addressed:
-
@dstull started a discussion: (+15 comments) Hmm, I think we have a good opportunity here for a few things
- Avoid the possibility of inline disable being removed and comment explaining being left in the code.
- Create a parsable solution to improve on the danger bot.
I suggest we add the comment on the same line of the inline disabling such as(as long as we find a way to make rubocop happy about more metadata on same line):
# rubocop:disable GitlabSecurity/PublicSend reason: This type is authorized in the parent entity. # rubocop:todo SomeOther/Cop issue: some_issue_link
I believe rubocop already ignores line length issues caused by disabling.
We could then modify the line here to ignore lines that already have a reason.
Could probably do this in the current MR. WDYT?