diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 84bb1c0f3..000000000 --- a/.rubocop.yml +++ /dev/null @@ -1,52 +0,0 @@ -# This is the configuration used to check the rubocop source code. - -require: rubocop-rspec -inherit_from: - - .rubocop_todo.yml - -AllCops: - Exclude: - - 'docker-compose/**/*' - - 'examples/**/*' - - 'tmp/**/*' - - 'bin/**/*' - - 'vendor/bundle/**/*' - TargetRubyVersion: 2.6 -Style/Alias: - Enabled: false - -Style/Documentation: - Enabled: false - -Style/Encoding: - Enabled: false - -Style/NumericLiterals: - Enabled: false - -Style/StringLiterals: - Enabled: false - -Style/GuardClause: - Enabled: false - -Style/IfUnlessModifier: - Enabled: false - -Layout/LineLength: - Max: 100 - -Style/RegexpLiteral: - EnforcedStyle: mixed - -Style/TrailingCommaInArrayLiteral: - EnforcedStyleForMultiline: consistent_comma - -Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: consistent_comma - -RSpec/InstanceVariable: - Enabled: false - -Lint/SuppressedException: - Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index a78626a2a..000000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,562 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# 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. - -# 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/HashAlignment: - 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/HeredocIndentation: - 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/statsd.rb' - -# Offense count: 6 -# Configuration parameters: AllowSafeAssignment. -Lint/AssignmentInCondition: - Exclude: - - 'lib/flipper/adapters/active_record.rb' - - 'lib/flipper/adapters/sequel.rb' - - 'lib/flipper/feature.rb' - - 'lib/flipper/gate_values.rb' - -# Offense count: 2 -Lint/DuplicateMethods: - Exclude: - - 'lib/flipper/ui.rb' - - 'lib/flipper/ui/configuration.rb' - -# Offense count: 3 -# 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: - - 'Rakefile' - -# Offense count: 21 -Lint/ShadowingOuterLocalVariable: - Exclude: - - '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' - - 'spec/flipper/dsl_spec.rb' - - 'spec/flipper/feature_spec.rb' - - 'spec/flipper/types/group_spec.rb' - -# Offense count: 2 -# Cop supports --auto-correct. -Lint/RedundantCopDisableDirective: - Exclude: - - 'spec/flipper/adapter_spec.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Lint/RedundantRequireStatement: - Exclude: - - 'lib/flipper/registry.rb' - -# Offense count: 27 -Lint/UselessAssignment: - Exclude: - - 'lib/flipper/instrumentation/log_subscriber.rb' - - 'lib/flipper/instrumentation/subscriber.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/statsd_subscriber_spec.rb' - - 'spec/flipper/middleware/memoizer_spec.rb' - - 'spec/flipper_spec.rb' - -# Offense count: 35 -Metrics/AbcSize: - Max: 29 - -# Offense count: 136 -# Configuration parameters: CountComments, ExcludedMethods. -# ExcludedMethods: refine -Metrics/BlockLength: - Max: 685 - -# Offense count: 11 -# Configuration parameters: CountComments. -Metrics/ClassLength: - Max: 160 - -# Offense count: 20 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 251 - -# Offense count: 59 -# Configuration parameters: CountComments, ExcludedMethods. -Metrics/MethodLength: - Max: 23 - -# 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: 1 -# Configuration parameters: CustomTransform, IgnoreMethods. -RSpec/FilePath: - Exclude: - - 'spec/flipper/adapters/pstore_spec.rb' - -# 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/dsl_spec.rb' - - 'spec/flipper/feature_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/flipper_integration_spec.rb' - -# 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' - - 'spec/flipper/dsl_spec.rb' - - 'spec/flipper/feature_spec.rb' - - 'spec/flipper/types/group_spec.rb' - - 'spec/flipper_spec.rb' - - 'spec/flipper_integration_spec.rb' - -# Offense count: 1 -Security/Eval: - Exclude: - - 'flipper.gemspec' - -# Offense count: 5 -Security/MarshalLoad: - Exclude: - - '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: - Exclude: - - 'lib/flipper/adapters/memoizable.rb' - - 'lib/flipper/gates/boolean.rb' - - 'lib/flipper/typecast.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Style/EmptyLambdaParameter: - Exclude: - - '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 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: format, sprintf, percent -Style/FormatString: - Exclude: - - 'lib/flipper/instrumentation/log_subscriber.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/MethodMissingSuper: - Exclude: - - 'lib/flipper/types/actor.rb' - -# Offense count: 1 -Style/MissingRespondToMissing: - Exclude: - - '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/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 21d0e4ed5..5599ddda4 100644 --- a/Gemfile +++ b/Gemfile @@ -16,13 +16,10 @@ gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.3.11'}" gem 'rails', "~> #{ENV['RAILS_VERSION'] || '6.0.0'}" gem 'minitest', '~> 5.8' gem 'minitest-documentation' -gem 'rubocop', '~> 0.79.0' -gem 'rubocop-rspec', '~> 1.38.0' gem 'webmock', '~> 3.0' group(:guard) do gem 'guard', '~> 2.15' - gem 'guard-rubocop', '~> 1.3' gem 'guard-rspec', '~> 4.5' gem 'guard-bundler', '~> 2.2' gem 'guard-coffeescript', '~> 2.0' diff --git a/Guardfile b/Guardfile index b33cd0568..8c0410306 100644 --- a/Guardfile +++ b/Guardfile @@ -35,11 +35,3 @@ sass_options = { output: 'lib/flipper/ui/public/css', } guard 'sass', sass_options - -rubo_options = { - all_on_start: false, -} -guard :rubocop, rubo_options do - watch(/.+\.rb$/) - watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) } -end diff --git a/Rakefile b/Rakefile index 63751c99f..3efafd35a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,6 @@ #!/usr/bin/env rake $LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'rake/testtask' -require 'rubocop/rake_task' require 'flipper/version' # gem install pkg/*.gem @@ -50,6 +49,4 @@ Rake::TestTask.new(:test_rails) do |t| t.warning = false end -RuboCop::RakeTask.new - -task default: [:spec, :test, :test_rails, :rubocop] +task default: [:spec, :test, :test_rails] diff --git a/docs/DockerCompose.md b/docs/DockerCompose.md index 833cd07d3..bfa0291f2 100644 --- a/docs/DockerCompose.md +++ b/docs/DockerCompose.md @@ -11,7 +11,6 @@ new contributor could start working on code with a minumum efforts. 1. Install gems `docker-compose run --rm app bundle install` 1. Run specs `docker-compose run --rm app bundle exec rspec` 1. Run tests `docker-compose run --rm app bundle exec rake test` -1. Clear and check files with Rubocop `docker-compose run --rm app bundle exec rubocop -D` 1. Optional: log in to container an using a `bash` shell for running specs ```sh docker-compose run --rm app bash diff --git a/flipper-active_record.gemspec b/flipper-active_record.gemspec index ce144e115..187bbd074 100644 --- a/flipper-active_record.gemspec +++ b/flipper-active_record.gemspec @@ -18,7 +18,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) # rubocop:disable Layout/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_record_files) 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 d7bc5a6d9..fc35851b6 100644 --- a/flipper-active_support_cache_store.gemspec +++ b/flipper-active_support_cache_store.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_active_support_cache_store_files) + ['lib/flipper/version.rb'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_support_cache_store_files) # rubocop:disable Layout/LineLength + 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.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 654bc4ef1..35842f27f 100644 --- a/flipper-api.gemspec +++ b/flipper-api.gemspec @@ -12,8 +12,8 @@ Gem::Specification.new do |gem| gem.summary = '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'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_api_files) # rubocop:disable Layout/LineLength + 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.name = 'flipper-api' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-cloud.gemspec b/flipper-cloud.gemspec index 8a05d9cdc..95fa3f3aa 100644 --- a/flipper-cloud.gemspec +++ b/flipper-cloud.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |gem| '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) # rubocop:disable Layout/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_cloud_files) gem.name = 'flipper-cloud' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-dalli.gemspec b/flipper-dalli.gemspec index 6bffbc610..076850425 100644 --- a/flipper-dalli.gemspec +++ b/flipper-dalli.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_dalli_files) + ['lib/flipper/version.rb'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_dalli_files) # rubocop:disable Layout/LineLength + 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.name = 'flipper-dalli' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-moneta.gemspec b/flipper-moneta.gemspec index e53bd755b..e1cdef480 100644 --- a/flipper-moneta.gemspec +++ b/flipper-moneta.gemspec @@ -12,8 +12,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'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_moneta_files) # rubocop:disable Layout/LineLength + 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.name = 'flipper-moneta' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-mongo.gemspec b/flipper-mongo.gemspec index 21af7be96..64493596a 100644 --- a/flipper-mongo.gemspec +++ b/flipper-mongo.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_mongo_files) + ['lib/flipper/version.rb'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_mongo_files) # rubocop:disable Layout/LineLength + 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.name = 'flipper-mongo' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-redis.gemspec b/flipper-redis.gemspec index 6e66e229e..b35436ed8 100644 --- a/flipper-redis.gemspec +++ b/flipper-redis.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_redis_files) + ['lib/flipper/version.rb'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_redis_files) # rubocop:disable Layout/LineLength + 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.name = 'flipper-redis' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-rollout.gemspec b/flipper-rollout.gemspec index 417936b58..9bb31580e 100644 --- a/flipper-rollout.gemspec +++ b/flipper-rollout.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_rollout_files) + ['lib/flipper/version.rb'] # rubocop:disable Layout/LineLength - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_rollout_files) # rubocop:disable Layout/LineLength + 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.name = 'flipper-rollout' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-sequel.gemspec b/flipper-sequel.gemspec index 073921dd0..c3c3172c7 100644 --- a/flipper-sequel.gemspec +++ b/flipper-sequel.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| '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) # rubocop:disable Layout/LineLength + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_sequel_files) gem.name = 'flipper-sequel' gem.require_paths = ['lib'] gem.version = Flipper::VERSION diff --git a/flipper-ui.gemspec b/flipper-ui.gemspec index 91aff878c..a5bc3ff26 100644 --- a/flipper-ui.gemspec +++ b/flipper-ui.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |gem| 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'] # rubocop:disable Layout/LineLength + 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.name = 'flipper-ui' gem.require_paths = ['lib'] diff --git a/lib/flipper.rb b/lib/flipper.rb index 654a7d65a..db687f184 100644 --- a/lib/flipper.rb +++ b/lib/flipper.rb @@ -1,7 +1,7 @@ require "forwardable" module Flipper - extend self # rubocop:disable Style/ModuleFunction + extend self extend Forwardable # Private: The namespace for all instrumented events. diff --git a/lib/flipper/feature.rb b/lib/flipper/feature.rb index 909bd75df..e7e94dd87 100644 --- a/lib/flipper/feature.rb +++ b/lib/flipper/feature.rb @@ -5,7 +5,7 @@ require 'flipper/gate_values' module Flipper - class Feature # rubocop:disable Metrics/ClassLength + class Feature # Private: The name of feature instrumentation events. InstrumentationName = "feature_operation.#{InstrumentationNamespace}".freeze diff --git a/lib/flipper/middleware/memoizer.rb b/lib/flipper/middleware/memoizer.rb index 3fb2ed87f..308e55b6e 100644 --- a/lib/flipper/middleware/memoizer.rb +++ b/lib/flipper/middleware/memoizer.rb @@ -23,7 +23,7 @@ class Memoizer # def initialize(app, opts = {}) if opts.is_a?(Flipper::DSL) || opts.is_a?(Proc) - raise 'Flipper::Middleware::Memoizer no longer initializes with a flipper instance or block. Read more at: https://git.io/vSo31.' # rubocop:disable Layout/LineLength + raise 'Flipper::Middleware::Memoizer no longer initializes with a flipper instance or block. Read more at: https://git.io/vSo31.' end @app = app diff --git a/lib/flipper/test/shared_adapter_test.rb b/lib/flipper/test/shared_adapter_test.rb index 5480bf65e..292ab82dc 100644 --- a/lib/flipper/test/shared_adapter_test.rb +++ b/lib/flipper/test/shared_adapter_test.rb @@ -1,4 +1,3 @@ -# rubocop:disable Metrics/ModuleLength module Flipper module Test module SharedAdapterTests diff --git a/lib/flipper/ui/action.rb b/lib/flipper/ui/action.rb index a1f0f6f1d..8764bdfbc 100644 --- a/lib/flipper/ui/action.rb +++ b/lib/flipper/ui/action.rb @@ -207,7 +207,7 @@ def view_without_layout(name) def view(name) path = views_path.join("#{name}.erb") raise "Template does not exist: #{path}" unless path.exist? - eval(Erubi::Engine.new(path.read, escape: true).src) # rubocop:disable Security/Eval + eval(Erubi::Engine.new(path.read, escape: true).src) end # Internal: The path the app is mounted at. diff --git a/lib/flipper/ui/configuration.rb b/lib/flipper/ui/configuration.rb index dc13fa87d..cc768861b 100644 --- a/lib/flipper/ui/configuration.rb +++ b/lib/flipper/ui/configuration.rb @@ -56,9 +56,9 @@ class Configuration def initialize @actors = Option.new("Actors", "Enable actors using the form above.") @groups = Option.new("Groups", "Enable groups using the form above.") - @percentage_of_actors = Option.new("Percentage of Actors", "Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") # rubocop:disable Layout/LineLength - @percentage_of_time = Option.new("Percentage of Time", "Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") # rubocop:disable Layout/LineLength - @delete = Option.new("Danger Zone", "Deleting a feature removes it from the list of features and disables it for everyone.") # rubocop:disable Layout/LineLength + @percentage_of_actors = Option.new("Percentage of Actors", "Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") + @percentage_of_time = Option.new("Percentage of Time", "Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") + @delete = Option.new("Danger Zone", "Deleting a feature removes it from the list of features and disables it for everyone.") @banner_text = nil @banner_class = 'danger' @feature_creation_enabled = true diff --git a/spec/flipper/adapter_spec.rb b/spec/flipper/adapter_spec.rb index 1eec522bb..d74f59bbe 100644 --- a/spec/flipper/adapter_spec.rb +++ b/spec/flipper/adapter_spec.rb @@ -16,7 +16,7 @@ describe '.default_config' do it 'returns default config' do adapter_class = Class.new do - include Flipper::Adapter # rubocop:disable RSpec/DescribedClass + include Flipper::Adapter end expect(adapter_class.default_config).to eq(default_config) end @@ -25,7 +25,7 @@ describe '#default_config' do it 'returns default config' do adapter_class = Class.new do - include Flipper::Adapter # rubocop:disable RSpec/DescribedClass + include Flipper::Adapter end expect(adapter_class.new.default_config).to eq(default_config) end diff --git a/spec/flipper/feature_spec.rb b/spec/flipper/feature_spec.rb index b5ee9a774..78b349009 100644 --- a/spec/flipper/feature_spec.rb +++ b/spec/flipper/feature_spec.rb @@ -208,7 +208,7 @@ percentage_of_time => percentage_of_time, percentage_of_actors => percentage_of_actors, }.each do |thing, wrapped_thing| - it "always instruments #{thing.inspect} as #{wrapped_thing.class} for enable" do # rubocop:disable RSpec/RepeatedDescription + it "always instruments #{thing.inspect} as #{wrapped_thing.class} for enable" do Flipper.register(:admins) {} subject.enable(thing) @@ -297,7 +297,7 @@ user => actor, actor => actor, }.each do |thing, wrapped_thing| - it "always instruments #{thing.inspect} as #{wrapped_thing.class} for enabled?" do # rubocop:disable RSpec/RepeatedDescription + it "always instruments #{thing.inspect} as #{wrapped_thing.class} for enabled?" do subject.enabled?(thing) event = instrumenter.events.last diff --git a/spec/flipper/ui/actions/actors_gate_spec.rb b/spec/flipper/ui/actions/actors_gate_spec.rb index 3e3f1a711..cf51a9a33 100644 --- a/spec/flipper/ui/actions/actors_gate_spec.rb +++ b/spec/flipper/ui/actions/actors_gate_spec.rb @@ -73,23 +73,19 @@ context 'empty value' do let(:value) { '' } - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search/actors?error=%22%22+is+not+a+valid+actor+value.') end - # rubocop:enable Layout/LineLength end context 'nil value' do let(:value) { nil } - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search/actors?error=%22%22+is+not+a+valid+actor+value.') end - # rubocop:enable Layout/LineLength end end end diff --git a/spec/flipper/ui/actions/features_spec.rb b/spec/flipper/ui/actions/features_spec.rb index 9e4b382d8..72f2efdf9 100644 --- a/spec/flipper/ui/actions/features_spec.rb +++ b/spec/flipper/ui/actions/features_spec.rb @@ -123,12 +123,10 @@ expect(flipper.features.map(&:key)).to eq([]) end - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/new?error=%22%22+is+not+a+valid+feature+name.') end - # rubocop:enable Layout/LineLength end context 'nil feature name' do @@ -138,12 +136,10 @@ expect(flipper.features.map(&:key)).to eq([]) end - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/new?error=%22%22+is+not+a+valid+feature+name.') end - # rubocop:enable Layout/LineLength end end end diff --git a/spec/flipper/ui/actions/groups_gate_spec.rb b/spec/flipper/ui/actions/groups_gate_spec.rb index 570f3dc8d..8d1968bb0 100644 --- a/spec/flipper/ui/actions/groups_gate_spec.rb +++ b/spec/flipper/ui/actions/groups_gate_spec.rb @@ -72,34 +72,28 @@ context 'unknown group name' do let(:group_name) { 'not_here' } - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search/groups?error=The+group+named+%22not_here%22+has+not+been+registered.') end - # rubocop:enable Layout/LineLength end context 'empty group name' do let(:group_name) { '' } - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search/groups?error=The+group+named+%22%22+has+not+been+registered.') end - # rubocop:enable Layout/LineLength end context 'nil group name' do let(:group_name) { nil } - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search/groups?error=The+group+named+%22%22+has+not+been+registered.') end - # rubocop:enable Layout/LineLength end end end diff --git a/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb b/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb index 18c78335a..3f515679d 100644 --- a/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb +++ b/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb @@ -41,12 +41,10 @@ expect(flipper[:search].percentage_of_actors_value).to be(0) end - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search?error=Invalid+percentage+of+actors+value%3A+value+must+be+a+positive+number+less+than+or+equal+to+100%2C+but+was+555') end - # rubocop:enable Layout/LineLength end end end diff --git a/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb b/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb index 4ca9546f9..47013afd6 100644 --- a/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb +++ b/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb @@ -41,12 +41,10 @@ expect(flipper[:search].percentage_of_time_value).to be(0) end - # rubocop:disable Layout/LineLength it 'redirects back to feature' do expect(last_response.status).to be(302) expect(last_response.headers['Location']).to eq('/features/search?error=Invalid+percentage+of+time+value%3A+value+must+be+a+positive+number+less+than+or+equal+to+100%2C+but+was+555') end - # rubocop:enable Layout/LineLength end end end diff --git a/spec/flipper/ui/configuration_spec.rb b/spec/flipper/ui/configuration_spec.rb index 78d6252aa..32a2517ac 100644 --- a/spec/flipper/ui/configuration_spec.rb +++ b/spec/flipper/ui/configuration_spec.rb @@ -25,21 +25,21 @@ describe "#percentage_of_actors" do it "has default text" do expect(configuration.percentage_of_actors.title).to eq("Percentage of Actors") - expect(configuration.percentage_of_actors.description).to eq("Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") # rubocop:disable Layout/LineLength + expect(configuration.percentage_of_actors.description).to eq("Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") end end describe "#percentage_of_time" do it "has default text" do expect(configuration.percentage_of_time.title).to eq("Percentage of Time") - expect(configuration.percentage_of_time.description).to eq("Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") # rubocop:disable Layout/LineLength + expect(configuration.percentage_of_time.description).to eq("Percentage of actors functions independently of percentage of time. If you enable 50% of Actors and 25% of Time then the feature will always be enabled for 50% of users and occasionally enabled 25% of the time for everyone.") end end describe "#delete" do it "has default text" do expect(configuration.delete.title).to eq("Danger Zone") - expect(configuration.delete.description).to eq("Deleting a feature removes it from the list of features and disables it for everyone.") # rubocop:disable Layout/LineLength + expect(configuration.delete.description).to eq("Deleting a feature removes it from the list of features and disables it for everyone.") end end