diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 91e33b14c..e8d07f014 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,21 +1,185 @@ # This configuration was generated by -# `rubocop --auto-gen-config --no-offense-counts` -# on 2019-12-16 21:01:58 +1300 using RuboCop version 0.77.0. +# `rubocop --auto-gen-config` +# on 2022-11-06 05:37:38 UTC using RuboCop version 1.38.0. # 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. -Lint/AmbiguousOperator: +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: Exclude: - - 'spec/controllers/crops_controller_spec.rb' + - 'db/migrate/20171129041341_create_photographings.rb' + - 'db/migrate/20190130090437_add_crop_to_photographings.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: space, no_space +Layout/LineContinuationSpacing: + Exclude: + - 'app/mailers/notifier_mailer.rb' + - 'app/models/seed.rb' + - 'lib/tasks/growstuff.rake' + - 'spec/features/rss/plantings_spec.rb' + - 'spec/features/rss/posts_spec.rb' + - 'spec/features/rss/seeds_spec.rb' + - 'spec/models/seed_spec.rb' + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Exclude: + - 'app/mailers/notifier_mailer.rb' + - 'app/models/seed.rb' + - 'lib/tasks/growstuff.rake' + - 'spec/features/rss/plantings_spec.rb' + - 'spec/features/rss/posts_spec.rb' + - 'spec/features/rss/seeds_spec.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 304 + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'db/seeds.rb' + - 'spec/helpers/gardens_helper_spec.rb' + - 'spec/helpers/seeds_helper_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: RequireParenthesesForMethodChains. +Lint/AmbiguousRange: + Exclude: + - 'app/models/concerns/search_harvests.rb' + - 'app/models/concerns/search_plantings.rb' + +# Offense count: 2 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'app/models/harvest.rb' + - 'lib/actions/oauth_signup_action.rb' + +# Offense count: 8 +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Exclude: + - 'db/migrate/20171022032108_all_the_predictions.rb' + - 'spec/controllers/home_controller_spec.rb' + - 'spec/controllers/likes_controller_spec.rb' + - 'spec/controllers/plant_parts_controller_spec.rb' + - 'spec/factories/crop_companions.rb' + - 'spec/features/crops/crop_detail_page_spec.rb' + - 'spec/requests/authentications_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/RedundantDirGlobSort: + Exclude: + - 'spec/rails_helper.rb' + +# Offense count: 1 +# Configuration parameters: AllowComments, AllowNil. +Lint/SuppressedException: + Exclude: + - 'lib/tasks/testing.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: strict, consistent +Lint/SymbolConversion: + Exclude: + - 'app/controllers/likes_controller.rb' + +# Offense count: 7 +Lint/UselessAssignment: + Exclude: + - 'config.rb' + - 'config/compass.rb' + +# Offense count: 43 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 151 + +# Offense count: 10 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +# AllowedMethods: refine +Metrics/BlockLength: + Max: 61 + +# Offense count: 6 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ClassLength: + Max: 171 + +# Offense count: 4 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 32 + +# Offense count: 59 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +Metrics/MethodLength: + Max: 59 + +# Offense count: 3 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +Metrics/PerceivedComplexity: + Max: 32 + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: lowercase, uppercase Naming/HeredocDelimiterCase: Exclude: - 'config/environments/production.rb' +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/ActionControllerFlashBeforeRender: + Exclude: + - 'app/controllers/authentications_controller.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: ExpectedOrder, Include. +# ExpectedOrder: index, show, new, edit, create, update, destroy +# Include: app/controllers/**/*.rb +Rails/ActionOrder: + Exclude: + - 'app/controllers/admin/members_controller.rb' + - 'app/controllers/follows_controller.rb' + - 'app/controllers/photos_controller.rb' + +# Offense count: 26 +# Configuration parameters: Database, Include. +# SupportedDatabases: mysql, postgresql +# Include: db/migrate/*.rb +Rails/BulkChangeTable: + Enabled: false + +# Offense count: 11 # Configuration parameters: Include. # Include: db/migrate/*.rb Rails/CreateTableWithTimestamps: @@ -30,12 +194,20 @@ Rails/CreateTableWithTimestamps: - 'db/migrate/20161201154922_add_photos_seeds_table.rb' - 'db/migrate/20171022032108_all_the_predictions.rb' -# Configuration parameters: EnforcedStyle. +# Offense count: 1 +# Configuration parameters: EnforcedStyle, AllowToTime. # SupportedStyles: strict, flexible Rails/Date: Exclude: - - 'app/mailers/notifier.rb' + - 'app/mailers/notifier_mailer.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Rails/EagerEvaluationLogMessage: + Exclude: + - 'app/services/openfarm_service.rb' + +# Offense count: 5 # Configuration parameters: EnforcedStyle. # SupportedStyles: slashes, arguments Rails/FilePath: @@ -45,6 +217,7 @@ Rails/FilePath: - 'config/environments/development.rb' - 'db/seeds.rb' +# Offense count: 2 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasAndBelongsToMany: @@ -52,23 +225,39 @@ Rails/HasAndBelongsToMany: - 'app/models/member.rb' - 'app/models/role.rb' +# Offense count: 5 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasManyOrHasOneDependent: Exclude: - 'app/models/member.rb' +# Offense count: 1 # Configuration parameters: Include. -# Include: app/models/**/*.rb -Rails/InverseOf: +# Include: spec/**/*.rb, test/**/*.rb +Rails/I18nLocaleAssignment: Exclude: - - 'app/models/concerns/ownable.rb' + - 'spec/features/locale_spec.rb' +# Offense count: 33 +Rails/I18nLocaleTexts: + Enabled: false + +# Offense count: 2 +# Configuration parameters: Include. +# Include: app/controllers/**/*.rb, app/mailers/**/*.rb +Rails/LexicallyScopedActionFilter: + Exclude: + - 'app/controllers/data_controller.rb' + +# Offense count: 2 Rails/OutputSafety: Exclude: - 'app/helpers/auto_suggest_helper.rb' - 'app/helpers/gardens_helper.rb' +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. # Include: **/Rakefile, **/*.rake Rails/RakeEnvironment: @@ -77,27 +266,53 @@ Rails/RakeEnvironment: - 'lib/tasks/i18n.rake' - 'lib/tasks/testing.rake' +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/RedundantPresenceValidationOnBelongsTo: + Exclude: + - 'app/models/alternate_name.rb' + - 'app/models/like.rb' + - 'app/models/planting.rb' + - 'app/models/scientific_name.rb' + +# Offense count: 9 # Configuration parameters: Include. -# Include: db/migrate/*.rb +# Include: db/**/*.rb Rails/ReversibleMigration: Exclude: + - 'db/migrate/20130326092227_change_planted_at_to_date.rb' - 'db/migrate/20191119020643_upgrade_cms.rb' -# Configuration parameters: Blacklist, Whitelist. -# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters -Rails/SkipsModelValidations: +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/RootPathnameMethods: Exclude: - - 'db/migrate/20190317023129_finished_boolean.rb' - - 'db/seeds.rb' - - 'db/migrate/20190910022329_add_photo_source.rb' + - 'app/controllers/crops_controller.rb' + - 'app/helpers/icons_helper.rb' -# Configuration parameters: AllowedChars. -Style/AsciiComments: +# Offense count: 6 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/UniqueValidationWithoutIndex: Exclude: - - 'config/initializers/comfortable_mexican_sofa.rb' + - 'app/models/follow.rb' + - 'app/models/garden.rb' + - 'app/models/like.rb' + - 'app/models/member.rb' + - 'app/models/plant_part.rb' + - 'app/models/role.rb' -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle. +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/WhereEquals: + Exclude: + - 'app/models/crop.rb' + - 'app/models/harvest.rb' + - 'app/models/planting.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. # SupportedStyles: nested, compact Style/ClassAndModuleChildren: Exclude: @@ -105,23 +320,163 @@ Style/ClassAndModuleChildren: - 'lib/haml/filters/escaped_markdown.rb' - 'lib/haml/filters/growstuff_markdown.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Keywords, RequireColon. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'app/models/ability.rb' + - 'spec/views/seeds/show.html.haml_spec.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). Style/CommentedKeyword: Exclude: + - 'db/migrate/20191119030244_cms_tags.rb' - 'spec/models/crop_spec.rb' - 'spec/models/photo_spec.rb' - 'spec/models/planting_spec.rb' -Style/MixinUsage: +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/actions/oauth_signup_action.rb' + +# Offense count: 42 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedVars. +Style/FetchEnvVar: + Enabled: false + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'config/initializers/new_framework_defaults_6_0.rb' + - 'db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb' + - 'db/migrate/20200815012538_remove_median_function.rb' + - 'spec/lib/haml/filters/growstuff_markdown_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'config/environments/production.rb' + - 'lib/tasks/openfarm.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Exclude: + - 'app/models/photo_association.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: Exclude: - 'bin/setup' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods. +# AllowedMethods: nonzero? +Style/IfWithBooleanLiteralBranches: + Exclude: + - 'app/controllers/gardens_controller.rb' + +# Offense count: 2 +Style/MixinUsage: + Exclude: - 'bin/update' - 'spec/rails_helper.rb' -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/NegatedIfElseCondition: + Exclude: + - 'app/helpers/crops_helper.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - - 'spec/**/*' - 'app/helpers/harvests_helper.rb' - 'app/helpers/plantings_helper.rb' + +# Offense count: 6 +Style/OpenStructUse: + Exclude: + - 'spec/helpers/event_helper_spec.rb' + +# Offense count: 2 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Exclude: + - 'app/models/concerns/member_newsletter.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: same_as_string_literals, single_quotes, double_quotes +Style/QuotedSymbols: + Exclude: + - 'app/models/seed.rb' + - 'spec/controllers/crops_controller_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Methods. +Style/RedundantArgument: + Exclude: + - 'app/helpers/application_helper.rb' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: SafeForConstants. +Style/RedundantFetchBlock: + Exclude: + - 'config/puma.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantFreeze: + Exclude: + - 'lib/haml/filters/growstuff_markdown.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'app/controllers/application_controller.rb' + - 'app/controllers/messages_controller.rb' + - 'app/models/photo_association.rb' + +# Offense count: 20 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'app/controllers/messages_controller.rb' + - 'app/helpers/buttons_helper.rb' + - 'config/initializers/rswag_api.rb' + - 'spec/helpers/gardens_helper_spec.rb' + - 'spec/helpers/seeds_helper_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments. +# AllowedMethods: define_method, mail, respond_to +Style/SymbolProc: + Exclude: + - 'app/controllers/crops_controller.rb' diff --git a/Gemfile.lock b/Gemfile.lock index 8c995f586..d6b2ff7f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -333,7 +333,7 @@ GEM railties (>= 3.2.16) js-routes (1.4.14) railties (>= 4) - json (2.3.1) + json (2.6.2) json-schema (3.0.0) addressable (>= 2.8) jsonapi-resources (0.10.7) @@ -437,7 +437,7 @@ GEM rate_throttle_client (~> 0.1.0) popper_js (1.16.1) public_suffix (5.0.0) - puma (5.6.4) + puma (6.0.0) nio4r (~> 2.0) query_diet (0.7.1) racc (1.6.0) @@ -539,24 +539,24 @@ GEM rswag-ui (2.7.0) actionpack (>= 3.1, < 7.1) railties (>= 3.1, < 7.1) - rubocop (0.93.1) + rubocop (1.38.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.23.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) + unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.23.0) parser (>= 3.1.1.0) - rubocop-rails (2.9.1) + rubocop-rails (2.17.2) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (1.44.1) - rubocop (~> 0.87) - rubocop-ast (>= 0.7.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-rspec (2.15.0) + rubocop (~> 1.33) ruby-progressbar (1.11.0) ruby-units (3.0.0) ruby-vips (2.1.4) @@ -621,7 +621,7 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.8.0) + unicode-display_width (2.3.0) unicorn (6.1.0) kgio (~> 2.6) raindrops (~> 0.7)