@@ -72,7 +72,6 @@ def with_clean_env
72
72
mutex_m
73
73
ostruct
74
74
prime
75
- racc
76
75
rdoc
77
76
rexml
78
77
rss
@@ -96,16 +95,17 @@ def with_clean_env
96
95
json
97
96
openssl
98
97
psych
98
+ racc
99
99
sdbm
100
100
stringio
101
101
strscan
102
102
zlib
103
103
]
104
104
105
- EXPANDTAB_IGNORED_FILES = [
105
+ IGNORED_FILES = [
106
106
# default gems whose master is GitHub
107
107
%r{\A bin/(?!erb)\w +\z } ,
108
- *DEFAULT_GEM_LIBS . flat_map { |lib |
108
+ *( DEFAULT_GEM_LIBS + DEFAULT_GEM_EXTS ) . flat_map { |lib |
109
109
[
110
110
%r{\A lib/#{ lib } /} ,
111
111
%r{\A lib/#{ lib } \. gemspec\z } ,
@@ -152,7 +152,10 @@ def with_clean_env
152
152
( /\A (?:config|[Mm]akefile|GNUmakefile|README)/ =~ File . basename ( l ) or
153
153
/\A \z |\. (?:[chsy]|\d +|e?rb|tmpl|bas[eh]|z?sh|in|ma?k|def|src|trans|rdoc|ja|en|el|sed|awk|p[ly]|scm|mspec|html|)\z / =~ File . extname ( l ) )
154
154
}
155
- files = paths . select { |n | File . file? ( n ) }
155
+ files = paths . select { |n | File . file? ( n ) }
156
+ files . reject! do |f |
157
+ IGNORED_FILES . any? { |re | f . match ( re ) }
158
+ end
156
159
next if files . empty?
157
160
158
161
trailing = eofnewline = expandtab = false
@@ -164,7 +167,7 @@ def with_clean_env
164
167
165
168
expandtab0 = false
166
169
updated_lines = vcs . updated_lines ( f )
167
- if !updated_lines . empty? && ( f . end_with? ( '.c' ) || f . end_with? ( '.h' ) || f == 'insns.def' ) && EXPANDTAB_IGNORED_FILES . all? { | re | ! f . match ( re ) }
170
+ if !updated_lines . empty? && ( f . end_with? ( '.c' ) || f . end_with? ( '.h' ) || f == 'insns.def' )
168
171
# If and only if unedited lines did not have tab indentation, prevent introducing tab indentation to the file.
169
172
expandtab_allowed = src . each_line . with_index . all? do |line , lineno |
170
173
updated_lines . include? ( lineno ) || !line . start_with? ( "\t " )
0 commit comments