Skip to content

Commit

Permalink
More rubocop cleanup, and move dev dependencies from the gemspec to t…
Browse files Browse the repository at this point in the history
…he Gemfile
  • Loading branch information
arcwhite committed Jul 25, 2024
1 parent dfa222e commit 4892ffb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
5 changes: 2 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ Style/Documentation:
Style/FrozenStringLiteralComment:
Enabled: false

Metrics/LineLength:
Layout/LineLength:
Max: 120
IgnoreCopDirectives: true

Metrics/BlockLength:
ExcludedMethods:
AllowedMethods:
- configure
- context
- define
Expand Down
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in bmt-ruby.gemspec
gemspec

group :development do
gem 'bundler', require: false
gem 'pry', require: false
gem 'rake', require: false
gem 'rspec', require: false
gem 'rubocop', require: false
gem 'rubocop-performance', require: false
end
6 changes: 0 additions & 6 deletions bmt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 3.1'

spec.add_development_dependency 'bundler', '~> 2.1'
spec.add_development_dependency 'pry', '~> 0.11'
spec.add_development_dependency 'rake', '~> 12.3'
spec.add_development_dependency 'rspec', '~> 3.6'
spec.add_development_dependency 'rubocop', '1.65'

spec.metadata = {
'homepage_uri' => 'https://github.com/bugcrowd/bmt-ruby',
'changelog_uri' => 'https://github.com/bugcrowd/bmt-ruby/blob/main/CHANGELOG.md',
Expand Down
4 changes: 2 additions & 2 deletions lib/bmt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def methodology_keys(version: current_version)
DATA_DIR.join(version, 'methodologies').entries
.map(&:basename)
.map(&:to_s)
.select { |dirname| dirname =~ /json/ }
.grep(/json/)
.map { |filepath| File.basename(filepath, File.extname(filepath)) }
end

Expand All @@ -67,6 +67,6 @@ def json_dir_names
DATA_DIR.entries
.map(&:basename)
.map(&:to_s)
.select { |dirname| dirname =~ /^[0-9]+\.[0-9]/ }.sort
.grep(/^[0-9]+\.[0-9]/).sort
end
end
4 changes: 2 additions & 2 deletions spec/bmt/step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
end

context 'with an executive_summary step type' do
let(:attributes) { methodology_json.dig('content', 'steps', 2) }

subject do
described_class.new(
methodology:,
attributes:
)
end

let(:attributes) { methodology_json.dig('content', 'steps', 2) }

it 'returns the correct type' do
expect(subject.type).to eq 'executive_summary'
end
Expand Down
8 changes: 4 additions & 4 deletions spec/bmt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
subject { described_class.versions }

it 'return all of the versions in the filesystem in reverse semver order' do
is_expected.to eq(['2.1', '1.0'])
expect(subject).to eq(['2.1', '1.0'])
end
end

describe '#current_version' do
subject { described_class.current_version }

it 'return the most recent version number for the vrt' do
is_expected.to eq('2.1')
expect(subject).to eq('2.1')
end
end

Expand All @@ -22,15 +22,15 @@
subject { described_class.methodology_keys }

it 'returns methodologies for the latest version' do
is_expected.to match_array(%w[website-testing outback-animal-testing])
expect(subject).to match_array(%w[website-testing outback-animal-testing])
end
end

context 'with custom version' do
subject { described_class.methodology_keys(version: '1.0') }

it 'returns methodologies for the specified version' do
is_expected.to match_array(['website-testing'])
expect(subject).to match_array(['website-testing'])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
c.syntax = :expect
end

config.before(:each) do
config.before do
# The following adds a new, test-only BMT versions
stub_const('BMT::DATA_DIR', Pathname.new('spec/sample'))
end
Expand Down

0 comments on commit 4892ffb

Please sign in to comment.