From 0a6156fe385ed186142edec8f7e0980b580a268e Mon Sep 17 00:00:00 2001 From: Anusha Bhat Date: Wed, 23 Oct 2019 23:56:48 +0530 Subject: [PATCH] Add rubocop tools and regenerate rubocop todo file (#175) --- .rubocop.yml | 4 ++ .rubocop_todo.yml | 171 ++++++++++++++++++++++++++++++++++++++++++---- Gemfile | 3 + Gemfile.lock | 10 +++ 4 files changed, 173 insertions(+), 15 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index da16cc977..329307015 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,7 @@ +require: + - rubocop-performance + - rubocop-rails + - rubocop-rspec inherit_from: .rubocop_todo.yml Metrics/LineLength: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d9db0c783..970b60ed9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2019-10-20 22:59:04 +0300 using RuboCop version 0.75.1. +# on 2019-10-23 16:47:02 +0530 using RuboCop version 0.73.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 @@ -59,14 +59,7 @@ Metrics/BlockLength: Metrics/CyclomaticComplexity: Max: 7 -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 497 - -# Offense count: 9 +# Offense count: 10 # Configuration parameters: CountComments, ExcludedMethods. Metrics/MethodLength: Max: 19 @@ -97,6 +90,160 @@ Naming/MemoizedInstanceVariableName: - 'lib/integrations/widget/outgoing_message_builder.rb' - 'lib/webhooks/chargebee.rb' +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: MaxKeyValuePairs. +Performance/RedundantMerge: + Exclude: + - 'app/controllers/api/v1/callbacks_controller.rb' + - 'app/models/message.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Performance/StringReplacement: + Exclude: + - 'lib/events/base.rb' + +# Offense count: 4 +# Configuration parameters: Prefixes. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/models/contact_spec.rb' + - 'spec/models/user_spec.rb' + +# Offense count: 1 +RSpec/DescribeClass: + Exclude: + - 'spec/mailers/confirmation_instructions_spec.rb' + +# Offense count: 1 +RSpec/DescribeSymbol: + Exclude: + - 'spec/mailers/confirmation_instructions_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterExample: + Exclude: + - 'spec/models/user_spec.rb' + +# Offense count: 1 +# Configuration parameters: Max. +RSpec/ExampleLength: + Exclude: + - 'spec/models/conversation_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_line_only, single_statement_only, disallow +RSpec/ImplicitSubject: + Exclude: + - 'spec/models/user_spec.rb' + +# Offense count: 7 +# Configuration parameters: AggregateFailuresByDefault. +RSpec/MultipleExpectations: + Max: 7 + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: + Exclude: + - 'spec/mailers/confirmation_instructions_spec.rb' + +# Offense count: 1 +# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. +RSpec/VerifiedDoubles: + Exclude: + - 'spec/models/conversation_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Rails/ActiveRecordAliases: + Exclude: + - 'app/controllers/api/v1/agents_controller.rb' + - 'app/controllers/api/v1/callbacks_controller.rb' + - 'app/controllers/api/v1/canned_responses_controller.rb' + - 'app/controllers/api/v1/contacts_controller.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Rails/BelongsTo: + Exclude: + - 'app/models/message.rb' + - 'app/models/user.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/EnumHash: + Exclude: + - 'app/models/attachment.rb' + - 'app/models/conversation.rb' + - 'app/models/message.rb' + - 'app/models/subscription.rb' + - 'app/models/user.rb' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/HasManyOrHasOneDependent: + Exclude: + - 'app/models/user.rb' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/InverseOf: + Exclude: + - 'app/models/user.rb' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/controllers/**/*.rb +Rails/LexicallyScopedActionFilter: + Exclude: + - 'app/controllers/home_controller.rb' + +# Offense count: 2 +# Configuration parameters: Include. +# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb +Rails/Output: + Exclude: + - 'app/bot/bot.rb' + - 'app/builders/account_builder.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: strict, flexible +Rails/TimeZone: + Exclude: + - 'app/builders/report_builder.rb' + - 'app/models/subscription.rb' + - 'lib/reports/update_account_identity.rb' + - 'lib/reports/update_agent_identity.rb' + - 'lib/reports/update_identity.rb' + - 'spec/models/conversation_spec.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/Validation: + Exclude: + - 'app/models/canned_response.rb' + - 'app/models/channel/facebook_page.rb' + - 'app/models/facebook_page.rb' + - 'app/models/telegram_bot.rb' + - 'app/models/user.rb' + # Offense count: 15 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle. @@ -155,12 +302,6 @@ Style/IfInsideElse: Exclude: - 'app/finders/conversation_finder.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/IfUnlessModifier: - Exclude: - - 'deploy/before_symlink.rb' - # Offense count: 1 Style/MixinUsage: Exclude: diff --git a/Gemfile b/Gemfile index 2f332b915..71f16c0b2 100644 --- a/Gemfile +++ b/Gemfile @@ -84,6 +84,9 @@ group :development, :test do gem 'pry-rails' gem 'rspec-rails', '~> 3.8' gem 'rubocop', '~> 0.73.0', require: false + gem 'rubocop-performance', require: false + gem 'rubocop-rails', require: false + gem 'rubocop-rspec', require: false gem 'seed_dump' gem 'spring' gem 'spring-watcher-listen' diff --git a/Gemfile.lock b/Gemfile.lock index db2561c8f..d759699e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -358,6 +358,13 @@ GEM rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) + rubocop-performance (1.5.0) + rubocop (>= 0.71.0) + rubocop-rails (2.3.2) + rack (>= 1.1) + rubocop (>= 0.72.0) + rubocop-rspec (1.36.0) + rubocop (>= 0.68.1) ruby-progressbar (1.10.1) ruby-vips (2.0.16) ffi (~> 1.9) @@ -482,6 +489,9 @@ DEPENDENCIES responders rspec-rails (~> 3.8) rubocop (~> 0.73.0) + rubocop-performance + rubocop-rails + rubocop-rspec seed_dump sentry-raven shoulda-matchers