diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ad19a7fd2..3e90e131c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,73 +6,13 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines. -Layout/EmptyLineBetweenDefs: - Exclude: - - 'app/jobs/bulkrax/import_file_set_job.rb' - - 'app/models/bulkrax/entry.rb' - -# Offense count: 2 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, no_empty_lines -Layout/EmptyLinesAroundBlockBody: - Exclude: - - 'spec/rails_helper.rb' - -# Offense count: 3 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. -# SupportedHashRocketStyles: key, separator, table -# SupportedColonStyles: key, separator, table -# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit -Layout/HashAlignment: - Exclude: - - 'app/parsers/bulkrax/csv_parser.rb' - - 'spec/models/bulkrax/rdf_entry_spec.rb' - - 'spec/models/bulkrax/xml_entry_spec.rb' - -# Offense count: 1 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: Width, AllowedPatterns, IgnoredPatterns. -Layout/IndentationWidth: - Exclude: - - 'spec/rails_helper.rb' - -# Offense count: 8 +# Offense count: 5 # This cop supports safe auto-correction (--auto-correct). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: Max: 301 -# Offense count: 1 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: symmetrical, new_line, same_line -Layout/MultilineMethodCallBraceLayout: - Exclude: - - 'app/parsers/bulkrax/csv_parser.rb' - -# Offense count: 1 -# This cop supports safe auto-correction (--auto-correct). -Layout/RescueEnsureAlignment: - Exclude: - - 'spec/rails_helper.rb' - -# Offense count: 7 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: AllowInHeredoc. -Layout/TrailingWhitespace: - Exclude: - - 'app/models/bulkrax/csv_entry.rb' - - 'app/parsers/bulkrax/csv_parser.rb' - - 'spec/models/bulkrax/rdf_entry_spec.rb' - - 'spec/models/bulkrax/xml_entry_spec.rb' - - 'spec/rails_helper.rb' - # Offense count: 16 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: @@ -81,14 +21,14 @@ Metrics/AbcSize: # Offense count: 4 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 201 + Max: 140 -# Offense count: 13 +# Offense count: 12 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 19 -# Offense count: 32 +# Offense count: 28 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 26 @@ -96,9 +36,9 @@ Metrics/MethodLength: # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 131 + Max: 130 -# Offense count: 9 +# Offense count: 10 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 19 @@ -110,30 +50,8 @@ Rails/HasManyOrHasOneDependent: Exclude: - 'app/models/concerns/bulkrax/status_info.rb' -# Offense count: 2 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: Keywords, RequireColon. -# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE -Style/CommentAnnotation: - Exclude: - - 'app/models/bulkrax/xml_entry.rb' - - 'spec/models/bulkrax/oai_entry_spec.rb' - -# Offense count: 2 -# This cop supports safe auto-correction (--auto-correct). -Style/IfUnlessModifier: - Exclude: - - 'app/models/bulkrax/csv_entry.rb' - - 'lib/generators/bulkrax/templates/config/initializers/bulkrax.rb' - # Offense count: 1 -# This cop supports safe auto-correction (--auto-correct). -Style/MultilineIfModifier: +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: Exclude: - 'app/models/bulkrax/csv_entry.rb' - -# Offense count: 1 -# This cop supports safe auto-correction (--auto-correct). -Style/RedundantBegin: - Exclude: - - 'spec/rails_helper.rb' diff --git a/app/models/bulkrax/csv_entry.rb b/app/models/bulkrax/csv_entry.rb index aaa0bc24b..a106a74bf 100644 --- a/app/models/bulkrax/csv_entry.rb +++ b/app/models/bulkrax/csv_entry.rb @@ -88,8 +88,10 @@ def build_metadata def validate_record raise StandardError, 'Record not found' if record.nil? - raise StandardError, "Missing required elements, missing element(s) are: "\ -"#{importerexporter.parser.missing_elements(record).join(', ')}" unless importerexporter.parser.required_elements?(record) + unless importerexporter.parser.required_elements?(record) + raise StandardError, "Missing required elements, missing element(s) are: "\ +"#{importerexporter.parser.missing_elements(record).join(', ')}" + end end def add_identifier diff --git a/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb b/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb index f1dd4a87f..36dfcbfc6 100644 --- a/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +++ b/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb @@ -80,6 +80,7 @@ end # Sidebar for hyrax 3+ support +# rubocop:disable Style/IfUnlessModifier if Object.const_defined?(:Hyrax) && ::Hyrax::DashboardController&.respond_to?(:sidebar_partials) Hyrax::DashboardController.sidebar_partials[:repository_content] << "hyrax/dashboard/sidebar/bulkrax_sidebar_additions" end