From f4e3d6b704092e2a84a215f6899ad0f3cbc93300 Mon Sep 17 00:00:00 2001 From: Jakub Duchek Date: Thu, 24 Sep 2026 22:50:33 +0200 Subject: [PATCH] Update theforeman-rubocop to 0.1 --- .rubocop_todo.yml | 304 ++++++++++++++---- Gemfile | 2 +- lib/dynflow/action/rescue.rb | 2 +- lib/dynflow/action/v2/with_sub_plans.rb | 6 +- lib/dynflow/action/with_polling_sub_plans.rb | 4 +- lib/dynflow/action/with_sub_plans.rb | 2 +- lib/dynflow/active_job/queue_adapter.rb | 6 +- lib/dynflow/clock.rb | 6 +- lib/dynflow/delayed_plan.rb | 10 +- lib/dynflow/director.rb | 10 +- lib/dynflow/dispatcher.rb | 8 +- lib/dynflow/execution_history.rb | 4 +- .../execution_plan/output_reference.rb | 8 +- lib/dynflow/execution_plan/steps/abstract.rb | 26 +- lib/dynflow/execution_plan/steps/error.rb | 6 +- lib/dynflow/executors/parallel.rb | 4 +- lib/dynflow/middleware/register.rb | 4 +- .../022_store_flows_as_msgpack.rb | 16 +- ...24_store_execution_plan_data_as_msgpack.rb | 6 +- test/persistence_test.rb | 28 +- test/support/test_execution_log.rb | 6 +- test/testing_test.rb | 6 +- test/world_test.rb | 4 +- 23 files changed, 329 insertions(+), 149 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ed665493..7008d323 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,32 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-01-26 13:59:46 UTC using RuboCop version 0.89.1. +# on 2026-09-24 20:42:15 UTC using RuboCop version 1.23.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: 110 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Enabled: false + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith, Severity. +# SupportedStylesAlignWith: start_of_line, begin +Layout/BeginEndAlignment: + Exclude: + - 'lib/dynflow/actor.rb' + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/execution_plan/steps/error.rb' + - 'lib/dynflow/rails/daemon.rb' + - 'lib/dynflow/serializable.rb' + - 'lib/dynflow/testing/in_thread_world.rb' + - 'test/test_helper.rb' + # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyleAlignWith. @@ -14,7 +35,25 @@ Layout/BlockAlignment: Exclude: - 'test/test_helper.rb' -# Offense count: 7 +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'test/execution_plan_hooks_test.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AllowAliasSyntax, AllowedMethods. +# AllowedMethods: alias_method, public, protected, private +Layout/EmptyLinesAroundAttributeAccessor: + Exclude: + - 'lib/dynflow/dispatcher/client_dispatcher.rb' + - 'lib/dynflow/testing/dummy_planned_action.rb' + - 'test/redis_locking_test.rb' + - 'test/test_helper.rb' + +# Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_braces @@ -22,18 +61,51 @@ Layout/FirstHashElementIndentation: Exclude: - 'lib/dynflow/execution_plan/steps/finalize_step.rb' - 'lib/dynflow/execution_plan/steps/run_step.rb' - - 'lib/dynflow/persistence_adapters/sequel_migrations/022_store_flows_as_msgpack.rb' - - 'lib/dynflow/persistence_adapters/sequel_migrations/024_store_execution_plan_data_as_msgpack.rb' - 'test/persistence_test.rb' -# Offense count: 201 +# Offense count: 108 # 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: - Enabled: false + Exclude: + - 'doc/pages/plugins/alert_block.rb' + - 'lib/dynflow/action.rb' + - 'lib/dynflow/execution_plan.rb' + - 'lib/dynflow/execution_plan/steps/finalize_step.rb' + - 'lib/dynflow/execution_plan/steps/plan_step.rb' + - 'lib/dynflow/execution_plan/steps/run_step.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + - 'lib/dynflow/serializer.rb' + - 'lib/dynflow/testing/factories.rb' + - 'lib/dynflow/web/console_helpers.rb' + - 'lib/dynflow/web/filtering_helpers.rb' + - 'test/action_test.rb' + - 'test/executor_test.rb' + - 'test/support/code_workflow_example.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Layout/RescueEnsureAlignment: + Exclude: + - 'lib/dynflow/execution_plan/steps/error.rb' + - 'lib/dynflow/rails/daemon.rb' + - 'lib/dynflow/serializable.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/SpaceAroundMethodCallOperator: + Exclude: + - 'test/activejob_adapter_test.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'examples/memory_limit_watcher.rb' # Offense count: 8 # Configuration parameters: AllowSafeAssignment. @@ -48,14 +120,23 @@ Lint/AssignmentInCondition: - 'lib/dynflow/web/console_helpers.rb' - 'test/test_helper.rb' -# Offense count: 4 +# Offense count: 59 +# Configuration parameters: AllowedMethods. +# AllowedMethods: enums +Lint/ConstantDefinitionInBlock: + Enabled: false + +# Offense count: 2 Lint/DuplicateMethods: Exclude: - - 'lib/dynflow/coordinator.rb' - - 'lib/dynflow/executors/parallel/pool.rb' - 'lib/dynflow/rails/configuration.rb' - 'lib/dynflow/rails/daemon.rb' +# Offense count: 1 +Lint/HashCompareByIdentity: + Exclude: + - 'test/test_helper.rb' + # Offense count: 6 Lint/IneffectiveAccessModifier: Exclude: @@ -71,6 +152,10 @@ Lint/MissingCopEnableDirective: Exclude: - 'test/persistence_test.rb' +# Offense count: 33 +Lint/MissingSuper: + Enabled: false + # Offense count: 1 Lint/RandOne: Exclude: @@ -109,7 +194,7 @@ Lint/UnderscorePrefixedVariableName: Lint/UnusedBlockArgument: Enabled: false -# Offense count: 43 +# Offense count: 44 # Cop supports --auto-correct. # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. Lint/UnusedMethodArgument: @@ -127,13 +212,12 @@ Lint/UselessAccessModifier: - 'lib/dynflow/flows/atom.rb' - 'lib/dynflow/rails/daemon.rb' -# Offense count: 9 +# Offense count: 8 Lint/UselessAssignment: Exclude: - 'doc/pages/plugins/plantuml.rb' - 'examples/memory_limit_watcher.rb' - 'examples/singletons.rb' - - 'lib/dynflow/executors/parallel.rb' - 'lib/dynflow/persistence_adapters/sequel.rb' - 'lib/dynflow/rails/configuration.rb' - 'lib/dynflow/world.rb' @@ -145,29 +229,29 @@ Lint/Void: Exclude: - 'test/executor_test.rb' -# Offense count: 86 -# Configuration parameters: IgnoredMethods. +# Offense count: 90 +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: Max: 66 -# Offense count: 101 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. -# ExcludedMethods: refine +# Offense count: 105 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine Metrics/BlockLength: Max: 738 -# Offense count: 11 +# Offense count: 12 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 292 + Max: 185 -# Offense count: 19 +# Offense count: 18 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 18 -# Offense count: 135 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. +# Offense count: 138 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 47 @@ -176,16 +260,29 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 188 -# Offense count: 8 +# Offense count: 11 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: Max: 13 + MaxOptionalParameters: 12 # Offense count: 15 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 18 +# Offense count: 5 +# Cop supports --auto-correct. +Minitest/AssertEmptyLiteral: + Exclude: + - 'test/persistence_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Minitest/RefuteFalse: + Exclude: + - 'test/executor_test.rb' + # Offense count: 10 Naming/AccessorMethodName: Exclude: @@ -201,6 +298,7 @@ Naming/AccessorMethodName: - 'lib/dynflow/watchers/memory_consumption_watcher.rb' # Offense count: 1 +# Cop supports --auto-correct. Naming/BinaryOperatorParameterName: Exclude: - 'lib/dynflow/coordinator.rb' @@ -210,7 +308,7 @@ Naming/ConstantName: Exclude: - 'examples/sub_plan_concurrency_control.rb' -# Offense count: 5 +# Offense count: 4 # Configuration parameters: EnforcedStyleForLeadingUnderscores. # SupportedStylesForLeadingUnderscores: disallowed, required, optional Naming/MemoizedInstanceVariableName: @@ -219,7 +317,6 @@ Naming/MemoizedInstanceVariableName: - 'lib/dynflow/execution_plan/steps/abstract_flow_step.rb' - 'lib/dynflow/persistence_adapters/abstract.rb' - 'lib/dynflow/testing/in_thread_world.rb' - - 'test/test_helper.rb' # Offense count: 13 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. @@ -244,13 +341,12 @@ Naming/MethodParameterName: # MethodDefinitionMacros: define_method, define_singleton_method Naming/PredicateName: Exclude: - - 'spec/**/*' - 'lib/dynflow/semaphores/abstract.rb' - 'lib/dynflow/semaphores/aggregating.rb' - 'lib/dynflow/semaphores/dummy.rb' - 'lib/dynflow/semaphores/stateful.rb' -# Offense count: 7 +# Offense count: 5 # Cop supports --auto-correct. # Configuration parameters: PreferredName. Naming/RescuedExceptionsVariableName: @@ -259,7 +355,6 @@ Naming/RescuedExceptionsVariableName: - 'lib/dynflow/action/polling.rb' - 'lib/dynflow/action/progress.rb' - 'lib/dynflow/execution_plan.rb' - - 'lib/dynflow/executors/parallel.rb' - 'lib/dynflow/serializable.rb' # Offense count: 3 @@ -333,15 +428,14 @@ Rails/Blank: Exclude: - 'lib/dynflow/telemetry_adapters/statsd.rb' -# Offense count: 3 -# Configuration parameters: EnforcedStyle. +# Offense count: 1 +# Configuration parameters: EnforcedStyle, AllowToTime. # SupportedStyles: strict, flexible Rails/Date: Exclude: - - 'lib/dynflow/extensions/msgpack.rb' - 'lib/dynflow/persistence.rb' -# Offense count: 12 +# Offense count: 16 # Cop supports --auto-correct. # Configuration parameters: EnforceForPrefixed. Rails/Delegate: @@ -359,11 +453,11 @@ Rails/Delegate: # Include: app/**/*.rb, config/**/*.rb, lib/**/*.rb Rails/Exit: Exclude: - - 'lib/**/*.rake' - 'lib/dynflow/rails/daemon.rb' - 'lib/dynflow/world.rb' # Offense count: 1 +# Cop supports --auto-correct. # Configuration parameters: Include. # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb Rails/Output: @@ -382,7 +476,6 @@ Rails/PluralizationGrammar: # Include: **/Rakefile, **/*.rake Rails/RakeEnvironment: Exclude: - - 'lib/capistrano/tasks/**/*.rake' - 'doc/pages/Rakefile' # Offense count: 24 @@ -405,7 +498,6 @@ Rails/RefuteMethods: # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all Rails/SkipsModelValidations: Exclude: - - 'db/migrate/*.rb' - 'lib/dynflow/connectors/abstract.rb' - 'lib/dynflow/connectors/database.rb' - 'lib/dynflow/connectors/direct.rb' @@ -415,7 +507,7 @@ Rails/SkipsModelValidations: - 'lib/dynflow/persistence_adapters/sequel.rb' - 'test/persistence_test.rb' -# Offense count: 37 +# Offense count: 46 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: strict, flexible @@ -428,6 +520,14 @@ Security/MarshalLoad: - 'lib/dynflow/dispatcher.rb' - 'lib/dynflow/serializer.rb' +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'lib/dynflow/rails/configuration.rb' + # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. @@ -472,13 +572,30 @@ Style/CaseEquality: - 'test/abnormal_states_recovery_test.rb' - 'test/support/rescue_example.rb' -# Offense count: 29 +# Offense count: 2 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle. +Style/CaseLikeIf: + Exclude: + - 'lib/dynflow/utils/indifferent_hash.rb' + - 'test/support/code_workflow_example.rb' + +# Offense count: 28 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. # SupportedStyles: nested, compact Style/ClassAndModuleChildren: Enabled: false +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: ==, equal?, eql? +Style/ClassEqualityComparison: + Exclude: + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/flows/abstract_composed.rb' + - 'test/test_helper.rb' + # Offense count: 5 # Cop supports --auto-correct. Style/ColonMethodCall: @@ -489,8 +606,8 @@ Style/ColonMethodCall: # Offense count: 5 # Cop supports --auto-correct. -# Configuration parameters: Keywords. -# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW +# Configuration parameters: Keywords, RequireColon. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE Style/CommentAnnotation: Exclude: - 'doc/pages/plugins/tags.rb' @@ -500,6 +617,7 @@ Style/CommentAnnotation: - 'test/support/code_workflow_example.rb' # Offense count: 1 +# Cop supports --auto-correct. Style/CommentedKeyword: Exclude: - 'doc/pages/plugins/plantuml.rb' @@ -511,6 +629,7 @@ Style/Dir: - 'test/test_helper.rb' # Offense count: 1 +# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: allowed_in_returns, forbidden Style/DoubleNegation: @@ -582,8 +701,8 @@ Style/FormatString: - 'lib/dynflow/coordinator.rb' - 'lib/dynflow/web/console_helpers.rb' -# Offense count: 31 -# Configuration parameters: EnforcedStyle. +# Offense count: 30 +# Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, IgnoredMethods. # SupportedStyles: annotated, template, unannotated Style/FormatStringToken: Exclude: @@ -595,6 +714,13 @@ Style/FormatStringToken: - 'lib/dynflow/logger_adapters/simple.rb' - 'lib/dynflow/web/console_helpers.rb' +# Offense count: 3 +# Cop supports --auto-correct. +Style/GlobalStdStream: + Exclude: + - 'examples/remote_executor.rb' + - 'lib/dynflow/rails/daemon.rb' + # Offense count: 7 # Configuration parameters: AllowedVariables. Style/GlobalVars: @@ -603,11 +729,32 @@ Style/GlobalVars: - 'test/support/dummy_example.rb' - 'test/testing_test.rb' -# Offense count: 60 +# Offense count: 57 # Configuration parameters: MinBodyLength. Style/GuardClause: Enabled: false +# Offense count: 13 +# Cop supports --auto-correct. +# Configuration parameters: AllowedReceivers. +Style/HashEachMethods: + Exclude: + - 'lib/dynflow/action.rb' + - 'lib/dynflow/config.rb' + - 'lib/dynflow/director.rb' + - 'lib/dynflow/dispatcher/client_dispatcher.rb' + - 'lib/dynflow/executors/parallel/core.rb' + - 'lib/dynflow/executors/sidekiq/core.rb' + - 'lib/dynflow/semaphores/aggregating.rb' + - 'lib/dynflow/world/invalidation.rb' + - 'test/support/middleware_example.rb' + +# Offense count: 1 +# Configuration parameters: MinBranchesCount. +Style/HashLikeCase: + Exclude: + - 'lib/dynflow/execution_plan.rb' + # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. @@ -617,7 +764,14 @@ Style/HashSyntax: - 'lib/dynflow/persistence_adapters/sequel.rb' - 'test/persistence_test.rb' +# Offense count: 1 +# Cop supports --auto-correct. +Style/HashTransformValues: + Exclude: + - 'lib/dynflow/executors/parallel/core.rb' + # Offense count: 8 +# Cop supports --auto-correct. # Configuration parameters: AllowIfModifier. Style/IfInsideElse: Exclude: @@ -706,6 +860,8 @@ Style/MultilineWhenThen: - 'doc/pages/plugins/graphviz.rb' # Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowMethodComparison. Style/MultipleComparison: Exclude: - 'test/action_test.rb' @@ -756,11 +912,10 @@ Style/Not: # Offense count: 15 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# Configuration parameters: EnforcedStyle, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - - 'spec/**/*' - 'lib/dynflow/action/v2/with_sub_plans.rb' - 'lib/dynflow/action/with_bulk_sub_plans.rb' - 'lib/dynflow/action/with_sub_plans.rb' @@ -772,16 +927,21 @@ Style/NumericPredicate: - 'lib/dynflow/semaphores/stateful.rb' - 'test/execution_plan_hooks_test.rb' -# Offense count: 5 +# Offense count: 28 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Enabled: false + +# Offense count: 3 # Cop supports --auto-correct. Style/ParallelAssignment: Exclude: - 'doc/pages/plugins/tags.rb' - 'test/executor_test.rb' - - 'test/support/test_execution_log.rb' - 'test/test_helper.rb' -# Offense count: 45 +# Offense count: 48 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: @@ -812,7 +972,7 @@ Style/Proc: # Offense count: 6 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. +# Configuration parameters: EnforcedStyle, AllowedCompactTypes. # SupportedStyles: compact, exploded Style/RaiseArgs: Exclude: @@ -822,11 +982,19 @@ Style/RaiseArgs: - 'lib/dynflow/coordinator_adapters/sequel.rb' - 'lib/dynflow/dispatcher/client_dispatcher.rb' -# Offense count: 7 +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantAssignment: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + +# Offense count: 9 # Cop supports --auto-correct. Style/RedundantBegin: Exclude: - 'examples/remote_executor.rb' + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/execution_plan.rb' - 'lib/dynflow/execution_plan/hooks.rb' - 'lib/dynflow/rails/daemon.rb' - 'lib/dynflow/world.rb' @@ -844,7 +1012,7 @@ Style/RedundantParentheses: Exclude: - 'test/coordinator_test.rb' -# Offense count: 72 +# Offense count: 69 # Cop supports --auto-correct. # Configuration parameters: AllowMultipleReturnValues. Style/RedundantReturn: @@ -861,7 +1029,7 @@ Style/RescueModifier: Exclude: - 'lib/dynflow/serializer.rb' -# Offense count: 22 +# Offense count: 23 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, explicit @@ -890,7 +1058,7 @@ Style/RescueStandardError: Style/SafeNavigation: Enabled: false -# Offense count: 6 +# Offense count: 7 # Cop supports --auto-correct. # Configuration parameters: AllowAsExpressionSeparator. Style/Semicolon: @@ -918,9 +1086,25 @@ Style/SingleLineMethods: - 'lib/dynflow/utils/indifferent_hash.rb' - 'test/support/dummy_example.rb' +# Offense count: 2 +# Cop supports --auto-correct. +Style/SlicingWithRange: + Exclude: + - 'lib/dynflow/web/console_helpers.rb' + - 'test/test_helper.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'lib/dynflow/director/running_steps_manager.rb' + - 'lib/dynflow/testing/managed_clock.rb' + - 'test/support/dummy_example.rb' + # Offense count: 14 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. +# Configuration parameters: RequireEnglish, EnforcedStyle. # SupportedStyles: use_perl_names, use_english_names Style/SpecialGlobalVars: Exclude: @@ -948,12 +1132,6 @@ Style/StabbyLambdaParentheses: - 'lib/dynflow/clock.rb' - 'lib/dynflow/testing/mimic.rb' -# Offense count: 2 -# Cop supports --auto-correct. -Style/StderrPuts: - Exclude: - - 'lib/dynflow/rails/daemon.rb' - # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. @@ -965,7 +1143,7 @@ Style/StringLiteralsInInterpolation: # Offense count: 10 # Cop supports --auto-correct. -# Configuration parameters: IgnoredMethods. +# Configuration parameters: AllowMethodsWithArguments, IgnoredMethods. # IgnoredMethods: respond_to, define_method Style/SymbolProc: Exclude: @@ -1034,9 +1212,9 @@ Style/ZeroLengthPredicate: Exclude: - 'lib/dynflow/flows/abstract.rb' -# Offense count: 86 +# Offense count: 99 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: Max: 165 diff --git a/Gemfile b/Gemfile index d3e6bf6d..3f11a907 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ group :postgresql, optional: ENV.key?('CI') && ENV['DB'] != 'postgresql' do end group :lint do - gem 'theforeman-rubocop', '~> 0.0.4' + gem 'theforeman-rubocop', '~> 0.1.0' end group :memory_watcher do diff --git a/lib/dynflow/action/rescue.rb b/lib/dynflow/action/rescue.rb index 8b6c5bc2..1377f399 100644 --- a/lib/dynflow/action/rescue.rb +++ b/lib/dynflow/action/rescue.rb @@ -7,7 +7,7 @@ module Action::Rescue end SuggestedStrategy = Algebrick.type do - fields! action: Action, + fields! action: Action, strategy: Strategy end diff --git a/lib/dynflow/action/v2/with_sub_plans.rb b/lib/dynflow/action/v2/with_sub_plans.rb index 476024bb..329ab3ac 100644 --- a/lib/dynflow/action/v2/with_sub_plans.rb +++ b/lib/dynflow/action/v2/with_sub_plans.rb @@ -140,9 +140,9 @@ def recalculate_counts failed = sub_plans_count('state' => %w(paused stopped), 'result' => %w(error warning)) - cancelled_scheduled_plans success = sub_plans_count('state' => 'stopped', 'result' => 'success') output.update(:pending_count => total - failed - success - cancelled_scheduled_plans, - :failed_count => failed - output.fetch(:resumed_count, 0), - :success_count => success, - :cancelled_count => cancelled) + :failed_count => failed - output.fetch(:resumed_count, 0), + :success_count => success, + :cancelled_count => cancelled) end def counts_set? diff --git a/lib/dynflow/action/with_polling_sub_plans.rb b/lib/dynflow/action/with_polling_sub_plans.rb index 4950e7f6..68719e60 100644 --- a/lib/dynflow/action/with_polling_sub_plans.rb +++ b/lib/dynflow/action/with_polling_sub_plans.rb @@ -65,9 +65,9 @@ def recalculate_counts total = sub_plans_count failed = sub_plans_count('state' => %w(paused stopped), 'result' => 'error') success = sub_plans_count('state' => 'stopped', 'result' => 'success') - output.update(:total_count => total - output.fetch(:resumed_count, 0), + output.update(:total_count => total - output.fetch(:resumed_count, 0), :pending_count => total - failed - success, - :failed_count => failed - output.fetch(:resumed_count, 0), + :failed_count => failed - output.fetch(:resumed_count, 0), :success_count => success) end end diff --git a/lib/dynflow/action/with_sub_plans.rb b/lib/dynflow/action/with_sub_plans.rb index 0fcfdfb2..10a30cc7 100644 --- a/lib/dynflow/action/with_sub_plans.rb +++ b/lib/dynflow/action/with_sub_plans.rb @@ -12,7 +12,7 @@ def backtrace SubPlanFinished = Algebrick.type do fields! :execution_plan_id => String, - :success => type { variants TrueClass, FalseClass } + :success => type { variants TrueClass, FalseClass } end def run(event = nil) diff --git a/lib/dynflow/active_job/queue_adapter.rb b/lib/dynflow/active_job/queue_adapter.rb index 59c69e40..975f76f8 100644 --- a/lib/dynflow/active_job/queue_adapter.rb +++ b/lib/dynflow/active_job/queue_adapter.rb @@ -15,9 +15,9 @@ def enqueue_at(job, timestamp) job.provider_job_id = job.job_id ::Rails.application.dynflow.world .delay_with_options(id: job.provider_job_id, - action_class: JobWrapper, - delay_options: { :start_at => Time.at(timestamp) }, - args: [job.serialize]) + action_class: JobWrapper, + delay_options: { :start_at => Time.at(timestamp) }, + args: [job.serialize]) end end diff --git a/lib/dynflow/clock.rb b/lib/dynflow/clock.rb index 3655769c..e7220afc 100644 --- a/lib/dynflow/clock.rb +++ b/lib/dynflow/clock.rb @@ -5,9 +5,9 @@ class Clock < Actor include Algebrick::Types Timer = Algebrick.type do - fields! who: Object, # to ping back - when: Time, # to deliver - what: Maybe[Object], # to send + fields! who: Object, # to ping back + when: Time, # to deliver + what: Maybe[Object], # to send where: Symbol # it should be delivered, which method end diff --git a/lib/dynflow/delayed_plan.rb b/lib/dynflow/delayed_plan.rb index 5fd1c6e2..defc667c 100644 --- a/lib/dynflow/delayed_plan.rb +++ b/lib/dynflow/delayed_plan.rb @@ -59,11 +59,11 @@ def execute(future = Concurrent::Promises.resolvable_future) def to_hash recursive_to_hash :execution_plan_uuid => @execution_plan_uuid, - :start_at => @start_at, - :start_before => @start_before, - :serialized_args => @args_serializer.serialized_args, - :args_serializer => @args_serializer.class.name, - :frozen => @frozen + :start_at => @start_at, + :start_before => @start_before, + :serialized_args => @args_serializer.serialized_args, + :args_serializer => @args_serializer.class.name, + :frozen => @frozen end # Retrieves arguments from the serializer diff --git a/lib/dynflow/director.rb b/lib/dynflow/director.rb index 14e49758..69602a0e 100644 --- a/lib/dynflow/director.rb +++ b/lib/dynflow/director.rb @@ -12,12 +12,12 @@ class Director include Algebrick::TypeCheck Event = Algebrick.type do - fields! request_id: String, + fields! request_id: String, execution_plan_id: String, - step_id: Integer, - event: Object, - result: Concurrent::Promises::ResolvableFuture, - optional: Algebrick::Types::Boolean + step_id: Integer, + event: Object, + result: Concurrent::Promises::ResolvableFuture, + optional: Algebrick::Types::Boolean end UnprocessableEvent = Class.new(Dynflow::Error) diff --git a/lib/dynflow/dispatcher.rb b/lib/dynflow/dispatcher.rb index 92273575..b38aea06 100644 --- a/lib/dynflow/dispatcher.rb +++ b/lib/dynflow/dispatcher.rb @@ -5,10 +5,10 @@ module Dispatcher Request = Algebrick.type do Event = type do fields! execution_plan_id: String, - step_id: Integer, - event: Object, - time: type { variants Time, NilClass }, - optional: Algebrick::Types::Boolean + step_id: Integer, + event: Object, + time: type { variants Time, NilClass }, + optional: Algebrick::Types::Boolean end Execution = type do diff --git a/lib/dynflow/execution_history.rb b/lib/dynflow/execution_history.rb index 25bedab8..729504b2 100644 --- a/lib/dynflow/execution_history.rb +++ b/lib/dynflow/execution_history.rb @@ -6,8 +6,8 @@ class ExecutionHistory include Enumerable Event = Algebrick.type do - fields! time: Integer, - name: String, + fields! time: Integer, + name: String, world_id: type { variants String, NilClass } end diff --git a/lib/dynflow/execution_plan/output_reference.rb b/lib/dynflow/execution_plan/output_reference.rb index be167a0f..7c3c5fe9 100644 --- a/lib/dynflow/execution_plan/output_reference.rb +++ b/lib/dynflow/execution_plan/output_reference.rb @@ -53,11 +53,11 @@ def [](subkey) end def to_hash - recursive_to_hash class: self.class.to_s, + recursive_to_hash class: self.class.to_s, execution_plan_id: execution_plan_id, - step_id: step_id, - action_id: action_id, - subkeys: subkeys + step_id: step_id, + action_id: action_id, + subkeys: subkeys end def to_s diff --git a/lib/dynflow/execution_plan/steps/abstract.rb b/lib/dynflow/execution_plan/steps/abstract.rb index 7bb962b5..43dcd6f2 100644 --- a/lib/dynflow/execution_plan/steps/abstract.rb +++ b/lib/dynflow/execution_plan/steps/abstract.rb @@ -87,19 +87,19 @@ def to_s def to_hash recursive_to_hash execution_plan_uuid: execution_plan_id, - id: id, - state: state, - class: self.class.to_s, - action_class: action_class.to_s, - action_id: action_id, - error: error, - started_at: started_at, - ended_at: ended_at, - execution_time: execution_time, - real_time: real_time, - progress_done: progress_done, - progress_weight: progress_weight, - queue: queue + id: id, + state: state, + class: self.class.to_s, + action_class: action_class.to_s, + action_id: action_id, + error: error, + started_at: started_at, + ended_at: ended_at, + execution_time: execution_time, + real_time: real_time, + progress_done: progress_done, + progress_weight: progress_weight, + queue: queue end def progress_done diff --git a/lib/dynflow/execution_plan/steps/error.rb b/lib/dynflow/execution_plan/steps/error.rb index b7ae5c12..a548ab15 100644 --- a/lib/dynflow/execution_plan/steps/error.rb +++ b/lib/dynflow/execution_plan/steps/error.rb @@ -42,10 +42,10 @@ def self.new_from_hash(hash) end def to_hash - recursive_to_hash class: self.class.name, + recursive_to_hash class: self.class.name, exception_class: exception_class.to_s, - message: message, - backtrace: backtrace + message: message, + backtrace: backtrace end def to_s diff --git a/lib/dynflow/executors/parallel.rb b/lib/dynflow/executors/parallel.rb index ba735cbb..c421ee77 100644 --- a/lib/dynflow/executors/parallel.rb +++ b/lib/dynflow/executors/parallel.rb @@ -16,8 +16,8 @@ def initialize(world, queues_options: { :default => { :pool_size => 5 } }) @world = world @logger = world.logger - @core = executor_class.spawn name: 'parallel-executor-core', - args: [world, heartbeat_interval, queues_options], + @core = executor_class.spawn name: 'parallel-executor-core', + args: [world, heartbeat_interval, queues_options], initialized: @core_initialized = Concurrent::Promises.resolvable_future end diff --git a/lib/dynflow/middleware/register.rb b/lib/dynflow/middleware/register.rb index 75385896..5e574463 100644 --- a/lib/dynflow/middleware/register.rb +++ b/lib/dynflow/middleware/register.rb @@ -8,8 +8,8 @@ class Middleware::Register def initialize @rules = Hash.new do |h, k| - h[k] = { before: [], - after: [], + h[k] = { before: [], + after: [], replace: [] } end end diff --git a/lib/dynflow/persistence_adapters/sequel_migrations/022_store_flows_as_msgpack.rb b/lib/dynflow/persistence_adapters/sequel_migrations/022_store_flows_as_msgpack.rb index bfca625e..fa72a720 100644 --- a/lib/dynflow/persistence_adapters/sequel_migrations/022_store_flows_as_msgpack.rb +++ b/lib/dynflow/persistence_adapters/sequel_migrations/022_store_flows_as_msgpack.rb @@ -4,14 +4,14 @@ Sequel.migration do helper = MsgpackMigrationHelper.new({ - :dynflow_actions => [:data, :input, :output], - :dynflow_coordinator_records => [:data], - :dynflow_delayed_plans => [:serialized_args, :data], - :dynflow_envelopes => [:data], - :dynflow_execution_plans => [:run_flow, :finalize_flow, :execution_history, :step_ids], - :dynflow_steps => [:error, :children], - :dynflow_output_chunks => [:chunk] - }) + :dynflow_actions => [:data, :input, :output], + :dynflow_coordinator_records => [:data], + :dynflow_delayed_plans => [:serialized_args, :data], + :dynflow_envelopes => [:data], + :dynflow_execution_plans => [:run_flow, :finalize_flow, :execution_history, :step_ids], + :dynflow_steps => [:error, :children], + :dynflow_output_chunks => [:chunk] + }) up do helper.up(self) diff --git a/lib/dynflow/persistence_adapters/sequel_migrations/024_store_execution_plan_data_as_msgpack.rb b/lib/dynflow/persistence_adapters/sequel_migrations/024_store_execution_plan_data_as_msgpack.rb index 16c1870b..c3d6eadd 100644 --- a/lib/dynflow/persistence_adapters/sequel_migrations/024_store_execution_plan_data_as_msgpack.rb +++ b/lib/dynflow/persistence_adapters/sequel_migrations/024_store_execution_plan_data_as_msgpack.rb @@ -4,9 +4,9 @@ Sequel.migration do helper = MsgpackMigrationHelper.new({ - :dynflow_execution_plans => [:data], - :dynflow_steps => [:data] - }) + :dynflow_execution_plans => [:data], + :dynflow_steps => [:data] + }) up do helper.up(self) diff --git a/test/persistence_test.rb b/test/persistence_test.rb index 39841780..35ae2d93 100644 --- a/test/persistence_test.rb +++ b/test/persistence_test.rb @@ -42,8 +42,8 @@ module PersistenceTest def prepare_plans execution_plans_data.map do |h| - h.merge result: nil, started_at: Time.now.utc - 20, ended_at: Time.now.utc - 10, - real_time: 0.0, execution_time: 0.0 + h.merge result: nil, started_at: Time.now.utc - 20, ended_at: Time.now.utc - 10, + real_time: 0.0, execution_time: 0.0 end end @@ -173,8 +173,8 @@ def self.it_acts_as_persistence_adapter loaded_plans = adapter.find_execution_plan_statuses(filters: { state: ['paused'] }) _(loaded_plans).must_equal({ "plan1" => { :state => "paused", :result => nil }, - "plan3" => { :state => "paused", :result => nil }, - "plan4" => { :state => "paused", :result => nil } }) + "plan3" => { :state => "paused", :result => nil }, + "plan4" => { :state => "paused", :result => nil } }) loaded_plans = adapter.find_execution_plan_statuses(filters: { state: ['stopped'] }) _(loaded_plans).must_equal({ "plan2" => { :state => "stopped", :result => nil } }) @@ -184,14 +184,14 @@ def self.it_acts_as_persistence_adapter loaded_plans = adapter.find_execution_plan_statuses(filters: { state: ['stopped', 'paused'] }) _(loaded_plans).must_equal({ "plan1" => { :state => "paused", :result => nil }, - "plan2" => { :state => "stopped", :result => nil }, - "plan3" => { :state => "paused", :result => nil }, "plan4" => { :state => "paused", :result => nil } }) + "plan2" => { :state => "stopped", :result => nil }, + "plan3" => { :state => "paused", :result => nil }, "plan4" => { :state => "paused", :result => nil } }) loaded_plans = adapter.find_execution_plan_statuses(filters: { 'state' => ['stopped', 'paused'] }) _(loaded_plans).must_equal({ "plan1" => { :state => "paused", :result => nil }, - "plan2" => { :state => "stopped", :result => nil }, - "plan3" => { :state => "paused", :result => nil }, - "plan4" => { :state => "paused", :result => nil } }) + "plan2" => { :state => "stopped", :result => nil }, + "plan3" => { :state => "paused", :result => nil }, + "plan4" => { :state => "paused", :result => nil } }) loaded_plans = adapter.find_execution_plan_statuses(filters: { label: ['test1'], :delayed => true }) _(loaded_plans).must_equal({}) @@ -347,11 +347,11 @@ def self.it_acts_as_persistence_adapter start_time = Time.now.utc prepare_and_save_plans adapter.save_delayed_plan('plan1', :execution_plan_uuid => 'plan1', :frozen => false, :start_at => format_time(start_time + 60), - :start_before => format_time(start_time - 60)) + :start_before => format_time(start_time - 60)) adapter.save_delayed_plan('plan2', :execution_plan_uuid => 'plan2', :frozen => false, :start_at => format_time(start_time - 60)) adapter.save_delayed_plan('plan3', :execution_plan_uuid => 'plan3', :frozen => false, :start_at => format_time(start_time + 60)) adapter.save_delayed_plan('plan4', :execution_plan_uuid => 'plan4', :frozen => false, :start_at => format_time(start_time - 60), - :start_before => format_time(start_time - 60)) + :start_before => format_time(start_time - 60)) plans = adapter.find_ready_delayed_plans(start_time) _(plans.length).must_equal 3 _(plans.map { |plan| plan[:execution_plan_uuid] }).must_equal %w(plan2 plan4 plan1) @@ -362,9 +362,9 @@ def self.it_acts_as_persistence_adapter prepare_and_save_plans adapter.save_delayed_plan('plan1', :execution_plan_uuid => 'plan1', :frozen => false, :start_at => format_time(start_time + 60), - :start_before => format_time(start_time - 60)) + :start_before => format_time(start_time - 60)) adapter.save_delayed_plan('plan2', :execution_plan_uuid => 'plan2', :frozen => true, :start_at => format_time(start_time + 60), - :start_before => format_time(start_time - 60)) + :start_before => format_time(start_time - 60)) plans = adapter.find_ready_delayed_plans(start_time) _(plans.length).must_equal 1 @@ -519,7 +519,7 @@ def self.it_acts_as_persistence_adapter envelopes.each { |e| adapter.push_envelope(e) } adapter.insert_coordinator_record({ "class" => "Dynflow::Coordinator::ExecutorWorld", - "id" => executor_world_id, "meta" => {}, "active" => true }) + "id" => executor_world_id, "meta" => {}, "active" => true }) assert_equal 1, adapter.prune_undeliverable_envelopes assert_equal 0, adapter.prune_undeliverable_envelopes diff --git a/test/support/test_execution_log.rb b/test/support/test_execution_log.rb index 52880122..f8dad278 100644 --- a/test/support/test_execution_log.rb +++ b/test/support/test_execution_log.rb @@ -24,11 +24,13 @@ def size end def self.setup - @run, @finalize = self.new, self.new + @run = new + @finalize = new end def self.teardown - @run, @finalize = nil, nil + @run = nil + @finalize = nil end def self.run diff --git a/test/testing_test.rb b/test/testing_test.rb index e3b17aa7..4d63fdcc 100644 --- a/test/testing_test.rb +++ b/test/testing_test.rb @@ -63,19 +63,19 @@ module Dynflow 3.times { progress_action_time action } _(action.output).must_equal('task' => { 'progress' => 30, 'done' => false }, - 'poll_attempts' => { 'total' => 2, 'failed' => 0 }) + 'poll_attempts' => { 'total' => 2, 'failed' => 0 }) _(action.run_progress).must_equal 0.3 run_action action, Dynflow::Action::Polling::Poll run_action action, Dynflow::Action::Polling::Poll _(action.output).must_equal('task' => { 'progress' => 50, 'done' => false }, - 'poll_attempts' => { 'total' => 4, 'failed' => 0 }) + 'poll_attempts' => { 'total' => 4, 'failed' => 0 }) _(action.run_progress).must_equal 0.5 5.times { progress_action_time action } _(action.output).must_equal('task' => { 'progress' => 100, 'done' => true }, - 'poll_attempts' => { 'total' => 9, 'failed' => 0 }) + 'poll_attempts' => { 'total' => 9, 'failed' => 0 }) _(action.run_progress).must_equal 1 end diff --git a/test/world_test.rb b/test/world_test.rb index 782b82a7..a1849e90 100644 --- a/test/world_test.rb +++ b/test/world_test.rb @@ -15,8 +15,8 @@ module WorldTest registered_world = world.coordinator.find_worlds(false, id: world.id).first registered_world.meta.delete('last_seen') _(registered_world.meta).must_equal('hostname' => Socket.gethostname, 'pid' => Process.pid, - 'queues' => { 'default' => { 'pool_size' => 5 }, - 'slow' => { 'pool_size' => 1 } }) + 'queues' => { 'default' => { 'pool_size' => 5 }, + 'slow' => { 'pool_size' => 1 } }) end it 'is configurable' do