Skip to content

Commit

Permalink
Merge pull request #139 from xinminlabs/awesomecode-lint-ruby-style-n…
Browse files Browse the repository at this point in the history
…ext-48042

Auto corrected by following Lint Ruby Style/Next
  • Loading branch information
flyerhzm committed Jan 30, 2021
2 parents c5eff0f + 210b73c commit b4da926
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions lib/synvert/core/rewriter/instance.rb
Expand Up @@ -90,39 +90,38 @@ def process
Dir
.glob(file_pattern)
.each do |file_path|
unless Configuration.instance.get(:skip_files).include? file_path
begin
conflict_actions = []
source = +self.class.file_source(file_path)
ast = self.class.file_ast(file_path)

@current_file = file_path

process_with_node ast do
begin
instance_eval &@block
rescue NoMethodError
puts @current_node.debug_info
raise
end
next if Configuration.instance.get(:skip_files).include? file_path
begin
conflict_actions = []
source = +self.class.file_source(file_path)
ast = self.class.file_ast(file_path)

@current_file = file_path

process_with_node ast do
begin
instance_eval &@block
rescue NoMethodError
puts @current_node.debug_info
raise
end

if @actions.length > 0
@actions.sort_by! { |action| action.send(@options[:sort_by]) }
conflict_actions = get_conflict_actions
@actions.reverse_each do |action|
source[action.begin_pos...action.end_pos] = action.rewritten_code
source = remove_code_or_whole_line(source, action.line)
end
@actions = []

self.class.write_file(file_path, source)
end

if @actions.length > 0
@actions.sort_by! { |action| action.send(@options[:sort_by]) }
conflict_actions = get_conflict_actions
@actions.reverse_each do |action|
source[action.begin_pos...action.end_pos] = action.rewritten_code
source = remove_code_or_whole_line(source, action.line)
end
rescue Parser::SyntaxError
puts "[Warn] file #{file_path} was not parsed correctly."
# do nothing, iterate next file
end while !conflict_actions.empty?
end
@actions = []

self.class.write_file(file_path, source)
end
rescue Parser::SyntaxError
puts "[Warn] file #{file_path} was not parsed correctly."
# do nothing, iterate next file
end while !conflict_actions.empty?
end
end

Expand Down

0 comments on commit b4da926

Please sign in to comment.