Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.3.0
ruby-4.0.3
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
FROM ruby:3.2.2-alpine3.18 AS build
FROM ruby:4.0.4-alpine3.23@sha256:ac9c68cd41d6a49a9138fca74aa344968e8ddb5e20d8a3b1f455b97c7148f8da AS build

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh && \
apk add build-base gcc wget git
apk add --no-cache git openssh build-base gcc wget git

COPY Gemfile Gemfile.lock .
COPY Gemfile Gemfile.lock ./

RUN gem install bundler:2.4.18 && \
RUN gem install bundler:4.0.11 && \
bundle config set without 'development test' && \
bundle install

FROM ruby:3.2.2-alpine3.18 AS runtime
FROM ruby:4.0.4-alpine3.23@sha256:ac9c68cd41d6a49a9138fca74aa344968e8ddb5e20d8a3b1f455b97c7148f8da AS runtime

RUN apk add --no-cache bash

WORKDIR /opt/analyzer

COPY --from=build /usr/local/bundle /usr/local/bundle

WORKDIR /opt/analyzer

COPY . .

ENTRYPOINT ["sh", "/opt/analyzer/bin/run.sh"]
19 changes: 11 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end

gem 'mandate'
gem 'rake'
gem 'json'
gem 'activesupport'
gem 'json'
gem 'mutex_m'
gem 'rake'

gem 'parser'
gem 'rubocop'
gem 'rubocop-minitest'
gem 'rubocop-performance'

group :test do
gem 'mandate'
gem 'minitest'
gem 'minitest-stub-const'
gem 'mocha'
gem 'pry'
gem 'sexp_processor'
gem 'simplecov', '~> 0.17.0'
gem 'rubocop'
gem 'rubocop-ast'
gem 'rubocop-minitest'
gem 'rubocop-performance'
end
93 changes: 58 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,75 +1,95 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.2.3.1)
activesupport (8.1.3)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1, < 6)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
ast (2.4.2)
uri (>= 0.13.1)
ast (2.4.3)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (4.0.1)
bigdecimal (4.1.2)
coderay (1.1.3)
concurrent-ruby (1.3.6)
connection_pool (3.0.2)
docile (1.4.0)
docile (1.4.1)
drb (2.2.3)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
io-console (0.8.2)
json (2.19.5)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
mandate (2.2.0)
minitest (5.24.1)
method_source (1.1.0)
minitest (6.0.6)
drb (~> 2.0)
prism (~> 1.5)
minitest-stub-const (0.6)
mocha (2.4.0)
mocha (3.1.0)
ruby2_keywords (>= 0.0.5)
parallel (1.25.1)
parser (3.3.3.0)
mutex_m (0.3.0)
parallel (2.1.0)
parser (3.3.11.1)
ast (~> 2.4.1)
racc
racc (1.8.0)
prism (1.9.0)
pry (0.16.0)
coderay (~> 1.1)
method_source (~> 1.0)
reline (>= 0.6.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.4.2)
rubocop (1.64.1)
rake (13.4.2)
regexp_parser (2.12.0)
reline (0.6.3)
io-console (~> 0.5)
rubocop (1.86.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-minitest (0.35.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.1)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-minitest (0.39.1)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-performance (1.26.1)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
securerandom (0.4.1)
sexp_processor (4.17.5)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
uri (1.1.1)

PLATFORMS
ruby
Expand All @@ -81,12 +101,15 @@ DEPENDENCIES
minitest
minitest-stub-const
mocha
parser
mutex_m
pry
rake
rubocop
rubocop-ast
rubocop-minitest
rubocop-performance
sexp_processor
simplecov (~> 0.17.0)

BUNDLED WITH
2.4.18
4.0.11
12 changes: 5 additions & 7 deletions bin/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ for test_dir in tests/*/*; do

bin/run.sh "${test_slug}" "${test_dir_path}" "${test_dir_path}"

# echo "${test_dir_name}: comparing analysis.json to expected_analysis.json"
# diff "${results_file_path}" "${expected_results_file_path}"

# if [ $? -ne 0 ]; then
# exit_code=1
# fi
echo "${test_dir_name}: comparing analysis.json to expected_analysis.json"
if ! diff "${results_file_path}" "${expected_results_file_path}"; then
exit_code=1
fi
done

exit ${exit_code}
exit "${exit_code}"
2 changes: 1 addition & 1 deletion lib/analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
require 'mandate'
require 'json'
require 'rubocop'
require 'parser/current'
require 'prism'
require 'active_support/inflector'

require_relative "generic/helpers"
Expand Down
7 changes: 1 addition & 6 deletions lib/analyzers/solution_representation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ def default_argument_value

def root_node
@root_node ||= begin
buffer = Parser::Source::Buffer.new(nil)
buffer.source = code_to_analyze
builder = RuboCop::AST::Builder.new
parser = Parser::CurrentRuby.new(builder)

parser.parse(buffer)
Prism::Translation::RubyParser.parse(code_to_analyze)
end
end
end
7 changes: 1 addition & 6 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
class Minitest::Test
def parse_ast(source)
@parse_ast ||= begin
buffer = Parser::Source::Buffer.new(nil)
buffer.source = source
builder = RuboCop::AST::Builder.new
parser = Parser::CurrentRuby.new(builder)

parser.parse(buffer)
Prism::Translation::RubyParser.parse(source)
end
end

Expand Down
Loading