From 7d18236e17f630b5e9481bd1e30d6a8c80fd3310 Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Fri, 13 Sep 2019 08:37:41 -0400 Subject: [PATCH] Update rubocop and rubocop rspec and get them passing by moving things to todos --- .rubocop.yml | 13 +- .rubocop_todo.yml | 541 +++++++++++++++++---- Gemfile | 2 +- flipper-active_record.gemspec | 2 +- flipper-active_support_cache_store.gemspec | 4 +- flipper-api.gemspec | 4 +- flipper-cloud.gemspec | 4 +- flipper-dalli.gemspec | 4 +- flipper-moneta.gemspec | 4 +- flipper-mongo.gemspec | 4 +- flipper-redis.gemspec | 4 +- flipper-rollout.gemspec | 4 +- flipper-sequel.gemspec | 4 +- flipper-ui.gemspec | 6 +- flipper.gemspec | 8 +- lib/flipper/spec/shared_adapter_specs.rb | 1 - lib/flipper/ui/action.rb | 6 +- 17 files changed, 485 insertions(+), 130 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1bb990a9f..53a8789ae 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,8 +11,7 @@ AllCops: - 'tmp/**/*' - 'bin/**/*' - 'vendor/bundle/**/*' - TargetRubyVersion: 2.0 - # DefaultFormatter: fuubar + TargetRubyVersion: 2.6 Style/Alias: Enabled: false @@ -36,19 +35,17 @@ Style/IfUnlessModifier: Metrics/LineLength: Max: 100 - Exclude: - - '*.gemspec' Style/RegexpLiteral: EnforcedStyle: mixed -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: EnforcedStyleForMultiline: consistent_comma -RSpec/InstanceVariable: - Enabled: false +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma -Style/AccessorMethodName: +RSpec/InstanceVariable: Enabled: false Lint/HandleExceptions: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2b53afe35..06864a813 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,17 +1,100 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2016-11-20 15:49:33 +0000 using RuboCop version 0.45.0. +# on 2019-09-13 08:34:35 -0400 using RuboCop version 0.74.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. -require: rubocop-rspec +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Include: **/*.gemfile, **/Gemfile, **/gems.rb +Bundler/OrderedGems: + Exclude: + - 'Gemfile' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'flipper-active_record.gemspec' + - 'flipper-active_support_cache_store.gemspec' + - 'flipper-api.gemspec' + - 'flipper-dalli.gemspec' + - 'flipper-ui.gemspec' + +# Offense count: 4 +# Cop supports --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/AlignHash: + Exclude: + - 'lib/flipper/typecast.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/ClosingHeredocIndentation: + Exclude: + - 'test/generators/flipper/active_record_generator_test.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/flipper/adapters/sync/feature_synchronizer.rb' + - 'lib/flipper/api/json_params.rb' + - 'lib/flipper/api/v1/actions/feature.rb' + - 'lib/flipper/type.rb' + - 'lib/flipper/types/actor.rb' + - 'lib/flipper/types/group.rb' + - 'lib/flipper/ui/action.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'flipper-active_record.gemspec' + - 'flipper-active_support_cache_store.gemspec' + - 'flipper-api.gemspec' + - 'flipper-cloud.gemspec' + - 'flipper-dalli.gemspec' + - 'flipper-moneta.gemspec' + - 'flipper-mongo.gemspec' + - 'flipper-redis.gemspec' + - 'flipper-rollout.gemspec' + - 'flipper-sequel.gemspec' + - 'flipper-ui.gemspec' + - 'flipper.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Exclude: + - 'test/adapters/active_record_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: squiggly, active_support, powerpack, unindent +Layout/IndentHeredoc: + Exclude: + - 'test/generators/flipper/active_record_generator_test.rb' # Offense count: 2 +# Cop supports --auto-correct. +Layout/RescueEnsureAlignment: + Exclude: + - 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb' + - 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb' + +# Offense count: 1 Lint/AmbiguousRegexpLiteral: Exclude: - - 'lib/flipper/instrumentation/metriks.rb' - 'lib/flipper/instrumentation/statsd.rb' # Offense count: 6 @@ -23,24 +106,29 @@ Lint/AssignmentInCondition: - 'lib/flipper/feature.rb' - 'lib/flipper/gate_values.rb' -# Offense count: 1 -Lint/Eval: +# Offense count: 2 +Lint/DuplicateMethods: Exclude: - - 'flipper.gemspec' + - 'lib/flipper/ui.rb' + - 'lib/flipper/ui/configuration.rb' # Offense count: 3 -Lint/HandleExceptions: +# Configuration parameters: MaximumRangeSize. +Lint/MissingCopEnableDirective: + Exclude: + - 'lib/flipper/feature.rb' + - 'lib/flipper/spec/shared_adapter_specs.rb' + - 'lib/flipper/test/shared_adapter_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/ScriptPermission: Exclude: - - 'spec/flipper/adapters/mongo_spec.rb' - - 'test/adapters/mongo_test.rb' - - 'test/helper.rb' + - 'Rakefile' -# Offense count: 24 +# Offense count: 21 Lint/ShadowingOuterLocalVariable: Exclude: - - 'lib/flipper/adapters/active_record.rb' - - 'lib/flipper/adapters/instrumented.rb' - - 'lib/flipper/adapters/sequel.rb' - 'spec/flipper/api/v1/actions/actors_gate_spec.rb' - 'spec/flipper/api/v1/actions/percentage_of_actors_gate_spec.rb' - 'spec/flipper/api/v1/actions/percentage_of_time_gate_spec.rb' @@ -48,70 +136,259 @@ Lint/ShadowingOuterLocalVariable: - 'spec/flipper/feature_spec.rb' - 'spec/flipper/types/group_spec.rb' -# Offense count: 26 +# Offense count: 2 +# Cop supports --auto-correct. +Lint/UnneededCopDisableDirective: + Exclude: + - 'spec/flipper/adapter_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/UnneededRequireStatement: + Exclude: + - 'lib/flipper/registry.rb' + +# Offense count: 27 Lint/UselessAssignment: Exclude: - 'lib/flipper/instrumentation/log_subscriber.rb' - 'lib/flipper/instrumentation/subscriber.rb' - - 'lib/flipper/ui/actions/groups_gate.rb' - 'spec/flipper/api/action_spec.rb' - 'spec/flipper/dsl_spec.rb' - 'spec/flipper/feature_spec.rb' - 'spec/flipper/gates/group_spec.rb' - - 'spec/flipper/instrumentation/metriks_subscriber_spec.rb' - 'spec/flipper/instrumentation/statsd_subscriber_spec.rb' - - 'spec/flipper_spec.rb' - 'spec/flipper/middleware/memoizer_spec.rb' - - 'test/helper.rb' + - 'spec/flipper_spec.rb' -# Offense count: 27 +# Offense count: 35 Metrics/AbcSize: - Max: 30 + Max: 29 -# Offense count: 1 -# Configuration parameters: CountComments. +# Offense count: 136 +# Configuration parameters: CountComments, ExcludedMethods. +# ExcludedMethods: refine Metrics/BlockLength: - Max: 195 + Max: 683 -# Offense count: 4 +# Offense count: 11 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 178 + Max: 150 -# Offense count: 39 -# Configuration parameters: CountComments. +# Offense count: 20 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 251 + +# Offense count: 59 +# Configuration parameters: CountComments, ExcludedMethods. Metrics/MethodLength: Max: 23 -# Offense count: 65 +# Offense count: 18 +Naming/AccessorMethodName: + Enabled: false + +# Offense count: 25 +Naming/ConstantName: + Exclude: + - 'lib/flipper.rb' + - 'lib/flipper/adapters/active_support_cache_store.rb' + - 'lib/flipper/adapters/dalli.rb' + - 'lib/flipper/adapters/instrumented.rb' + - 'lib/flipper/adapters/memoizable.rb' + - 'lib/flipper/adapters/memory.rb' + - 'lib/flipper/adapters/mongo.rb' + - 'lib/flipper/adapters/operation_logger.rb' + - 'lib/flipper/adapters/pstore.rb' + - 'lib/flipper/adapters/redis.rb' + - 'lib/flipper/adapters/redis_cache.rb' + - 'lib/flipper/feature.rb' + - 'lib/flipper/gate_values.rb' + - 'lib/flipper/typecast.rb' + - 'lib/flipper/ui/decorators/feature.rb' + +# Offense count: 9 +# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'lib/flipper-active_record.rb' + - 'lib/flipper-active_support_cache_store.rb' + - 'lib/flipper-api.rb' + - 'lib/flipper-cloud.rb' + - 'lib/flipper-dalli.rb' + - 'lib/flipper-mongo.rb' + - 'lib/flipper-redis.rb' + - 'lib/flipper-sequel.rb' + - 'lib/flipper-ui.rb' + +# Offense count: 1 +# Configuration parameters: Blacklist. +# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +Naming/HeredocDelimiterNaming: + Exclude: + - 'test/generators/flipper/active_record_generator_test.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: PreferredName. +Naming/RescuedExceptionsVariableName: + Exclude: + - 'lib/flipper/adapters/active_record.rb' + - 'lib/flipper/adapters/sync/synchronizer.rb' + - 'lib/flipper/ui/actions/percentage_of_actors_gate.rb' + - 'lib/flipper/ui/actions/percentage_of_time_gate.rb' + +# Offense count: 3 +RSpec/BeforeAfterAll: + Exclude: + - 'spec/spec_helper.rb' + - 'spec/rails_helper.rb' + - 'spec/support/**/*.rb' + - 'spec/flipper/adapters/active_record_spec.rb' + - 'spec/flipper/adapters/http_spec.rb' + +# Offense count: 76 +# Configuration parameters: Prefixes. +# Prefixes: when, with, without +RSpec/ContextWording: + Enabled: false + +# Offense count: 1 +# Configuration parameters: CustomIncludeMethods. +RSpec/EmptyExampleGroup: + Exclude: + - 'spec/flipper/gates/actor_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +RSpec/EmptyLineAfterFinalLet: + Exclude: + - 'spec/flipper/adapters/moneta_spec.rb' + - 'spec/flipper/ui/actions/features_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +RSpec/EmptyLineAfterSubject: + Exclude: + - 'spec/flipper/adapters/http_spec.rb' + - 'spec/flipper/types/percentage_spec.rb' + +# Offense count: 138 # Configuration parameters: Max. RSpec/ExampleLength: Enabled: false -# Offense count: 2 -# Configuration parameters: CustomTransform. +# Offense count: 1 +# Configuration parameters: CustomTransform, IgnoreMethods. RSpec/FilePath: Exclude: - 'spec/flipper/adapters/pstore_spec.rb' - - 'spec/integration_spec.rb' -# Offense count: 91 -RSpec/InstanceVariable: +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + Exclude: + - 'spec/flipper/adapters/active_record_spec.rb' + - 'spec/flipper/adapters/http_spec.rb' + - 'spec/flipper/adapters/sequel_spec.rb' + - 'spec/helper.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +RSpec/HooksBeforeExamples: + Exclude: + - 'spec/flipper/ui_spec.rb' + +# Offense count: 22 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: it_behaves_like, it_should_behave_like +RSpec/ItBehavesLike: + Enabled: false + +# Offense count: 4 +RSpec/IteratedExpectation: Exclude: - - 'spec/flipper/adapters/operation_logger_spec.rb' - 'spec/flipper/dsl_spec.rb' - 'spec/flipper/feature_spec.rb' - - 'spec/flipper/instrumentation/log_subscriber_spec.rb' - - 'spec/flipper/ui/actions/add_feature_spec.rb' - - 'spec/flipper/ui/actions/features_spec.rb' - - 'spec/flipper/ui/decorators/feature_spec.rb' - - 'spec/flipper/ui/decorators/gate_spec.rb' - - 'spec/flipper/ui_spec.rb' - - 'spec/flipper_spec.rb' + - 'spec/flipper/gates/percentage_of_actors_spec.rb' + - 'spec/flipper/registry_spec.rb' + +# Offense count: 26 +# Cop supports --auto-correct. +RSpec/LeadingSubject: + Enabled: false + +# Offense count: 17 +# Configuration parameters: . +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + EnforcedStyle: receive + +# Offense count: 233 +# Configuration parameters: AggregateFailuresByDefault. +RSpec/MultipleExpectations: + Max: 20 + +# Offense count: 449 +# Configuration parameters: IgnoreSharedExamples. +RSpec/NamedSubject: + Enabled: false + +# Offense count: 25 +RSpec/NestedGroups: + Max: 5 + +# Offense count: 19 +# Cop supports --auto-correct. +# Configuration parameters: Strict, EnforcedStyle. +# SupportedStyles: inflected, explicit +RSpec/PredicateMatcher: + Exclude: + - 'spec/flipper/api/v1/actions/actors_gate_spec.rb' + - 'spec/flipper/api/v1/actions/boolean_gate_spec.rb' + - 'spec/flipper/api/v1/actions/clear_feature_spec.rb' + - 'spec/flipper/api/v1/actions/features_spec.rb' + - 'spec/flipper/api/v1/actions/groups_gate_spec.rb' + - 'spec/flipper/types/group_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +RSpec/ReceiveNever: + Exclude: + - 'spec/flipper/middleware/memoizer_spec.rb' + +# Offense count: 2 +RSpec/RepeatedDescription: + Exclude: + - 'spec/flipper/gates/boolean_spec.rb' + +# Offense count: 4 +RSpec/RepeatedExample: + Exclude: + - 'spec/flipper/cloud_spec.rb' - 'spec/integration_spec.rb' -# Offense count: 15 -# Configuration parameters: IgnoreSymbolicNames. +# Offense count: 2 +RSpec/ScatteredLet: + Exclude: + - 'spec/flipper/adapters/http_spec.rb' + - 'spec/flipper/instrumentation/log_subscriber_spec.rb' + +# Offense count: 4 +RSpec/SubjectStub: + Exclude: + - 'spec/flipper/adapters/sync_spec.rb' + +# Offense count: 17 +# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Exclude: - 'spec/flipper/api/v1/actions/features_spec.rb' @@ -121,22 +398,24 @@ RSpec/VerifiedDoubles: - 'spec/flipper_spec.rb' - 'spec/integration_spec.rb' -# Offense count: 2 -Style/AccessorMethodName: +# Offense count: 1 +Security/Eval: Exclude: - - 'lib/flipper/adapters/memory.rb' - - 'lib/flipper/adapters/pstore.rb' + - 'flipper.gemspec' -# Offense count: 7 -Style/ConstantName: +# Offense count: 5 +Security/MarshalLoad: Exclude: - - 'lib/flipper.rb' - - 'lib/flipper/adapters/dalli.rb' - - 'lib/flipper/adapters/memoizable.rb' - - 'lib/flipper/adapters/memory.rb' - - 'lib/flipper/adapters/mongo.rb' - - 'lib/flipper/adapters/pstore.rb' - - 'lib/flipper/adapters/redis.rb' + - 'lib/flipper/adapters/redis_cache.rb' + - 'spec/flipper/adapters/redis_cache_spec.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: inline, group +Style/AccessModifierDeclarations: + Exclude: + - 'lib/flipper/api/action.rb' + - 'lib/flipper/ui/action.rb' # Offense count: 3 Style/DoubleNegation: @@ -145,55 +424,139 @@ Style/DoubleNegation: - 'lib/flipper/gates/boolean.rb' - 'lib/flipper/typecast.rb' -# Offense count: 7 -# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts. -Style/FileName: +# Offense count: 1 +# Cop supports --auto-correct. +Style/EmptyLambdaParameter: Exclude: - - 'lib/flipper-active_record.rb' - - 'lib/flipper-api.rb' - - 'lib/flipper-active_support_cache_store.rb' - - 'lib/flipper-cloud.rb' - - 'lib/flipper-dalli.rb' - - 'lib/flipper-mongo.rb' - - 'lib/flipper-redis.rb' - - 'lib/flipper-sequel.rb' - - 'lib/flipper-ui.rb' + - 'lib/flipper/ui.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'lib/flipper/gate.rb' + +# Offense count: 27 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Enabled: false # Offense count: 2 -# Configuration parameters: EnforcedStyle, SupportedStyles. +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. # SupportedStyles: format, sprintf, percent Style/FormatString: Exclude: - 'lib/flipper/instrumentation/log_subscriber.rb' -# Offense count: 10 -# Configuration parameters: MinBodyLength. -Style/GuardClause: - Exclude: - - 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb' - - 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb' - - 'lib/flipper/gate_values.rb' - - 'lib/flipper/instrumentation/statsd_subscriber.rb' - - 'lib/flipper/instrumentation/subscriber.rb' - - 'lib/flipper/registry.rb' - - 'lib/flipper/typecast.rb' +# Offense count: 2 +# Configuration parameters: . +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + EnforcedStyle: unannotated + +# Offense count: 219 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, never +Style/FrozenStringLiteralComment: + Enabled: false # Offense count: 1 +# Configuration parameters: AllowIfModifier. Style/IfInsideElse: Exclude: - 'lib/flipper/gates/actor.rb' # Offense count: 1 -Style/MethodMissing: +Style/MethodMissingSuper: Exclude: - 'lib/flipper/types/actor.rb' -Style/AccessorMethodName: +# Offense count: 1 +Style/MissingRespondToMissing: Exclude: - - 'lib/flipper/adapter.rb' - - 'lib/flipper/adapters/http.rb' - - 'lib/flipper/adapters/instrumented.rb' - - 'lib/flipper/adapters/memoizable.rb' + - 'lib/flipper/types/actor.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/flipper/ui/util.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb' + - 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb' + - 'lib/flipper/gates/percentage_of_actors.rb' + - 'lib/flipper/gates/percentage_of_time.rb' + - 'lib/flipper/types/percentage.rb' + +# Offense count: 34 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'Rakefile' + - 'lib/flipper/spec/shared_adapter_specs.rb' + - 'lib/flipper/test/shared_adapter_test.rb' + - 'lib/flipper/ui.rb' + - 'lib/flipper/ui/configuration.rb' + - 'spec/flipper/adapter_spec.rb' + - 'spec/flipper/adapters/http_spec.rb' + - 'spec/flipper/adapters/memoizable_spec.rb' + - 'spec/flipper/adapters/sync/synchronizer_spec.rb' + - 'spec/flipper/adapters/sync_spec.rb' + - 'spec/flipper/api/v1/actions/features_spec.rb' + - 'spec/flipper/api_spec.rb' + - 'spec/flipper/dsl_spec.rb' + - 'spec/flipper/middleware/memoizer_spec.rb' + - 'spec/flipper/registry_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'spec/flipper/middleware/memoizer_spec.rb' + - 'spec/flipper/ui/actions/feature_spec.rb' + - 'spec/flipper/ui_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'lib/flipper/adapters/sync/synchronizer.rb' + - 'spec/flipper/middleware/memoizer_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. +# Whitelist: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/flipper/instrumentation/statsd_subscriber.rb' + - 'lib/flipper/middleware/memoizer.rb' + - 'spec/flipper/adapters/http_spec.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + Exclude: + - 'Rakefile' - 'lib/flipper/adapters/operation_logger.rb' - - 'lib/flipper/adapters/memory.rb' - - 'lib/flipper/adapters/pstore.rb' + - 'lib/generators/flipper/templates/sequel_migration.rb' + - 'spec/flipper/adapters/rollout_spec.rb' + - 'spec/flipper/gate_values_spec.rb' diff --git a/Gemfile b/Gemfile index 1dd7cc17b..5a0bd33b9 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'rack-test', '~> 0.6.3' gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.3.11'}" gem 'rails', "~> #{ENV['RAILS_VERSION'] || '6.0.0'}" gem 'minitest', '~> 5.8' -gem 'rubocop', '~> 0.45.0' +gem 'rubocop' gem 'rubocop-rspec' gem 'webmock', '~> 3.0' diff --git a/flipper-active_record.gemspec b/flipper-active_record.gemspec index 2b0de34f4..a7cb4c0f0 100644 --- a/flipper-active_record.gemspec +++ b/flipper-active_record.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |gem| 'lib/flipper/version.rb', ] gem.files = `git ls-files`.split("\n").select(&flipper_active_record_files) + extra_files - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_record_files) + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_record_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-active_record' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-active_support_cache_store.gemspec b/flipper-active_support_cache_store.gemspec index 8efa1bb98..cb0e211de 100644 --- a/flipper-active_support_cache_store.gemspec +++ b/flipper-active_support_cache_store.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_active_support_cache_store_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_support_cache_store_files) + gem.files = `git ls-files`.split("\n").select(&flipper_active_support_cache_store_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_support_cache_store_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-active_support_cache_store' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-api.gemspec b/flipper-api.gemspec index c7a9c48c5..554b07c51 100644 --- a/flipper-api.gemspec +++ b/flipper-api.gemspec @@ -13,8 +13,8 @@ Gem::Specification.new do |gem| gem.description = 'Rack middleware that provides an API for the flipper gem.' gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_api_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_api_files) + gem.files = `git ls-files`.split("\n").select(&flipper_api_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_api_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-api' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-cloud.gemspec b/flipper-cloud.gemspec index 505f8b973..b73c15735 100644 --- a/flipper-cloud.gemspec +++ b/flipper-cloud.gemspec @@ -17,8 +17,8 @@ Gem::Specification.new do |gem| extra_files = [ 'lib/flipper/version.rb', ] - gem.files = `git ls-files`.split("\n").select(&flipper_cloud_files) + extra_files - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_cloud_files) + gem.files = `git ls-files`.split("\n").select(&flipper_cloud_files) + extra_files # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_cloud_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-cloud' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-dalli.gemspec b/flipper-dalli.gemspec index c5c804923..a1cfc0657 100644 --- a/flipper-dalli.gemspec +++ b/flipper-dalli.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_dalli_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_dalli_files) + gem.files = `git ls-files`.split("\n").select(&flipper_dalli_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_dalli_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-dalli' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-moneta.gemspec b/flipper-moneta.gemspec index f1af9b0c9..89d1e43ec 100644 --- a/flipper-moneta.gemspec +++ b/flipper-moneta.gemspec @@ -13,8 +13,8 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_moneta_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_moneta_files) + gem.files = `git ls-files`.split("\n").select(&flipper_moneta_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_moneta_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-moneta' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-mongo.gemspec b/flipper-mongo.gemspec index 01aeab6b3..6e9e65632 100644 --- a/flipper-mongo.gemspec +++ b/flipper-mongo.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_mongo_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_mongo_files) + gem.files = `git ls-files`.split("\n").select(&flipper_mongo_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_mongo_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-mongo' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-redis.gemspec b/flipper-redis.gemspec index a8eeee805..dcb6690dd 100644 --- a/flipper-redis.gemspec +++ b/flipper-redis.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_redis_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_redis_files) + gem.files = `git ls-files`.split("\n").select(&flipper_redis_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_redis_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-redis' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-rollout.gemspec b/flipper-rollout.gemspec index 9d9e58379..04fb0555a 100644 --- a/flipper-rollout.gemspec +++ b/flipper-rollout.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_rollout_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_rollout_files) + gem.files = `git ls-files`.split("\n").select(&flipper_rollout_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_rollout_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-rollout' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-sequel.gemspec b/flipper-sequel.gemspec index fa167650d..ecc7429cb 100644 --- a/flipper-sequel.gemspec +++ b/flipper-sequel.gemspec @@ -15,8 +15,8 @@ Gem::Specification.new do |gem| extra_files = [ 'lib/flipper/version.rb', ] - gem.files = `git ls-files`.split("\n").select(&flipper_sequel_files) + extra_files - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_sequel_files) + gem.files = `git ls-files`.split("\n").select(&flipper_sequel_files) + extra_files # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_sequel_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-sequel' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-ui.gemspec b/flipper-ui.gemspec index 7f99c027a..e5d66e13a 100644 --- a/flipper-ui.gemspec +++ b/flipper-ui.gemspec @@ -10,12 +10,12 @@ Gem::Specification.new do |gem| gem.authors = ['John Nunemaker'] gem.email = ['nunemaker@gmail.com'] gem.summary = 'UI for the Flipper gem' - gem.description = 'Rack middleware that provides a fully featured web interface for the flipper gem.' + gem.description = 'Rack middleware that provides a fully featured web interface for the flipper gem.' # rubocop:disable Metrics/LineLength gem.license = 'MIT' gem.homepage = 'https://github.com/jnunemaker/flipper' - gem.files = `git ls-files`.split("\n").select(&flipper_ui_files) + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_ui_files) + gem.files = `git ls-files`.split("\n").select(&flipper_ui_files) + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_ui_files) # rubocop:disable Metrics/LineLength gem.name = 'flipper-ui' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper.gemspec b/flipper.gemspec index 05eedfaf3..af0a0f594 100644 --- a/flipper.gemspec +++ b/flipper.gemspec @@ -25,13 +25,13 @@ Gem::Specification.new do |gem| gem.authors = ['John Nunemaker'] gem.email = ['nunemaker@gmail.com'] gem.summary = 'Feature flipper for ANYTHING' - gem.description = 'Feature flipper is the act of enabling/disabling features in your application, ideally without re-deploying or changing anything in your code base. Flipper makes this extremely easy to do with any backend you would like to use.' + gem.description = 'Feature flipper is the act of enabling/disabling features in your application, ideally without re-deploying or changing anything in your code base. Flipper makes this extremely easy to do with any backend you would like to use.' # rubocop:disable Metrics/LineLength gem.homepage = 'https://github.com/jnunemaker/flipper' gem.license = 'MIT' - gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } - gem.files = `git ls-files`.split("\n") - ignored_files + ['lib/flipper/version.rb'] - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - ignored_test_files + gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } # rubocop:disable Metrics/LineLength + gem.files = `git ls-files`.split("\n") - ignored_files + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - ignored_test_files # rubocop:disable Metrics/LineLength gem.name = 'flipper' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/lib/flipper/spec/shared_adapter_specs.rb b/lib/flipper/spec/shared_adapter_specs.rb index 2f3c7732a..3559dece4 100644 --- a/lib/flipper/spec/shared_adapter_specs.rb +++ b/lib/flipper/spec/shared_adapter_specs.rb @@ -1,6 +1,5 @@ # Requires the following methods: # * subject - The instance of the adapter -# rubocop:disable Metrics/BlockLength RSpec.shared_examples_for 'a flipper adapter' do let(:flipper) { Flipper.new(subject) } let(:feature) { flipper[:stats] } diff --git a/lib/flipper/ui/action.rb b/lib/flipper/ui/action.rb index 2ac0f3970..ba7c7f59d 100644 --- a/lib/flipper/ui/action.rb +++ b/lib/flipper/ui/action.rb @@ -205,12 +205,8 @@ def view_without_layout(name) # Private def view(name) path = views_path.join("#{name}.erb") - raise "Template does not exist: #{path}" unless path.exist? - - # rubocop:disable Lint/Eval - eval(Erubi::Engine.new(path.read, escape: true).src) - # rubocop:enable Lint/Eval + eval(Erubi::Engine.new(path.read, escape: true).src) # rubocop:disable Security/Eval end # Internal: The path the app is mounted at.