Skip to content

Commit

Permalink
Simplify DescribePublicMethod file parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromedalbert committed Nov 27, 2024
1 parent 3a51e19 commit 06ba212
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/rubocop/cop/obsession/rspec/describe_public_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,7 @@ def tested_file_path
end

def parse_file(file_path)
parser_class = ::Parser.const_get(:"Ruby#{target_ruby_version.to_s.sub('.', '')}")
parser = parser_class.new(RuboCop::AST::Builder.new)

buffer = Parser::Source::Buffer.new(file_path, 1)
buffer.source = File.read(file_path)

parser.parse(buffer)
parse(File.read(file_path)).ast
end

def find_private_methods(class_node)
Expand Down

0 comments on commit 06ba212

Please sign in to comment.