mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Fix up tool/auto-style.rb
Do not clear the commit-wide flags per file.
This commit is contained in:
parent
8faa32327b
commit
c99cb62da8
1 changed files with 4 additions and 5 deletions
|
@ -233,11 +233,10 @@ edited_files = files.select do |f|
|
|||
|
||||
if File.fnmatch?("*.[ch]", f, File::FNM_PATHNAME) &&
|
||||
!DIFFERENT_STYLE_FILES.any? {|pat| File.fnmatch?(pat, f, File::FNM_PATHNAME)}
|
||||
orig = src.dup
|
||||
src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n")
|
||||
src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1')
|
||||
src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '')
|
||||
indent = indent0 = src != orig
|
||||
indent0 = true if src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n")
|
||||
indent0 = true if src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1')
|
||||
indent0 = true if src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '')
|
||||
indent ||= indent0
|
||||
end
|
||||
|
||||
if trailing0 or eofnewline0 or expandtab0 or indent0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue