diff --git a/.rubocop.yml b/.rubocop.yml index 18d1124aa..c0b40c157 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,10 @@ +inherit_from: .rubocop_todo.yml + AllCops: Exclude: + - gemfiles/vendor/bundle/**/* # This dir only shows up on Travis - 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/.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 diff --git a/Gemfile.lock b/Gemfile.lock index 49ed7c298..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) @@ -57,7 +55,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 +81,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 +118,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 +139,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 @@ -149,7 +147,6 @@ PLATFORMS DEPENDENCIES appraisal byebug - cane codeclimate-test-reporter database_cleaner modis (>= 2.0) diff --git a/Rakefile b/Rakefile index bce9fb999..fead82a50 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,10 +10,11 @@ RSpec::Core::RakeTask.new(:spec) do |spec| spec.rspec_opts = ['--backtrace'] end -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' 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'