From cd8a276475e5b895e91ead0b4a06e9c136d65983 Mon Sep 17 00:00:00 2001 From: Joel Johnson Date: Fri, 7 Jan 2022 10:41:35 -0500 Subject: [PATCH] Use Rubocop's flag to skip excluded files This flag been around since 2014 and version 0.20.0, and it avoids running rubocop against files that are excluded in the .rubocop.yml configuration. - [1] https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md#new-features-102 --- pre_commit_hooks/run-rubocop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit_hooks/run-rubocop b/pre_commit_hooks/run-rubocop index 58f9a0f..3f036db 100644 --- a/pre_commit_hooks/run-rubocop +++ b/pre_commit_hooks/run-rubocop @@ -4,7 +4,7 @@ require 'English' # but pre-commit looks better if there is no output on success. args = ARGV.join(' ') puts args if ENV['DEBUG'] -output = `rubocop #{args} 2>&1` +output = `rubocop --force-exclusion #{args} 2>&1` status = $CHILD_STATUS.exitstatus puts output if status != 0 exit status