From e0a411ec14bf0bc637c25f123462f32d451878d0 Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Thu, 14 Feb 2019 18:58:50 +0100 Subject: [PATCH 1/6] Update rubocop, add .rubocop_todo.yml --- .rubocop.yml | 3 + .rubocop_todo.yml | 606 ++++++++++++++++++++++++++++++++++++++++++++++ Gemfile.lock | 12 +- 3 files changed, 615 insertions(+), 6 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 18d1124aa..9df3c7478 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ +inherit_from: .rubocop_todo.yml + AllCops: Exclude: - lib/generators/**/* + - vendor/bundle/**/* LineLength: Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..d11a47b81 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,606 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2019-02-14 18:57:44 +0100 using RuboCop version 0.64.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: 2 +# Cop supports --auto-correct. +# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Include: **/*.gemfile, **/Gemfile, **/gems.rb +Bundler/OrderedGems: + Exclude: + - 'gemfiles/rails_4.2.gemfile' + - 'gemfiles/rails_5.0.gemfile' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'rpush.gemspec' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: + Exclude: + - 'rpush.gemspec' + +# Offense count: 80 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/AlignHash: + Exclude: + - 'lib/rpush/client/active_model/pushy/notification.rb' + - 'lib/rpush/daemon/apns2/delivery.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + - 'lib/rpush/daemon/constants.rb' + - 'lib/rpush/daemon/gcm/delivery.rb' + - 'lib/rpush/daemon/service_config_methods.rb' + - 'lib/rpush/daemon/wns/delivery.rb' + - 'lib/rpush/daemon/wpns/delivery.rb' + - 'spec/functional/apns2_spec.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_parameter, with_fixed_indentation +Layout/AlignParameters: + Exclude: + - 'lib/rpush/daemon/apns2/delivery.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth. +# SupportedStyles: case, end +Layout/CaseIndentation: + Exclude: + - 'lib/rpush/client/active_model/gcm/notification.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: leading, trailing +Layout/DotPosition: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 38 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'rpush.gemspec' + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundAccessModifier: + Exclude: + - 'lib/rpush/daemon/apns2/delivery.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'lib/rpush/daemon/dispatcher/apns_http2.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'spec/unit/daemon/store/active_record/reconnectable_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/IndentArray: + Exclude: + - 'lib/rpush/daemon/store/active_record/reconnectable.rb' + - 'spec/unit/daemon/store/active_record/reconnectable_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/IndentHash: + Exclude: + - 'lib/rpush/client/active_model/gcm/notification.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent +Layout/IndentHeredoc: + Exclude: + - 'lib/rpush/daemon.rb' + - 'lib/tasks/test.rake' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, rails +Layout/IndentationConsistency: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Exclude: + - 'examples/rpush.god' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/InitialIndentation: + Exclude: + - 'spec/unit/reflection_collection_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/LeadingBlankLines: + Exclude: + - 'lib/rpush/client/redis.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineHashBraceLayout: + Exclude: + - 'spec/functional/apns2_spec.rb' + - 'spec/unit/daemon/gcm/delivery_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineMethodCallBraceLayout: + Exclude: + - 'lib/rpush/daemon/apns2/delivery.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + - 'spec/unit/daemon/store/active_record_spec.rb' + - 'spec/unit/daemon/store/redis_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Layout/MultilineMethodCallIndentation: + Exclude: + - 'lib/rpush/daemon/wns/toast_request.rb' + - 'lib/rpush/daemon/wpns/delivery.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceAroundOperators: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'lib/rpush/daemon/apns2/delivery.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'spec/unit/notification_shared.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'lib/rpush/client/redis/app.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + +# Offense count: 5 +Lint/AmbiguousBlockAssociation: + Exclude: + - 'lib/rpush/cli.rb' + - 'lib/rpush/daemon.rb' + - 'lib/rpush/daemon/apns/feedback_receiver.rb' + - 'lib/rpush/daemon/app_runner.rb' + +# Offense count: 6 +Lint/IneffectiveAccessModifier: + Exclude: + - 'lib/rpush/daemon.rb' + +# Offense count: 1 +Lint/NestedMethodDefinition: + Exclude: + - 'spec/unit/daemon/apns/feedback_receiver_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/UnneededCopDisableDirective: + Exclude: + - 'lib/rpush/daemon/gcm/delivery.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/UnneededRequireStatement: + Exclude: + - 'lib/rpush/daemon.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'lib/rpush/client/active_model/adm/notification.rb' + - 'lib/rpush/client/active_model/apns/notification.rb' + - 'lib/rpush/client/active_model/gcm/notification.rb' + +# Offense count: 2 +# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods. +Lint/UselessAccessModifier: + Exclude: + - 'lib/rpush/daemon.rb' + - 'lib/rpush/daemon/wns/post_request.rb' + +# Offense count: 4 +Lint/UselessAssignment: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 68 +# Configuration parameters: CountComments, ExcludedMethods. +# ExcludedMethods: refine +Metrics/BlockLength: + Max: 326 + +# Offense count: 1 +# Configuration parameters: Blacklist. +# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +Naming/HeredocDelimiterNaming: + Exclude: + - 'lib/rpush/daemon.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyleForLeadingUnderscores. +# SupportedStylesForLeadingUnderscores: disallowed, required, optional +Naming/MemoizedInstanceVariableName: + Exclude: + - 'lib/rpush/daemon/dispatcher/apns_http2.rb' + +# Offense count: 1 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +Naming/UncommunicativeBlockParamName: + Exclude: + - 'lib/rpush/daemon/adm/delivery.rb' + +# Offense count: 1 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: io, id, to, by, on, in, at, ip, db +Naming/UncommunicativeMethodParamName: + Exclude: + - 'lib/rpush/daemon/loggable.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: snake_case, camelCase +Naming/VariableName: + Exclude: + - 'lib/rpush/daemon/adm/delivery.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Performance/RedundantBlockCall: + Exclude: + - 'bm/bench.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Performance/RegexpMatch: + Exclude: + - 'lib/rpush/daemon/retry_header_parser.rb' + - 'lib/rpush/daemon/tcp_connection.rb' + - 'spec/support/active_record_setup.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect. +Performance/TimesMap: + Exclude: + - 'spec/functional/apns_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect. +Security/JSONLoad: + Exclude: + - 'lib/rpush/daemon/rpc/server.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: prefer_alias, prefer_alias_method +Style/Alias: + Exclude: + - 'lib/rpush/daemon/ring_buffer.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: braces, no_braces, context_dependent +Style/BracesAroundHashParameters: + Exclude: + - 'lib/rpush/daemon/apnsp8/token.rb' + - 'spec/functional/apns2_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Keywords. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW +Style/CommentAnnotation: + Exclude: + - 'lib/rpush/daemon/apnsp8/delivery.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/rpush/client/redis/notification.rb' + - 'lib/rpush/daemon/string_helpers.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'lib/rpush/daemon/store/redis.rb' + - 'spec/unit/daemon/app_runner_spec.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/Encoding: + Exclude: + - 'lib/rpush/cli.rb' + - 'lib/rpush/daemon.rb' + - 'lib/rpush/daemon/apns/feedback_receiver.rb' + - 'lib/rpush/daemon/app_runner.rb' + - 'rpush.gemspec' + +# Offense count: 2 +Style/EvalWithLocation: + Exclude: + - 'lib/rpush/deprecatable.rb' + - 'lib/rpush/reflection_collection.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'rpush.gemspec' + +# Offense count: 3 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + Exclude: + - 'lib/rpush/daemon/proc_title.rb' + +# Offense count: 224 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: when_needed, always, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 6 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/rpush/daemon.rb' + - 'lib/rpush/daemon/adm/delivery.rb' + - 'lib/rpush/daemon/app_runner.rb' + - 'lib/rpush/daemon/tcp_connection.rb' + - 'spec/unit/daemon/apns/feedback_receiver_spec.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'lib/rpush/client/active_model/apns/notification.rb' + - 'lib/rpush/daemon/delivery.rb' + - 'lib/rpush/daemon/tcp_connection.rb' + - 'lib/rpush/embed.rb' + - 'spec/support/simplecov_helper.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: InverseMethods, InverseBlocks. +Style/InverseMethods: + Exclude: + - 'lib/rpush/daemon/adm/delivery.rb' + +# Offense count: 1 +Style/MixinUsage: + Exclude: + - 'spec/spec_helper.rb' + +# Offense count: 30 +# Cop supports --auto-correct. +Style/MultilineIfModifier: + Enabled: false + +# Offense count: 1 +Style/MultipleComparison: + Exclude: + - 'lib/rpush/client/active_model/apns/notification.rb' + +# Offense count: 33 +# Cop supports --auto-correct. +Style/MutableConstant: + Enabled: false + +# Offense count: 11 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/rpush/daemon.rb' + - 'lib/rpush/daemon/apnsp8/delivery.rb' + - 'lib/rpush/daemon/app_runner.rb' + - 'lib/rpush/daemon/dispatcher/apns_tcp.rb' + - 'lib/rpush/daemon/feeder.rb' + - 'lib/rpush/daemon/store/redis.rb' + - 'lib/rpush/daemon/synchronizer.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/OrAssignment: + Exclude: + - 'lib/rpush/daemon/wns/delivery.rb' + - 'lib/rpush/daemon/wpns/delivery.rb' + +# Offense count: 23 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'lib/rpush/cli.rb' + - 'lib/rpush/client/active_model/apns/app.rb' + - 'lib/rpush/client/active_model/apnsp8/app.rb' + - 'lib/rpush/daemon/gcm/delivery.rb' + - 'lib/rpush/daemon/signal_handler.rb' + - 'lib/tasks/quality.rake' + - 'spec/unit/client/active_record/notification_spec.rb' + - 'spec/unit/daemon/adm/delivery_spec.rb' + - 'spec/unit/daemon/gcm/delivery_spec.rb' + - 'spec/unit/daemon/store/active_record_spec.rb' + - 'spec/unit/daemon/store/redis_spec.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'lib/rpush/cli.rb' + - 'lib/rpush/daemon/batch.rb' + - 'lib/rpush/daemon/rpc/server.rb' + - 'lib/rpush/daemon/store/active_record/reconnectable.rb' + - 'lib/rpush/daemon/tcp_connection.rb' + - 'lib/rpush/reflectable.rb' + - 'spec/support/active_record_setup.rb' + +# Offense count: 17 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. +# Whitelist: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/rpush/client/active_model/apns/notification.rb' + - 'lib/rpush/daemon/apns/feedback_receiver.rb' + - 'lib/rpush/daemon/app_runner.rb' + - 'lib/rpush/daemon/dispatcher/apns_tcp.rb' + - 'lib/rpush/daemon/dispatcher/tcp.rb' + - 'lib/rpush/daemon/dispatcher_loop.rb' + - 'lib/rpush/daemon/feeder.rb' + - 'lib/rpush/daemon/interruptible_sleep.rb' + - 'lib/rpush/daemon/rpc/server.rb' + - 'lib/rpush/daemon/signal_handler.rb' + - 'lib/rpush/daemon/tcp_connection.rb' + - 'lib/rpush/embed.rb' + - 'lib/rpush/logger.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Exclude: + - 'spec/functional/apns2_spec.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'lib/rpush/configuration.rb' + - 'lib/rpush/daemon/store/active_record.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/UnlessElse: + Exclude: + - 'lib/rpush/daemon/store/active_record.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/WhileUntilDo: + Exclude: + - 'lib/rpush/daemon/apnsp8/delivery.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/WhileUntilModifier: + Exclude: + - 'lib/rpush/daemon/apnsp8/delivery.rb' + - 'spec/functional/synchronization_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/ZeroLengthPredicate: + Exclude: + - 'lib/rpush/daemon/app_runner.rb' + - 'lib/rpush/daemon/dispatcher/apns_tcp.rb' diff --git a/Gemfile.lock b/Gemfile.lock index 49ed7c298..b41658580 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -57,7 +57,7 @@ GEM http-2 (0.9.0) i18n (1.2.0) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.1) + jaro_winkler (1.5.2) json (2.1.0) jwt (2.1.0) loofah (2.2.3) @@ -83,8 +83,8 @@ GEM http-2 (= 0.9.0) nokogiri (1.10.1) mini_portile2 (~> 2.4.0) - parallel (1.12.1) - parser (2.5.3.0) + parallel (1.13.0) + parser (2.6.0.0) ast (~> 2.4.0) pg (1.1.4) powerpack (0.1.2) @@ -120,14 +120,14 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.4.0) rspec-support (3.4.1) - rubocop (0.58.1) + rubocop (0.64.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) + unicode-display_width (~> 1.4.0) ruby-progressbar (1.10.0) simplecov (0.13.0) docile (~> 1.1.0) @@ -141,7 +141,7 @@ GEM timecop (0.9.1) tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.4.0) + unicode-display_width (1.4.1) PLATFORMS ruby From 5cd45cc06e91e143373921212a5fe036acd6c54b Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Thu, 14 Feb 2019 19:24:04 +0100 Subject: [PATCH 2/6] Add rubocop rake task --- Rakefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Rakefile b/Rakefile index bce9fb999..20c85ca3f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ require "rake" require "bundler/gem_tasks" require "rspec/core/rake_task" +require 'rubocop/rake_task' + Dir["lib/tasks/*.rake"].each { |rake| load rake } RSpec::Core::RakeTask.new(:spec) do |spec| @@ -8,6 +10,8 @@ RSpec::Core::RakeTask.new(:spec) do |spec| spec.rspec_opts = ['--backtrace'] end +RuboCop::RakeTask.new + if ENV['TRAVIS'] && ENV['QUALITY'] != 'true' task default: 'spec' elsif RUBY_VERSION > '2.2.2' && defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' From 81345271a72b5f6a7ec39174a1b8afa97ca7c5d0 Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Thu, 14 Feb 2019 19:24:22 +0100 Subject: [PATCH 3/6] Add Linting stage to Travis --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4b4111419..e29dcca6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,3 +65,9 @@ matrix: rvm: 2.3.8 - gemfile: gemfiles/rails_6.0.gemfile rvm: 2.4.5 + +jobs: + include: + - stage: Lint + rvm: 2.6.1 + script: bundle exec rake rubocop From 754666d6c5d6c445dfa988371e2be13376e4fe67 Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Thu, 14 Feb 2019 19:31:34 +0100 Subject: [PATCH 4/6] Remove cane, it's kinda-sorta deprecated See also their README https://github.com/square/cane/blob/c8d6ce4e0092e5f677d3a2f409db7566e5d82136/README.md --- Gemfile.lock | 3 --- lib/tasks/quality.rake | 35 ----------------------------------- rpush.gemspec | 1 - 3 files changed, 39 deletions(-) delete mode 100644 lib/tasks/quality.rake diff --git a/Gemfile.lock b/Gemfile.lock index b41658580..2aa378e24 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,8 +42,6 @@ GEM ast (2.4.0) builder (3.2.3) byebug (10.0.2) - cane (3.0.0) - parallel codeclimate-test-reporter (1.0.9) simplecov (<= 0.13) concurrent-ruby (1.1.4) @@ -149,7 +147,6 @@ PLATFORMS DEPENDENCIES appraisal byebug - cane codeclimate-test-reporter database_cleaner modis (>= 2.0) diff --git a/lib/tasks/quality.rake b/lib/tasks/quality.rake deleted file mode 100644 index 45faeaab3..000000000 --- a/lib/tasks/quality.rake +++ /dev/null @@ -1,35 +0,0 @@ -begin - require 'cane/rake_task' - - desc 'Run cane to check quality metrics' - Cane::RakeTask.new(:cane_quality) do |cane| - cane.add_threshold 'coverage/covered_percent', :>=, 80 - cane.no_style = false - cane.style_measure = 1000 - cane.no_doc = true - cane.abc_max = 22 - end - - namespace :spec do - task cane: %w(spec cane_quality) - end -rescue LoadError - warn "cane not available." - - namespace :spec do - task cane: ['spec'] - end -end - -begin - require 'rubocop/rake_task' - t = RuboCop::RakeTask.new - t.options << '-D' -rescue LoadError - warn 'rubocop not available.' - task rubocop: ['spec'] -end - -namespace :spec do - task quality: %w(cane rubocop) -end diff --git a/rpush.gemspec b/rpush.gemspec index 89a645430..6a73d77b4 100644 --- a/rpush.gemspec +++ b/rpush.gemspec @@ -37,7 +37,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'rpush-redis', '~> 1.0' s.add_development_dependency 'appraisal' - s.add_development_dependency 'cane' s.add_development_dependency 'codeclimate-test-reporter' s.add_development_dependency 'simplecov' s.add_development_dependency 'rubocop' From 96c37a439a10b9ef6511a77f50266b535699231e Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Thu, 14 Feb 2019 19:36:35 +0100 Subject: [PATCH 5/6] Rubocop in parallel --- Rakefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index 20c85ca3f..fead82a50 100644 --- a/Rakefile +++ b/Rakefile @@ -10,12 +10,11 @@ RSpec::Core::RakeTask.new(:spec) do |spec| spec.rspec_opts = ['--backtrace'] end -RuboCop::RakeTask.new - -if ENV['TRAVIS'] && ENV['QUALITY'] != 'true' - task default: 'spec' -elsif RUBY_VERSION > '2.2.2' && defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' - task default: 'spec:quality' -else - task default: 'spec' +RuboCop::RakeTask.new.tap do |task| + if RUBY_ENGINE == 'ruby' && + RbConfig::CONFIG['host_os'] !~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ + task.options = %w[--parallel] + end end + +task default: 'spec' From 1d7104854236a2bf70f095850f950980cb3afd2d Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Thu, 14 Feb 2019 20:01:57 +0100 Subject: [PATCH 6/6] Exclude vendor directory on Travis --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index 9df3c7478..c0b40c157 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml AllCops: Exclude: + - gemfiles/vendor/bundle/**/* # This dir only shows up on Travis - lib/generators/**/* - vendor/bundle/**/*