You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
danger-rubocop can be called with a list of files to be linted, otherwise it defaults to linting only files changed in the PR. I use an AllCops: Include: section in my .rubocop.yml to specify which files in the project should be linted.
If I pass a list of files to lint, this works fine. However, there is no way to tell it to lint all files in the project, even if they weren't changed in the PR.
The problem with this is when the .rubocop.yml changes — if a cop that was previously disabled is now enabled, or a RuboCop upgrade adds a new cop, then danger-rubocop will ignore any violations if the file containing the violation was not changed as part of the PR.
Would it be possible to have a lint_unchanged_files option (defaulting to off, for compatibility) that would simply just use whatever include/exclude behaviour is specified in the RuboCop config — the equivalent of just running rubocop with no file list?
At least in my case, the extra time taken on a CI run is negligible, and certainly less than the time taken to unearth and fix these offences when they finally come to light 😁
The text was updated successfully, but these errors were encountered:
Actually, it looks like passing files: '' will do the trick, as empty strings are truthy — that will glob to an empty array, causing rubocop to be called with no file list, which will then just pick up the files from .rubocop.yml, just like typing bundle exec rubocop does.
Is it worth mentioning this in the README, do you think?
Document the following cases:
* `files` option not specified (lint only changed files)
* `files` option is empty string (lint all files)
See ashfurrow#43.
danger-rubocop can be called with a list of files to be linted, otherwise it defaults to linting only files changed in the PR. I use an
AllCops: Include:
section in my.rubocop.yml
to specify which files in the project should be linted.If I pass a list of files to lint, this works fine. However, there is no way to tell it to lint all files in the project, even if they weren't changed in the PR.
Currently,
fetch_files_to_lint
does this:The problem with this is when the
.rubocop.yml
changes — if a cop that was previously disabled is now enabled, or a RuboCop upgrade adds a new cop, then danger-rubocop will ignore any violations if the file containing the violation was not changed as part of the PR.Would it be possible to have a
lint_unchanged_files
option (defaulting to off, for compatibility) that would simply just use whatever include/exclude behaviour is specified in the RuboCop config — the equivalent of just runningrubocop
with no file list?At least in my case, the extra time taken on a CI run is negligible, and certainly less than the time taken to unearth and fix these offences when they finally come to light 😁
The text was updated successfully, but these errors were encountered: