From b5c73962becee7085199b3be737a439017de8800 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Wed, 11 Sep 2024 08:09:30 +0800 Subject: [PATCH] chore: rubocop --- .rubocop_todo.yml | 46 ++++++++++++++++++++--- Gemfile | 6 ++- lib/modspec/conformance_class.rb | 4 +- lib/modspec/normative_statements_class.rb | 4 +- modspec.gemspec | 7 +--- 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9292794..3f57934 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,19 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-08-16 10:48:03 UTC using RuboCop version 1.65.1. +# on 2024-09-11 00:07:51 UTC using RuboCop version 1.66.1. # 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: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemfile, **/Gemfile, **/gems.rb +Bundler/OrderedGems: + Exclude: + - 'Gemfile' + # Offense count: 1 # Configuration parameters: Severity, Include. # Include: **/*.gemspec @@ -13,7 +21,16 @@ Gemspec/RequiredRubyVersion: Exclude: - 'modspec.gemspec' -# Offense count: 5 +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Layout/MultilineMethodCallIndentation: + Exclude: + - 'modspec.gemspec' + - 'spec/modspec/suite_spec.rb' + +# Offense count: 4 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 33 @@ -27,14 +44,14 @@ Metrics/BlockLength: # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 207 + Max: 204 # Offense count: 1 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 12 -# Offense count: 6 +# Offense count: 5 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 18 @@ -74,7 +91,26 @@ Style/IfUnlessModifier: - 'lib/modspec/conformance_class.rb' - 'lib/modspec/normative_statements_class.rb' -# Offense count: 12 +# Offense count: 27 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'spec/modspec/conformance_class_spec.rb' + - 'spec/modspec/conformance_test_spec.rb' + - 'spec/modspec/normative_statement_spec.rb' + - 'spec/modspec/normative_statements_class_spec.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'spec/modspec/conformance_class_spec.rb' + +# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/Gemfile b/Gemfile index 2d258d2..6881141 100644 --- a/Gemfile +++ b/Gemfile @@ -5,5 +5,7 @@ source "https://rubygems.org" # Specify your gem's dependencies in modspec.gemspec gemspec -gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" +gem "equivalent-xml" +gem "pry" +gem "rake" +gem "rspec" diff --git a/lib/modspec/conformance_class.rb b/lib/modspec/conformance_class.rb index 379fd00..b2a9bc6 100644 --- a/lib/modspec/conformance_class.rb +++ b/lib/modspec/conformance_class.rb @@ -53,9 +53,7 @@ def validate_identifier_prefix errors = [] expected_prefix = "#{identifier}/" tests.each do |test| - unless test.identifier.to_s.start_with?(expected_prefix) - errors << "Conformance test #{test.identifier} does not share the expected prefix #{expected_prefix}" - end + errors << "Conformance test #{test.identifier} does not share the expected prefix #{expected_prefix}" unless test.identifier.to_s.start_with?(expected_prefix) end errors end diff --git a/lib/modspec/normative_statements_class.rb b/lib/modspec/normative_statements_class.rb index 3638d95..821df44 100644 --- a/lib/modspec/normative_statements_class.rb +++ b/lib/modspec/normative_statements_class.rb @@ -45,9 +45,7 @@ def validate_identifier_prefix errors = [] expected_prefix = "#{identifier}/" normative_statements.each do |statement| - unless statement.identifier.to_s.start_with?(expected_prefix) - errors << "Normative statement #{statement.identifier} does not share the expected prefix #{expected_prefix}" - end + errors << "Normative statement #{statement.identifier} does not share the expected prefix #{expected_prefix}" unless statement.identifier.to_s.start_with?(expected_prefix) end errors end diff --git a/modspec.gemspec b/modspec.gemspec index 68b3661..a01083b 100644 --- a/modspec.gemspec +++ b/modspec.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| # Specify which files should be added to the gem when it is released. spec.files = all_files_in_git - .reject { |f| f.match(%r{\A(?:test|spec|features|bin|\.)/}) } + .reject { |f| f.match(%r{\A(?:test|features|bin|\.)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } @@ -32,9 +32,4 @@ Gem::Specification.new do |spec| spec.add_dependency "lutaml-model", "~> 0.3.10" spec.add_dependency "nokogiri" spec.add_dependency "toml-rb" - - spec.add_development_dependency "equivalent-xml", "~> 0.6" - spec.add_development_dependency "pry", "~> 0.14.0" - spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rspec", "~> 3.10" end