From 77540ed561c2c8d9d2b2655fca1b45d450f8e36e Mon Sep 17 00:00:00 2001 From: Mark Haylock Date: Fri, 22 Apr 2016 13:36:30 +1200 Subject: [PATCH] Ensure global exclusions are honored Rubocop by default ignores global exclusions if the file path is explicitly provided, this is not the behaviour we want for editor linting. Passing in `--force-exclusion` gives us the behaviour we want. --- linter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linter.py b/linter.py index 4d6b49b..1684c4c 100644 --- a/linter.py +++ b/linter.py @@ -65,8 +65,11 @@ def cmd(self): # With this path we can instead pass the file contents in via STDIN # and then tell rubocop to use this path (to search for config # files and to use for matching against configured paths - i.e. for - # inheritance, inclusions and exclusions): - command += ['--stdin', path] + # inheritance, inclusions and exclusions). + # + # The 'force-exclusion' overrides rubocop's behavior of ignoring + # global excludes when the file path is explicitly provided: + command += ['--force-exclusion', '--stdin', path] # Ensure the files contents are passed in via STDIN: self.tempfile_suffix = None