Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Build and test the RubyTree library.
#
# The matrix runs the suite against both the json gem 2.x and 3.x, selected
# through the Gemfile variants in the gemfiles/ directory.
#
# This runs as a Github Action.

name: Build and Test
Expand All @@ -8,11 +11,15 @@ permissions:
contents: read
jobs:
test:
name: Ruby ${{ matrix.ruby }} / json ${{ matrix.json }}
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
json: ["2", "3"]
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/json_${{ matrix.json }}.gemfile
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ tmp/
vendor/
.idea/
Gemfile.lock
gemfiles/*.lock
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Inherit from the working file.
inherit_from: .rubocop_todo.yml

# Load the rake and rspec extensions as plugins.
plugins:
- rubocop-rake
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.7
Expand Down
106 changes: 91 additions & 15 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,121 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-06-20 06:06:47 UTC using RuboCop version 1.24.0.
# on 2026-10-07 08:17:12 UTC using RuboCop version 1.91.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 47
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
# Offense count: 15
# Configuration parameters: EnforcedStyle, AllowedGems.
# SupportedStyles: Gemfile, gems.rb, gemspec
Gemspec/DevelopmentDependencies:
Exclude:
- 'rubytree.gemspec'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/LineContinuationLeadingSpace:
Exclude:
- 'lib/tree.rb'

# Offense count: 13
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, no_space
Layout/LineContinuationSpacing:
Exclude:
- 'lib/tree.rb'
- 'lib/tree/binarytree.rb'
- 'lib/tree/utils/hash_converter.rb'

# Offense count: 50
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 97

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 119
Max: 34

# Offense count: 3
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 1066
Max: 1109

# Offense count: 2
# Configuration parameters: IgnoredMethods.
# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 8
Max: 10

# Offense count: 47
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# Offense count: 51
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 45

# Offense count: 1
# Configuration parameters: IgnoredMethods.
# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 9
Max: 11

# Offense count: 1
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
# SupportedStyles: snake_case, camelCase
# ForbiddenIdentifiers: __id__, __send__
Naming/MethodName:
Exclude:
- 'test/test_tree.rb'

# Offense count: 4
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/tree_spec.rb'

# Offense count: 1
RSpec/LeakyLocalVariable:
Exclude:
- 'spec/tree_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/Output:
Exclude:
- 'spec/spec_helper.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/RedundantPredicateMatcher:
Exclude:
- 'spec/tree_spec.rb'

# Offense count: 5
Security/MarshalLoad:
Exclude:
- 'lib/tree.rb'
- 'spec/tree_spec.rb'
- 'test/test_tree.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/MapIntoArray:
Exclude:
- 'test/test_tree.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods.
# AllowedMethods: infinite?, nonzero?
Style/RedundantCondition:
Exclude:
- 'lib/tree.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/SuperArguments:
Exclude:
- 'lib/tree/binarytree.rb'
50 changes: 28 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ PATH
remote: .
specs:
rubytree (2.2.2)
json (~> 2.0, >= 2.21.2)
json (>= 2.21.2, < 4)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
ast (2.4.3)
awesome_bot (1.20.0)
parallel (= 1.20.1)
bundler-audit (0.9.3)
Expand All @@ -19,12 +19,13 @@ GEM
date (3.4.1)
diff-lcs (1.5.1)
docile (1.4.1)
json (2.21.2)
json (3.0.2)
kramdown (2.5.2)
rexml (>= 3.4.4)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
language_server-protocol (3.17.0.6)
lint_roller (1.1.0)
mdl (0.14.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
Expand All @@ -37,10 +38,11 @@ GEM
mixlib-shellout (3.3.8)
chef-utils
parallel (1.20.1)
parser (3.3.6.0)
parser (3.3.12.0)
ast (~> 2.4.1)
racc
power_assert (2.0.4)
prism (1.9.0)
psych (5.2.2)
date
stringio
Expand All @@ -49,7 +51,7 @@ GEM
rake (13.2.1)
rdoc (6.10.0)
psych (>= 4.0.0)
regexp_parser (2.9.3)
regexp_parser (2.13.1)
rexml (3.4.4)
rspec (3.13.0)
rspec-core (~> 3.13.0)
Expand All @@ -67,22 +69,27 @@ GEM
rtags (0.97)
rtagstask (0.0.4)
rtags (> 0.0.0)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
rubocop (1.91.0)
json (>= 2.3)
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 (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
rubocop-ast (1.50.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-rspec (3.10.2)
lint_roller (~> 1.1)
regexp_parser (>= 2.0)
rubocop (~> 1.86, >= 1.86.2)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -96,24 +103,23 @@ GEM
power_assert
thor (1.5.0)
tomlrb (2.0.4)
unicode-display_width (3.1.2)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (3.3.0)
unicode-emoji (~> 4.3)
unicode-emoji (4.3.0)
yard (0.9.44)

PLATFORMS
ruby

DEPENDENCIES
awesome_bot (~> 1.20)
bundler (~> 2.3)
bundler-audit (~> 0.9)
mdl (~> 0.14)
rake (~> 13.2)
rdoc (~> 6.10)
rspec (~> 3.0, >= 3.13)
rtagstask (~> 0.0.4)
rubocop (~> 1.69)
rubocop (~> 1.90)
rubocop-rake (~> 0.6)
rubocop-rspec (~> 3.3)
rubytree!
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ This example can also be found at

* Run-time Dependencies:

* [JSON][] for converting to/from the JSON format
* [JSON][] (2.x or 3.x) for converting to/from the JSON format


* Development dependencies (not required for installing the gem):
Expand Down
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ require 'rubocop/rake_task'

RuboCop::RakeTask.new(:rubocop) do |t|
t.options = ['--display-cop-names']
t.requires << 'rubocop-rake'
t.requires << 'rubocop-rspec'
end

# ................................ Gem metadata
Expand Down
8 changes: 8 additions & 0 deletions gemfiles/json_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# Variant of the main Gemfile which pins the json gem to its 2.x line. The
# test matrix selects it through the BUNDLE_GEMFILE environment variable.
eval_gemfile File.expand_path('../Gemfile', __dir__)

# JSON Implementation for Ruby
gem 'json', '~> 2.21'
8 changes: 8 additions & 0 deletions gemfiles/json_3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# Variant of the main Gemfile which pins the json gem to its 3.x line. The
# test matrix selects it through the BUNDLE_GEMFILE environment variable.
eval_gemfile File.expand_path('../Gemfile', __dir__)

# JSON Implementation for Ruby
gem 'json', '~> 3.0'
Loading
Loading