Skip to content

Commit 82456f7

Browse files
committed
Ignore auto-style of any code syncronized
from other places
1 parent 8a21007 commit 82456f7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bin/auto-style.rb

+8-5
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def with_clean_env
7272
mutex_m
7373
ostruct
7474
prime
75-
racc
7675
rdoc
7776
rexml
7877
rss
@@ -96,16 +95,17 @@ def with_clean_env
9695
json
9796
openssl
9897
psych
98+
racc
9999
sdbm
100100
stringio
101101
strscan
102102
zlib
103103
]
104104

105-
EXPANDTAB_IGNORED_FILES = [
105+
IGNORED_FILES = [
106106
# default gems whose master is GitHub
107107
%r{\Abin/(?!erb)\w+\z},
108-
*DEFAULT_GEM_LIBS.flat_map { |lib|
108+
*(DEFAULT_GEM_LIBS + DEFAULT_GEM_EXTS).flat_map { |lib|
109109
[
110110
%r{\Alib/#{lib}/},
111111
%r{\Alib/#{lib}\.gemspec\z},
@@ -152,7 +152,10 @@ def with_clean_env
152152
(/\A(?:config|[Mm]akefile|GNUmakefile|README)/ =~ File.basename(l) or
153153
/\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))
154154
}
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
156159
next if files.empty?
157160

158161
trailing = eofnewline = expandtab = false
@@ -164,7 +167,7 @@ def with_clean_env
164167

165168
expandtab0 = false
166169
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')
168171
# If and only if unedited lines did not have tab indentation, prevent introducing tab indentation to the file.
169172
expandtab_allowed = src.each_line.with_index.all? do |line, lineno|
170173
updated_lines.include?(lineno) || !line.start_with?("\t")

0 commit comments

Comments
 (0)