Skip to content

Commit

Permalink
Merge pull request #137 from openHPI/dependabot/bundler/rubocop-1.12.1
Browse files Browse the repository at this point in the history
Update rubocop requirement from ~> 0.77.0 to ~> 1.12.1
  • Loading branch information
kkoehn authored Apr 15, 2021
2 parents 7e39aa5 + 866b135 commit dc68000
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 32 deletions.
23 changes: 16 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,40 @@ require: rubocop-rspec

AllCops:
TargetRubyVersion: 2.6
NewCops: enable
Exclude:
- bin/*
- vendor/**/*
- Guardfile

Layout/LineLength:
Max: 140

Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

Lint/EmptyBlock:
Exclude:
- spec/**/*
- lib/proforma/services/exporter.rb

Metrics/ClassLength:
Max: 150

Metrics/LineLength:
Max: 140

Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- spec/**/*
- proforma.gemspec

RSpec/NestedGroups:
Max: 5

Style/Documentation:
Enabled: false

RSpec/NestedGroups:
Max: 5

RSpec/DescribeClass:
Exclude:
- spec/custom_matchers/*

RSpec/MultipleMemoizedHelpers:
Enabled: false
34 changes: 20 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GEM
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
ast (2.4.1)
ast (2.4.2)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.8)
Expand All @@ -44,7 +44,6 @@ GEM
rspec (>= 2.99.0, < 4.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.4)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand All @@ -59,8 +58,8 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parallel (1.19.2)
parser (2.7.1.4)
parallel (1.20.1)
parser (3.0.1.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
Expand All @@ -74,6 +73,8 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (2.1.1)
rexml (3.2.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
Expand All @@ -89,16 +90,21 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (0.77.0)
jaro_winkler (~> 1.5.1)
rubocop (1.12.1)
parallel (~> 1.10)
parser (>= 2.6)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rspec (1.41.0)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-rspec (2.2.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)
rubyzip (2.3.0)
shellany (0.0.1)
simplecov (0.21.2)
Expand All @@ -110,7 +116,7 @@ GEM
thor (1.0.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (1.6.1)
unicode-display_width (2.0.0)
zeitwerk (2.4.2)

PLATFORMS
Expand All @@ -127,8 +133,8 @@ DEPENDENCIES
rake (~> 13.0)
rspec (~> 3.0)
rspec-collection_matchers (~> 1.2.0)
rubocop (~> 0.77.0)
rubocop-rspec (~> 1.41.0)
rubocop (~> 1.12.1)
rubocop-rspec (~> 2.2.0)
simplecov (~> 0.21.2)

BUNDLED WITH
Expand Down
2 changes: 2 additions & 0 deletions lib/proforma/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module Proforma
class ProformaError < StandardError; end

class PostGenerateValidationError < ProformaError; end

class PreImportValidationError < ProformaError; end
end
2 changes: 1 addition & 1 deletion lib/proforma/helpers/export_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def add_test_configuration(xml, test)
if test.meta_data
xml.send('test-meta-data') do
# underscore is used to disambiguate tag names from ruby methods
test.meta_data.each { |key, value| xml['c'].send(key.to_s + '_', value) }
test.meta_data.each { |key, value| xml['c'].send("#{key}_", value) }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/proforma/helpers/import_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def any_data_tag(any_data_node)
{}.tap do |any_data|
return any_data if any_data_node.nil?

any_data_node.attributes.values.each { |attribute| any_data[attribute.name] = attribute.value }
any_data_node.attributes.each_value { |attribute| any_data[attribute.name] = attribute.value }
any_data_node.children.each { |any_data_tag| any_data[any_data_tag.name] = any_data_tag.children.first.text }
end
end
Expand Down
5 changes: 3 additions & 2 deletions lib/proforma/services/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ def add_model_solution(model_solution_node)
def add_file(file_node)
file_tag = file_node.children.first
file = nil
if /embedded-(bin|txt)-file/.match? file_tag.name
case file_tag.name
when /embedded-(bin|txt)-file/
file = TaskFile.new(embedded_file_attributes(file_node.attributes, file_tag))
elsif /attached-(bin|txt)-file/.match? file_tag.name
when /attached-(bin|txt)-file/
file = TaskFile.new(attached_file_attributes(file_node.attributes, file_tag))
end
@task.files << file
Expand Down
5 changes: 3 additions & 2 deletions proforma.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/openHPI/proforma'
spec.license = 'MIT'

spec.required_ruby_version = '~> 2.6'
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
# if spec.respond_to?(:metadata)
Expand Down Expand Up @@ -51,7 +52,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.2.0'
spec.add_development_dependency 'rubocop', '~> 0.77.0'
spec.add_development_dependency 'rubocop-rspec', '~> 1.41.0'
spec.add_development_dependency 'rubocop', '~> 1.12.1'
spec.add_development_dependency 'rubocop-rspec', '~> 2.2.0'
spec.add_development_dependency 'simplecov', '~> 0.21.2'
end
4 changes: 2 additions & 2 deletions spec/proforma/exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@
let(:version) { '2.0.1' }

it 'creates a file with the correct version' do
expect(doc.namespaces['xmlns']). to eql 'urn:proforma:v2.0.1'
expect(doc.namespaces['xmlns']).to eql 'urn:proforma:v2.0.1'
end
end

context 'when version is 2.0' do
let(:version) { '2.0' }

it 'creates a file with the correct version' do
expect(doc.namespaces['xmlns']). to eql 'urn:proforma:v2.0'
expect(doc.namespaces['xmlns']).to eql 'urn:proforma:v2.0'
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 @@ -9,7 +9,7 @@
require 'factory_bot'
require 'pry-byebug'

Dir['./spec/support/**/*.rb'].each { |f| require f }
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
# RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 999_999_999
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
Expand Down
2 changes: 1 addition & 1 deletion spec/support/expectations/equal_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def array_equal?(object, other)
end

def attributes(object)
Hash[object.instance_variables.map { |e| [e.slice(1, e.length - 1).to_sym, object.instance_variable_get(e)] }]
object.instance_variables.map { |e| [e.slice(1, e.length - 1).to_sym, object.instance_variable_get(e)] }.to_h
end
end
2 changes: 1 addition & 1 deletion spec/support/shared_examples/proforma/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

RSpec.shared_examples 'mass assignable' do |attributes|
let(:params) { Hash[attributes.map { |i| [i, i] }] }
let(:params) { attributes.map { |i| [i, i] }.to_h }

it 'supports mass-assignments' do
expect(described_class.new(params)).to have_attributes(params)
Expand Down

0 comments on commit dc68000

Please sign in to comment.