diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2c9e6b..7fc9dbc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,17 @@ on: pull_request: jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - run: bundle exec rubocop test: runs-on: ubuntu-latest strategy: @@ -19,11 +30,10 @@ jobs: - '3.3' steps: - name: Checkout - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4 - name: Setup Ruby - uses: ruby/setup-ruby@v1.177.1 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - run: bundle exec rubocop - run: bundle exec rspec diff --git a/Gemfile.lock b/Gemfile.lock index 4693206..a22f867 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,8 +23,6 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) - byebug (11.0.1) - coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) concurrent-ruby (1.1.10) @@ -35,57 +33,22 @@ GEM era_ja (1.1.0) factory_bot (6.2.1) activesupport (>= 5.0.0) - ffi (1.15.5) - formatador (1.1.0) - guard (2.18.0) - formatador (>= 0.2.4) - listen (>= 2.7, < 4.0) - lumberjack (>= 1.0.12, < 2.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.13.0) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-bundler (0.1.2) - guard (>= 0.2.2) - guard-compat (1.2.1) - guard-rspec (4.7.3) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) - guard-rubocop (1.5.0) - guard (~> 2.0) - rubocop (< 2.0) i18n (1.12.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - listen (3.7.1) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) - lumberjack (1.2.8) - method_source (1.0.0) + json (2.7.2) + language_server-protocol (3.17.0.3) minitest (5.17.0) - nenv (0.3.0) - notiffany (0.1.3) - nenv (~> 0.1) - shellany (~> 0.0) - parallel (1.22.1) - parser (3.1.2.0) + parallel (1.25.1) + parser (3.3.3.0) ast (~> 2.4.1) - pry (0.14.1) - coderay (~> 1.1) - method_source (~> 1.0) - pry-byebug (3.7.0) - byebug (~> 11.0) - pry (~> 0.10) + racc + racc (1.8.0) rainbow (3.1.1) rake (13.0.1) - rb-fsevent (0.11.1) - rb-inotify (0.10.1) - ffi (~> 1.0) - regexp_parser (2.3.1) - rexml (3.2.8) - strscan (>= 3.0.9) + regexp_parser (2.9.2) + rexml (3.3.1) + strscan rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -99,26 +62,26 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.0) - rubocop (1.29.0) + rubocop (1.64.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + 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.17.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.17.0) - parser (>= 3.1.1.0) - ruby-progressbar (1.11.0) - shellany (0.0.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) + ruby-progressbar (1.13.0) strscan (3.1.0) - thor (1.2.1) thread_safe (0.3.6) timeliness (0.4.3) tzinfo (2.0.5) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) + unicode-display_width (2.5.0) validates_timeliness (4.1.1) timeliness (>= 0.3.10, < 1) virtus (1.0.5) @@ -133,15 +96,10 @@ PLATFORMS DEPENDENCIES bundler (>= 2.2.13) factory_bot - guard - guard-bundler - guard-rspec - guard-rubocop kirico! - pry - pry-byebug rake (~> 13.0) rspec + rubocop BUNDLED WITH 2.3.8 diff --git a/Guardfile b/Guardfile deleted file mode 100644 index 9938d71..0000000 --- a/Guardfile +++ /dev/null @@ -1,15 +0,0 @@ -guard :rspec, cmd: 'bundle exec rspec', failed_mode: :focus do - watch(%r{^spec/.+_spec\.rb$}) - watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } - watch(%r{^spec/factories/(.+)\.rb$}) { |m| "spec/kirico/models/#{m[1]}_spec.rb" } - watch('spec/spec_helper.rb') { 'spec' } -end - -guard :bundler do - watch('Gemfile') - watch(/^.+\.gemspec/) -end - -guard :rubocop, all_on_start: true, cli: ['-D', '--format', 'clang'] do - watch(/.+\.rb$/) -end diff --git a/kirico.gemspec b/kirico.gemspec index 7413554..b55ef77 100644 --- a/kirico.gemspec +++ b/kirico.gemspec @@ -36,12 +36,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.2.13' spec.add_development_dependency 'factory_bot' - spec.add_development_dependency 'guard' - spec.add_development_dependency 'guard-bundler' - spec.add_development_dependency 'guard-rspec' - spec.add_development_dependency 'guard-rubocop' - spec.add_development_dependency 'pry' - spec.add_development_dependency 'pry-byebug' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec' + spec.add_development_dependency 'rubocop' end diff --git a/lib/kirico/validators/sjis_bytesize_validator.rb b/lib/kirico/validators/sjis_bytesize_validator.rb index d3e8b44..20c3adc 100644 --- a/lib/kirico/validators/sjis_bytesize_validator.rb +++ b/lib/kirico/validators/sjis_bytesize_validator.rb @@ -18,7 +18,7 @@ class SjisBytesizeValidator < ActiveModel::EachValidator RESERVED_OPTIONS = %i[minimum maximum within is too_short too_long] def initialize(options) - range = (options.delete(:in) || options.delete(:within)) + range = options.delete(:in) || options.delete(:within) if range raise ArgumentError, ':in and :within must be a Range' unless range.is_a?(Range) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8469d63..70bfa74 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,6 @@ $LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'kirico' -require 'pry' require 'csv' require 'factory_bot'