From b32252e841c32f691c8dfde58ed8034811787a02 Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Fri, 13 Jan 2023 09:28:43 -0500 Subject: [PATCH 1/2] getting package to build - remove codeclimate-test-reporter, as it's deprecated - fixe rubocop namespace issue in Rakefile - remove deprecated has_rdoc - add rubocop-rake and rubocop-rspec and regenerated config (exclusions are moved to .rubocop_todo.yml) - tighten resque version and made runtime dependency - fix unit tests by changing `be_true` to `be true` and same for false --- .rubocop.yml | 96 +---- .rubocop_todo.yml | 693 +++++++++++++++++++++++++++++++++ Gemfile | 1 - README.markdown | 1 - Rakefile | 2 +- resque-loner.gemspec | 5 +- spec/loner_spec.rb | 10 +- spec/spec_helper.rb | 3 - spec/support/redis_instance.rb | 2 +- 9 files changed, 707 insertions(+), 106 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 31f90ae..2d27a8d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,92 +1,4 @@ -# This configuration was generated by `rubocop --auto-gen-config` -# on 2014-03-20 16:42:32 -0400 using RuboCop version 0.19.1. -# 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: 1 -AmbiguousOperator: - Enabled: false - -# Offense count: 1 -AmbiguousRegexpLiteral: - Enabled: false - -# Offense count: 36 -# Configuration parameters: EnforcedStyle, SupportedStyles. -ClassAndModuleChildren: - Enabled: false - -# Offense count: 5 -ClassVars: - Enabled: false - -# Offense count: 75 -Documentation: - Enabled: false - -# Offense count: 20 -Encoding: - Enabled: false - -# Offense count: 1 -Eval: - Enabled: false - -# Offense count: 1 -FavorUnlessOverNegatedIf: - Enabled: false - -# Offense count: 2 -# Configuration parameters: Exclude. -FileName: - Enabled: false - -# Offense count: 27 -# Configuration parameters: AllowedVariables. -GlobalVars: - Enabled: false - -# Offense count: 1 -HandleExceptions: - Enabled: false - -# Offense count: 75 -LineLength: - Max: 161 - -# Offense count: 1 -# Configuration parameters: CountComments. -MethodLength: - Max: 17 - -# Offense count: 1 -ModuleFunction: - Enabled: false - -# Offense count: 2 -# Configuration parameters: EnforcedStyle, SupportedStyles. -RaiseArgs: - Enabled: false - -# Offense count: 3 -RedundantBegin: - Enabled: false - -# Offense count: 1 -UnlessElse: - Enabled: false - -# Offense count: 1 -UnreachableCode: - Enabled: false - -# Offense count: 5 -# Configuration parameters: EnforcedStyle, SupportedStyles. -VariableName: - Enabled: false - -# Offense count: 11 -Void: - Enabled: false +inherit_from: .rubocop_todo.yml +require: + - rubocop-rake + - rubocop-rspec diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..5e6ca80 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,693 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-01-13 13:53:49 UTC using RuboCop version 1.43.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: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemfile, **/Gemfile, **/gems.rb +Bundler/OrderedGems: + Exclude: + - 'Gemfile' + +# Offense count: 1 +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: + Exclude: + - 'resque-loner.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: outdent, indent +Layout/AccessModifierIndentation: + Exclude: + - 'bin/bundle' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'bin/cc-tddium-post-worker' + - 'bin/codeclimate-test-reporter' + - 'bin/htmldiff' + - 'bin/ldiff' + - 'bin/rake' + - 'bin/resque' + - 'bin/resque-web' + - 'bin/rspec' + - 'bin/rubocop' + - 'bin/ruby-parse' + - 'bin/ruby-rewrite' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment. +Layout/CommentIndentation: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'bin/bundle' + - 'lib/resque-ext/job.rb' + - 'lib/resque-ext/resque.rb' + - 'lib/resque-loner/helpers.rb' + - 'lib/resque-loner/unique_job.rb' + - 'test/test_helper.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'Gemfile' + - 'resque-loner.gemspec' + +# Offense count: 34 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'test/job_hooks_test.rb' + - 'test/job_plugins_test.rb' + - 'test/plugin_test.rb' + - 'test/test_helper.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'spec/loner_spec.rb' + - 'tasks/redis.rake' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'lib/resque-loner/unique_job.rb' + - 'test/resque_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/LeadingEmptyLines: + Exclude: + - 'test/airbrake_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/MultilineBlockLayout: + Exclude: + - 'resque-loner.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineMethodCallBraceLayout: + Exclude: + - 'test/airbrake_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'lib/resque-loner/unique_job.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceInsidePercentLiteralDelimiters: + Exclude: + - 'test/resque_test.rb' + - 'test/worker_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 4 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +Lint/AmbiguousBlockAssociation: + Exclude: + - 'test/plugin_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperator: + Exclude: + - 'test/test_helper.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousRegexpLiteral: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 50 +# Configuration parameters: AllowedMethods. +# AllowedMethods: enums +Lint/ConstantDefinitionInBlock: + Exclude: + - 'test/job_hooks_test.rb' + - 'test/job_plugins_test.rb' + - 'test/plugin_test.rb' + - 'test/worker_test.rb' + +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +Lint/DeprecatedClassMethods: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedImplicitNamespaces. +# AllowedImplicitNamespaces: Gem +Lint/RaiseException: + Exclude: + - 'test/test_helper.rb' + - 'test/worker_test.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Lint/RedundantStringCoercion: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 2 +# Configuration parameters: AllowComments, AllowNil. +Lint/SuppressedException: + Exclude: + - 'Rakefile' + - 'test/test_helper.rb' + +# Offense count: 1 +Lint/UnreachableCode: + Exclude: + - 'test/job_hooks_test.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'test/job_hooks_test.rb' + - 'test/job_plugins_test.rb' + - 'test/worker_test.rb' + +# Offense count: 11 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'spec/loner_spec.rb' + +# Offense count: 3 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 18 + +# Offense count: 19 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode. +# AllowedMethods: refine +Metrics/BlockLength: + Max: 458 + +# Offense count: 1 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 10 + +# Offense count: 4 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +Metrics/MethodLength: + Max: 17 + +# Offense count: 1 +# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +Metrics/PerceivedComplexity: + Max: 10 + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Migration/DepartmentName: + Exclude: + - 'spec/support/redis_instance.rb' + +# Offense count: 2 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src +# 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/resque-loner.rb' + - 'test/resque-web_test.rb' + +# Offense count: 1 +# Configuration parameters: ForbiddenDelimiters. +# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +Naming/HeredocDelimiterNaming: + Exclude: + - 'spec/support/redis_instance.rb' + +# Offense count: 12 +# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns. +# SupportedStyles: snake_case, camelCase +Naming/VariableName: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. +# SupportedStyles: snake_case, normalcase, non_integer +# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339 +Naming/VariableNumber: + Exclude: + - 'Gemfile' + +# Offense count: 5 +# Configuration parameters: CountAsOne. +RSpec/ExampleLength: + Max: 8 + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. +# DisallowedExamples: works +RSpec/ExampleWording: + Exclude: + - 'spec/loner_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: . +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + EnforcedStyle: each + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: + Exclude: + - 'spec/loner_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Rake/Desc: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 1 +Security/Eval: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 1 +Security/Open: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: prefer_alias, prefer_alias_method +Style/Alias: + Exclude: + - 'lib/resque-ext/job.rb' + - 'lib/resque-ext/resque.rb' + - 'test/test_helper.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: percent_q, bare_percent +Style/BarePercentLiterals: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# AllowedMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_a?, kind_of? +Style/ClassCheck: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 5 +Style/ClassVars: + Exclude: + - 'test/job_plugins_test.rb' + - 'test/worker_test.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/CommentedKeyword: + Exclude: + - 'lib/resque-loner/helpers.rb' + - 'lib/resque-loner/unique_job.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/resque-loner/legacy_helpers.rb' + - 'test/test_helper.rb' + +# Offense count: 7 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'lib/resque-ext/job.rb' + - 'lib/resque-ext/resque.rb' + - 'lib/resque-loner/helpers.rb' + - 'lib/resque-loner/unique_job.rb' + - 'tasks/redis.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/EmptyLiteral: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'test/job_hooks_test.rb' + - 'test/test_helper.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/Encoding: + Exclude: + - 'Gemfile' + - 'resque-loner.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/EvalWithLocation: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +Style/ExpandPathArguments: + Exclude: + - 'bin/bundle' + - 'bin/cc-tddium-post-worker' + - 'bin/codeclimate-test-reporter' + - 'bin/htmldiff' + - 'bin/ldiff' + - 'bin/rake' + - 'bin/resque' + - 'bin/resque-web' + - 'bin/rspec' + - 'bin/rubocop' + - 'bin/ruby-parse' + - 'bin/ruby-rewrite' + - 'resque-loner.gemspec' + - 'spec/spec_helper.rb' + +# Offense count: 25 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 27 +# Configuration parameters: AllowedVariables. +Style/GlobalVars: + Exclude: + - 'test/job_hooks_test.rb' + - 'test/test_helper.rb' + - 'test/worker_test.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Exclude: + - 'lib/resque-loner/helpers.rb' + - 'spec/support/redis_instance.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent +Style/HashSyntax: + Exclude: + - 'Rakefile' + - 'tasks/redis.rake' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Exclude: + - 'bin/bundle' + - 'lib/resque-loner/helpers.rb' + - 'lib/resque-loner/legacy_helpers.rb' + - 'spec/support/redis_instance.rb' + - 'tasks/redis.rake' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, Autocorrect. +# SupportedStyles: module_function, extend_self, forbidden +Style/ModuleFunction: + Exclude: + - 'test/plugin_test.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/resque-loner/version.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: both, prefix, postfix +Style/NegatedIf: + Exclude: + - 'test/test_helper.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/resque-loner/helpers.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/ParallelAssignment: + Exclude: + - 'test/test_helper.rb' + +# Offense count: 13 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'Rakefile' + - 'resque-loner.gemspec' + - 'tasks/redis.rake' + - 'test/plugin_test.rb' + - 'test/resque_test.rb' + - 'test/worker_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/PerlBackrefs: + Exclude: + - 'bin/bundle' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowedCompactTypes. +# SupportedStyles: compact, exploded +Style/RaiseArgs: + Exclude: + - 'test/test_helper.rb' + - 'test/worker_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantAssignment: + Exclude: + - 'lib/resque-loner/unique_job.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantBegin: + Exclude: + - 'bin/bundle' + - 'lib/resque-loner/helpers.rb' + - 'spec/support/redis_instance.rb' + - 'test/job_hooks_test.rb' + - 'test/plugin_test.rb' + - 'test/resque_test.rb' + - 'test/worker_test.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/RedundantInterpolation: + Exclude: + - 'tasks/redis.rake' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantParentheses: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantPercentQ: + Exclude: + - 'test/worker_test.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'lib/resque-loner/helpers.rb' + +# Offense count: 16 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: only_raise, only_fail, semantic +Style/SignalException: + Exclude: + - 'lib/resque-loner/legacy_helpers.rb' + - 'spec/loner_spec.rb' + - 'spec/support/redis_instance.rb' + - 'test/job_hooks_test.rb' + - 'test/job_plugins_test.rb' + - 'test/test_helper.rb' + - 'test/worker_test.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: RequireEnglish, EnforcedStyle. +# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names +Style/SpecialGlobalVars: + Exclude: + - 'bin/bundle' + - 'resque-loner.gemspec' + +# Offense count: 7 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'tasks/redis.rake' + - 'tasks/resque.rake' + - 'test/test_helper.rb' + +# Offense count: 112 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'bin/bundle' + - 'bin/cc-tddium-post-worker' + - 'bin/codeclimate-test-reporter' + - 'bin/htmldiff' + - 'bin/ldiff' + - 'bin/rake' + - 'bin/resque' + - 'bin/resque-web' + - 'bin/rspec' + - 'bin/rubocop' + - 'bin/ruby-parse' + - 'bin/ruby-rewrite' + - 'tasks/redis.rake' + - 'test/resque_test.rb' + +# Offense count: 18 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments. +# AllowedMethods: define_method +Style/SymbolProc: + Exclude: + - 'test/plugin_test.rb' + - 'test/resque_failure_redis_test.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/UnlessElse: + Exclude: + - 'lib/resque-loner/helpers.rb' + +# Offense count: 13 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 190 diff --git a/Gemfile b/Gemfile index ae554db..70163f0 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,3 @@ source 'http://rubygems.org' gemspec gem 'debugger', group: :development, platform: :mri_19 -gem 'codeclimate-test-reporter', group: :test, require: nil diff --git a/README.markdown b/README.markdown index cafadd6..adac91f 100644 --- a/README.markdown +++ b/README.markdown @@ -2,7 +2,6 @@ Resque-Loner ====== [![Build Status](https://secure.travis-ci.org/resque/resque-loner.png?branch=master)](https://travis-ci.org/resque/resque-loner) -[![Code Climate](https://codeclimate.com/github/resque/resque-loner.png)](https://codeclimate.com/github/resque/resque-loner) [![Gem Version](https://badge.fury.io/rb/resque-loner.png)](http://badge.fury.io/rb/resque-loner) Resque-Loner is a plugin for defunkt/resque which adds unique jobs to resque: Only one job with the same payload per queue. diff --git a/Rakefile b/Rakefile index 40f2e40..68bb09c 100644 --- a/Rakefile +++ b/Rakefile @@ -17,7 +17,7 @@ end task default: [:rubocop, :spec] -Rubocop::RakeTask.new +RuboCop::RakeTask.new desc 'Run specs for resque-loner' RSpec::Core::RakeTask.new(:spec) do |t| diff --git a/resque-loner.gemspec b/resque-loner.gemspec index f8ecb31..1b49f20 100644 --- a/resque-loner.gemspec +++ b/resque-loner.gemspec @@ -12,12 +12,11 @@ Gem::Specification.new do |s| s.email = ['jannis@moviepilot.com'] s.homepage = 'http://github.com/jayniz/resque-loner' s.summary = 'Adds unique jobs to resque' - s.has_rdoc = false s.license = 'MIT' s.rubyforge_project = 'resque-loner' - s.add_dependency 'resque', '~>1.0' + s.add_runtime_dependency 'resque', '>= 1.27' %w( airbrake @@ -28,6 +27,8 @@ Gem::Specification.new do |s| rake rspec rubocop + rubocop-rake + rubocop-rspec simplecov yajl-ruby ).each do |gemname| diff --git a/spec/loner_spec.rb b/spec/loner_spec.rb index 1f6c2ce..3a675f5 100644 --- a/spec/loner_spec.rb +++ b/spec/loner_spec.rb @@ -122,8 +122,8 @@ def self.perform(*args); end it 'should report if a job is queued or not' do Resque.enqueue SomeUniqueJob, 'foo' - Resque.enqueued?(SomeUniqueJob, 'foo').should be_true - Resque.enqueued?(SomeUniqueJob, 'bar').should be_false + Resque.enqueued?(SomeUniqueJob, 'foo').should be true + Resque.enqueued?(SomeUniqueJob, 'bar').should be false end it 'should report if a job is in a special queue or not' do @@ -131,11 +131,11 @@ def self.perform(*args); end SomeUniqueJob.instance_variable_set(:@queue, :special_queue) Resque.enqueue SomeUniqueJob, 'foo' - Resque.enqueued_in?(:special_queue, SomeUniqueJob, 'foo').should be_true + Resque.enqueued_in?(:special_queue, SomeUniqueJob, 'foo').should be true SomeUniqueJob.instance_variable_set(:@queue, default_queue) - Resque.enqueued?(SomeUniqueJob, 'foo').should be_false + Resque.enqueued?(SomeUniqueJob, 'foo').should be false end it 'should not be able to report if a non-unique job was enqueued' do @@ -158,7 +158,7 @@ def self.perform(*args); end it 'should honor loner_ttl in the redis key' do Resque.enqueue UniqueJobWithTtl - Resque.enqueued?(UniqueJobWithTtl).should be_true + Resque.enqueued?(UniqueJobWithTtl).should be true k = Resque.redis.keys 'loners:queue:unique_with_ttl:job:*' k.length.should == 1 Resque.redis.ttl(k[0]).should be_within(2).of(UniqueJobWithTtl.loner_ttl) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b051292..5737922 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,6 @@ require 'rubygems' require 'bundler/setup' -require 'codeclimate-test-reporter' -CodeClimate::TestReporter.start - require 'English' require 'simplecov' diff --git a/spec/support/redis_instance.rb b/spec/support/redis_instance.rb index 6377303..078d196 100644 --- a/spec/support/redis_instance.rb +++ b/spec/support/redis_instance.rb @@ -70,7 +70,7 @@ def ensure_pid_directory def reassign_redis_clients Resque.redis = Redis.new( - hostname: '127.0.0.1', port: port, thread_safe: true + host: '127.0.0.1', port: port ) end From 43a99cc63a9d3f0a28adcab1483759c3c8cdb41f Mon Sep 17 00:00:00 2001 From: Mark Bumiller Date: Fri, 13 Jan 2023 09:30:29 -0500 Subject: [PATCH 2/2] adding github configs also remove travis.yml added: - dependabot - build (ci.yml) - funding --- .github/dependabot.yml | 12 ++++++++ .github/funding.yml | 4 +++ .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 12 -------- README.markdown | 2 +- 5 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/funding.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a807fcb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/funding.yml b/.github/funding.yml new file mode 100644 index 0000000..2d87344 --- /dev/null +++ b/.github/funding.yml @@ -0,0 +1,4 @@ +# Docs for this file can be found here: +# https://docs.github.com/en/github/administering-a-repository/displaying-a-sponsor-button-in-your-repository + +github: ["iloveitaly"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8b3e0f7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + test: + continue-on-error: true + runs-on: ubuntu-latest + services: + redis: + image: redis + ports: + - 6379:6379 + strategy: + fail-fast: false + matrix: + ruby-version: + - 2.3 + - 2.4 + - 2.5 + - 2.6 + - 2.7 + - 3.0 + - 3.1 + resque-version: + - "master" + - "~> 2.4.0" + - "~> 1.27" + redis-version: + - "~> 4.x" + - "~> 5.x" + exclude: + - ruby-version: 2.3 + resque-version: "~> 1.27" + - ruby-version: 2.5 + resque-version: "~> 2.4.0" + - ruby-version: 2.5 + resque-version: master + - ruby-version: 2.3 + redis-version: "~> 5.x" + - ruby-version: 2.4 + redis-version: "~> 5.x" + - resque-version: "~> 1.27" + redis-version: "~> 5.x" + env: + REDIS_VERSION: "${{ matrix.redis-version }}" + RESQUE: "${{ matrix.resque-version }}" + RESQUE_LONER_DISABLE_TEST_REDIS_SERVER: 1 + COVERAGE: 1 + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{ matrix.ruby-version }}" + bundler-cache: true + - run: bundle exec rake diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4fe415a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -language: ruby -rvm: -- 1.9.3 -- 2.1.1 -env: - global: - - RESQUE_LONER_DISABLE_TEST_REDIS_SERVER=1 - - COVERAGE=1 - - secure: c9PvRm9w0ewSsS1QDogwPCvSXO+xgHm0mcVA+iiUknezitNjDwaTuBqGtLJ/PjMnQ16QfG0ApDvSqqOw9rSjwM7meCqiQZlJRqqyd547PNhbP6J56mtuXvxMM7wvulK/aLeIYwDeON0Do52FSY4l2/oN2QvA2hIvX8RTDyrfdaA= -services: -- redis-server diff --git a/README.markdown b/README.markdown index adac91f..2317abe 100644 --- a/README.markdown +++ b/README.markdown @@ -1,7 +1,7 @@ Resque-Loner ====== -[![Build Status](https://secure.travis-ci.org/resque/resque-loner.png?branch=master)](https://travis-ci.org/resque/resque-loner) +[![Build Status](https://github.com/resque/resque/actions/workflows/ci.yml/badge.svg)](https://github.com/resque/resque/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/resque-loner.png)](http://badge.fury.io/rb/resque-loner) Resque-Loner is a plugin for defunkt/resque which adds unique jobs to resque: Only one job with the same payload per queue.