diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..18b0dda5 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1 @@ +inherit_from: .rubocop_todo.yml \ No newline at end of file diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..3c9b0b78 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,782 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2015-08-21 16:01:41 -0400 using RuboCop version 0.33.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: 5 +Lint/AmbiguousOperator: + Exclude: + - 'lib/dynflow/testing/factories.rb' + - 'lib/dynflow/testing/mimic.rb' + - 'test/clock_test.rb' + - 'test/support/middleware_example.rb' + +# Offense count: 2 +Lint/AmbiguousRegexpLiteral: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'test/future_execution_test.rb' + +# Offense count: 7 +# Configuration parameters: AllowSafeAssignment. +Lint/AssignmentInCondition: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/connectors/direct.rb' + - 'lib/dynflow/execution_plan.rb' + - 'lib/dynflow/testing/dummy_execution_plan.rb' + - 'lib/dynflow/testing/managed_clock.rb' + - 'lib/dynflow/web/console_helpers.rb' + - 'test/test_helper.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Lint/BlockAlignment: + Exclude: + - 'lib/dynflow/executors/parallel/worker.rb' + - 'test/action_test.rb' + - 'test/rescue_test.rb' + - 'test/test_helper.rb' + +# Offense count: 1 +Lint/DuplicateMethods: + Exclude: + - 'lib/dynflow/coordinator.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect. +Lint/EndAlignment: + Enabled: false + +# Offense count: 3 +Lint/FormatParameterMismatch: + Exclude: + - 'lib/dynflow/coordinator.rb' + - 'lib/dynflow/web/console_helpers.rb' + +# Offense count: 3 +Lint/ParenthesesAsGroupedExpression: + Exclude: + - 'test/clock_test.rb' + - 'test/execution_plan_test.rb' + - 'test/future_execution_test.rb' + +# Offense count: 3 +Lint/RescueException: + Exclude: + - 'lib/dynflow/action.rb' + - 'lib/dynflow/delayed_executors/abstract_core.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + +# Offense count: 1 +Lint/ShadowingOuterLocalVariable: + Exclude: + - 'lib/dynflow/logger_adapters/abstract.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/SpaceBeforeFirstArg: + Exclude: + - 'test/action_test.rb' + +# Offense count: 1 +Lint/UnderscorePrefixedVariableName: + Exclude: + - 'lib/dynflow/utils.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +Lint/UnusedBlockArgument: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/config.rb' + - 'lib/dynflow/dispatcher/client_dispatcher.rb' + - 'lib/dynflow/execution_plan/dependency_graph.rb' + - 'lib/dynflow/executors/parallel/work_queue.rb' + - 'lib/dynflow/middleware/register.rb' + - 'lib/dynflow/middleware/resolver.rb' + - 'lib/dynflow/testing/dummy_executor.rb' + - 'lib/dynflow/web/console.rb' + - 'lib/dynflow/web/filtering_helpers.rb' + - 'test/executor_test.rb' + +# Offense count: 69 +# Cop supports --auto-correct. +Lint/UnusedMethodArgument: + Enabled: false + +# Offense count: 3 +Lint/UselessAccessModifier: + Exclude: + - 'lib/dynflow/execution_plan/output_reference.rb' + - 'lib/dynflow/execution_plan/steps/abstract.rb' + - 'lib/dynflow/flows/atom.rb' + +# Offense count: 3 +Lint/UselessAssignment: + Exclude: + - 'doc/pages/plugins/plantuml.rb' + - 'lib/dynflow/executors/parallel.rb' + - 'lib/dynflow/world.rb' + +# Offense count: 65 +Metrics/AbcSize: + Max: 174 + +# Offense count: 8 +# Configuration parameters: CountComments. +Metrics/ClassLength: + Max: 402 + +# Offense count: 10 +Metrics/CyclomaticComplexity: + Max: 11 + +# Offense count: 498 +# Configuration parameters: AllowURI, URISchemes. +Metrics/LineLength: + Max: 212 + +# Offense count: 96 +# Configuration parameters: CountComments. +Metrics/MethodLength: + Max: 90 + +# Offense count: 12 +# Configuration parameters: CountComments. +Metrics/ModuleLength: + Max: 548 + +# Offense count: 3 +# Configuration parameters: CountKeywordArgs. +Metrics/ParameterLists: + Max: 13 + +# Offense count: 8 +Metrics/PerceivedComplexity: + Max: 11 + +# Offense count: 3 +Style/AccessorMethodName: + Exclude: + - 'lib/dynflow/action.rb' + - 'lib/dynflow/executors/parallel/core.rb' + - 'lib/dynflow/testing.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/Alias: + Exclude: + - 'lib/dynflow/testing/assertions.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles. +Style/AlignHash: + Exclude: + - 'test/persistence_test.rb' + +# Offense count: 17 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/AlignParameters: + Exclude: + - 'lib/dynflow/dispatcher/client_dispatcher.rb' + - 'lib/dynflow/execution_plan.rb' + - 'lib/dynflow/world.rb' + - 'test/action_test.rb' + - 'test/test_helper.rb' + +# Offense count: 11 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/AndOr: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'lib/dynflow/action.rb' + - 'lib/dynflow/action/with_sub_plans.rb' + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/executors/parallel/execution_plan_manager.rb' + - 'lib/dynflow/middleware.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/BarePercentLiterals: + Exclude: + - 'doc/pages/plugins/tags.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. +Style/BlockDelimiters: + Enabled: false + +# Offense count: 17 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/BracesAroundHashParameters: + Exclude: + - 'test/action_test.rb' + - 'test/dispatcher_test.rb' + - 'test/execution_plan_test.rb' + - 'test/executor_test.rb' + - 'test/future_execution_test.rb' + - 'test/testing_test.rb' + +# Offense count: 13 +Style/CaseEquality: + Exclude: + - 'lib/dynflow/action/cancellable.rb' + - 'lib/dynflow/clock.rb' + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/connectors/direct.rb' + - 'lib/dynflow/dispatcher/client_dispatcher.rb' + - 'lib/dynflow/executors/parallel/running_steps_manager.rb' + - 'lib/dynflow/logger_adapters/formatters/exception.rb' + - 'lib/dynflow/serializer.rb' + - 'test/abnormal_states_recovery_test.rb' + - 'test/support/rescue_example.rb' + +# Offense count: 25 +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/ClassAndModuleChildren: + Enabled: false + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/ClassCheck: + Exclude: + - 'lib/dynflow/testing/mimic.rb' + - 'lib/dynflow/utils.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/ColonMethodCall: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'doc/pages/plugins/plantuml.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: Keywords. +Style/CommentAnnotation: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow.rb' + - 'lib/dynflow/execution_plan.rb' + - 'lib/dynflow/world.rb' + - 'test/support/code_workflow_example.rb' + +# Offense count: 2 +Style/ConstantName: + Exclude: + - 'lib/dynflow/executors/parallel.rb' + - 'test/executor_test.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/DeprecatedHashMethods: + Exclude: + - 'lib/dynflow/executors/parallel/pool.rb' + - 'lib/dynflow/middleware/resolver.rb' + - 'lib/dynflow/world.rb' + +# Offense count: 233 +Style/Documentation: + Enabled: false + +# Offense count: 20 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/DotPosition: + Enabled: false + +# Offense count: 3 +Style/DoubleNegation: + Exclude: + - 'lib/dynflow/actor.rb' + - 'lib/dynflow/config.rb' + - 'lib/dynflow/connectors/database.rb' + +# Offense count: 1 +Style/EachWithObject: + Exclude: + - 'lib/dynflow/utils.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/EmptyElse: + Exclude: + - 'lib/dynflow/action.rb' + - 'lib/dynflow/execution_plan.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: AllowAdjacentOneLineDefs. +Style/EmptyLineBetweenDefs: + Exclude: + - 'lib/dynflow/utils.rb' + - 'test/support/dummy_example.rb' + +# Offense count: 13 +# Cop supports --auto-correct. +Style/EmptyLines: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'examples/example_helper.rb' + - 'examples/orchestrate.rb' + - 'examples/sub_plans.rb' + - 'lib/dynflow/execution_plan/steps/finalize_step.rb' + - 'lib/dynflow/execution_plan/steps/plan_step.rb' + - 'lib/dynflow/executors/parallel/sequence_cursor.rb' + - 'test/clock_test.rb' + - 'test/execution_plan_test.rb' + - 'test/executor_test.rb' + - 'test/testing_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/EmptyLinesAroundAccessModifier: + Exclude: + - 'lib/dynflow/utils.rb' + +# Offense count: 87 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/EmptyLinesAroundBlockBody: + Exclude: + - 'test/abnormal_states_recovery_test.rb' + - 'test/action_test.rb' + - 'test/clock_test.rb' + - 'test/dispatcher_test.rb' + - 'test/execution_plan_test.rb' + - 'test/executor_test.rb' + - 'test/future_execution_test.rb' + - 'test/middleware_test.rb' + - 'test/persistence_test.rb' + - 'test/rescue_test.rb' + - 'test/test_helper.rb' + - 'test/testing_test.rb' + - 'test/web_console_test.rb' + +# Offense count: 129 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/EmptyLinesAroundClassBody: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +Style/EmptyLinesAroundMethodBody: + Exclude: + - 'doc/pages/plugins/toc.rb' + - 'test/dispatcher_test.rb' + +# Offense count: 52 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/EmptyLinesAroundModuleBody: + Enabled: false + +# Offense count: 30 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Style/ExtraSpacing: + Enabled: false + +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/FirstParameterIndentation: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/action.rb' + - 'lib/dynflow/executors/parallel/running_steps_manager.rb' + - 'lib/dynflow/testing/dummy_planned_action.rb' + - 'lib/dynflow/testing/factories.rb' + - 'test/executor_test.rb' + +# Offense count: 4 +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/FormatString: + Exclude: + - 'lib/dynflow/coordinator.rb' + - 'lib/dynflow/web/console_helpers.rb' + +# Offense count: 7 +# Configuration parameters: AllowedVariables. +Style/GlobalVars: + Exclude: + - 'test/executor_test.rb' + - 'test/support/dummy_example.rb' + - 'test/testing_test.rb' + +# Offense count: 18 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'doc/pages/plugins/plantuml.rb' + - 'examples/orchestrate_evented.rb' + - 'lib/dynflow/action.rb' + - 'lib/dynflow/clock.rb' + - 'lib/dynflow/config.rb' + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/executors/parallel/execution_plan_manager.rb' + - 'lib/dynflow/executors/parallel/pool.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + - 'lib/dynflow/testing/factories.rb' + - 'lib/dynflow/testing/managed_clock.rb' + - 'lib/dynflow/web/console_helpers.rb' + - 'test/action_test.rb' + - 'test/test_helper.rb' + +# Offense count: 72 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues. +Style/HashSyntax: + Enabled: false + +# Offense count: 22 +# Cop supports --auto-correct. +# Configuration parameters: MaxLineLength. +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/IndentHash: + Enabled: false + +# Offense count: 7 +# Cop supports --auto-correct. +Style/Lambda: + Exclude: + - 'lib/dynflow/action.rb' + - 'lib/dynflow/executors/parallel/execution_plan_manager.rb' + - 'lib/dynflow/testing/mimic.rb' + - 'test/coordinator_test.rb' + - 'test/rescue_test.rb' + - 'test/test_helper.rb' + +# Offense count: 13 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/LambdaCall: + Enabled: false + +# Offense count: 3 +# Cop supports --auto-correct. +Style/LineEndConcatenation: + Exclude: + - 'lib/dynflow/config.rb' + - 'lib/dynflow/testing/assertions.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/MethodCallParentheses: + Exclude: + - 'doc/pages/plugins/plantuml.rb' + - 'lib/dynflow/delayed_executors/abstract_core.rb' + - 'test/dispatcher_test.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/MethodDefParentheses: + Enabled: false + +# Offense count: 6 +Style/MultilineBlockChain: + Exclude: + - 'lib/dynflow/dispatcher/executor_dispatcher.rb' + - 'lib/dynflow/world.rb' + - 'test/executor_test.rb' + - 'test/persistence_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MultilineIfThen: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + +# Offense count: 34 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/MultilineOperationIndentation: + Enabled: false + +# Offense count: 5 +# Cop supports --auto-correct. +Style/NegatedIf: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'doc/pages/plugins/plantuml.rb' + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/actor.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles. +Style/Next: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/world.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/Not: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'doc/pages/plugins/tags.rb' + +# Offense count: 2 +Style/OpMethod: + Exclude: + - 'lib/dynflow/coordinator.rb' + - 'lib/dynflow/testing/mimic.rb' + +# Offense count: 5 +# 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: 23 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + - 'lib/dynflow/web/console_helpers.rb' + - 'lib/dynflow/web_console.rb' + - 'test/middleware_test.rb' + - 'test/support/code_workflow_example.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/PerlBackrefs: + Exclude: + - 'test/support/dummy_example.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +Style/Proc: + Exclude: + - 'examples/remote_executor.rb' + - 'test/abnormal_states_recovery_test.rb' + - 'test/dispatcher_test.rb' + +# Offense count: 4 +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/RaiseArgs: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'examples/remote_executor.rb' + +# Offense count: 41 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Enabled: false + +# Offense count: 80 +# Cop supports --auto-correct. +Style/RedundantSelf: + Enabled: false + +# Offense count: 2 +Style/RescueModifier: + Exclude: + - 'lib/dynflow/serializer.rb' + - 'test/test_helper.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Exclude: + - 'test/abnormal_states_recovery_test.rb' + - 'test/dispatcher_test.rb' + - 'test/executor_test.rb' + +# Offense count: 162 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/SignalException: + Enabled: false + +# Offense count: 5 +# Configuration parameters: Methods. +Style/SingleLineBlockParams: + Exclude: + - 'lib/dynflow/action.rb' + - 'lib/dynflow/execution_plan/output_reference.rb' + - 'lib/dynflow/logger_adapters/abstract.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + - 'lib/dynflow/serializable.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: AllowIfMethodIsEmpty. +Style/SingleLineMethods: + Exclude: + - 'lib/dynflow/utils.rb' + - 'test/support/dummy_example.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/SingleSpaceBeforeFirstArg: + Exclude: + - 'lib/dynflow/persistence_adapters/sequel_migrations/005_envelopes.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: MultiSpaceAllowedForOperators. +Style/SpaceAroundOperators: + Exclude: + - 'doc/pages/plugins/graphviz.rb' + - 'doc/pages/plugins/plantuml.rb' + - 'lib/dynflow/action.rb' + - 'lib/dynflow/action/polling.rb' + - 'lib/dynflow/executors/parallel/execution_plan_manager.rb' + - 'lib/dynflow/executors/parallel/sequence_cursor.rb' + - 'lib/dynflow/round_robin.rb' + - 'lib/dynflow/testing/mimic.rb' + - 'lib/dynflow/web/console_helpers.rb' + - 'test/persistence_test.rb' + - 'test/support/dummy_example.rb' + - 'test/testing_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/SpaceBeforeComma: + Exclude: + - 'test/testing_test.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +Style/SpaceInsideBlockBraces: + Enabled: false + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles. +Style/SpaceInsideHashLiteralBraces: + Enabled: false + +# Offense count: 5 +# Cop supports --auto-correct. +Style/SpaceInsideParens: + Exclude: + - 'lib/dynflow/action/with_sub_plans.rb' + - 'lib/dynflow/persistence_adapters/sequel.rb' + - 'lib/dynflow/utils.rb' + - 'test/executor_test.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/SpaceInsideStringInterpolation: + Exclude: + - 'lib/dynflow/config.rb' + - 'lib/dynflow/connectors/database.rb' + - 'lib/dynflow/connectors/direct.rb' + - 'lib/dynflow/execution_history.rb' + - 'lib/dynflow/web/console_helpers.rb' + - 'test/test_helper.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +Style/SpecialGlobalVars: + Exclude: + - 'dynflow.gemspec' + - 'examples/example_helper.rb' + - 'examples/future_execution.rb' + - 'examples/orchestrate.rb' + - 'examples/orchestrate_evented.rb' + - 'examples/remote_executor.rb' + - 'examples/sub_plans.rb' + +# Offense count: 221 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/StringLiterals: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/StringLiteralsInInterpolation: + Enabled: false + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +Style/SymbolProc: + Exclude: + - 'doc/pages/plugins/tags.rb' + - 'lib/dynflow/action.rb' + - 'lib/dynflow/action/with_sub_plans.rb' + - 'lib/dynflow/execution_plan.rb' + - 'lib/dynflow/executors/parallel/core.rb' + - 'lib/dynflow/executors/parallel/sequence_cursor.rb' + - 'lib/dynflow/world.rb' + - 'test/test_helper.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +Style/TrailingBlankLines: + Exclude: + - 'lib/dynflow/action/format.rb' + - 'lib/dynflow/action/progress.rb' + - 'lib/dynflow/action/rescue.rb' + - 'lib/dynflow/persistence_adapters/sequel_migrations/004_coordinator_records.rb' + - 'lib/dynflow/round_robin.rb' + - 'test/abnormal_states_recovery_test.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist. +Style/TrivialAccessors: + Exclude: + - 'lib/dynflow/executors/parallel/sequential_manager.rb' + - 'test/support/middleware_example.rb' + - 'test/support/test_execution_log.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/UnneededCapitalW: + Exclude: + - 'test/future_execution_test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: MaxLineLength. +Style/WhileUntilModifier: + Exclude: + - 'lib/dynflow/clock.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: WordRegex. +Style/WordArray: + MinSize: 3 diff --git a/.travis.yml b/.travis.yml index 7107ba26..005ed3e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,3 +23,4 @@ install: script: - bundle exec rake test + - bundle exec rubocop diff --git a/Gemfile b/Gemfile index c50b1ed2..c5fe12e3 100644 --- a/Gemfile +++ b/Gemfile @@ -17,3 +17,7 @@ end group :mysql do gem "mysql2" end + +group :lint do + gem 'rubocop', '0.33.0' +end diff --git a/examples/remote_executor.rb b/examples/remote_executor.rb index 68a8e495..aa82394c 100755 --- a/examples/remote_executor.rb +++ b/examples/remote_executor.rb @@ -91,7 +91,7 @@ def run_client puts < @execution_plan_uuid, - :start_at => time_to_str(@start_at), - :start_before => time_to_str(@start_before), - :serialized_args => @args_serializer.serialized_args, - :args_serializer => @args_serializer.class.name + recursive_to_hash :execution_plan_uuid => @execution_plan_uuid, + :start_at => time_to_str(@start_at), + :start_before => time_to_str(@start_before), + :serialized_args => @args_serializer.serialized_args, + :args_serializer => @args_serializer.class.name end # @api private diff --git a/lib/dynflow/executors/parallel/worker.rb b/lib/dynflow/executors/parallel/worker.rb index 72634491..30669d0f 100644 --- a/lib/dynflow/executors/parallel/worker.rb +++ b/lib/dynflow/executors/parallel/worker.rb @@ -15,7 +15,7 @@ def on_message(message) step.execute event end), (on Work::Finalize.(~any, any) do |sequential_manager| - sequential_manager.finalize + sequential_manager.finalize end) rescue Errors::PersistenceError => e @pool.tell([:handle_persistence_error, e]) diff --git a/lib/dynflow/web/console_helpers.rb b/lib/dynflow/web/console_helpers.rb index dbc0a08f..f7100a1c 100644 --- a/lib/dynflow/web/console_helpers.rb +++ b/lib/dynflow/web/console_helpers.rb @@ -17,7 +17,7 @@ def prettyprint(value) value = prettyprint_references(value) if value pretty_value = prettify_value(value) - <<-HTML + <<-HTML
#{h(pretty_value)}
HTML else @@ -68,7 +68,7 @@ def show_world(world_id) def show_action_data(label, value) value_html = prettyprint(value) if !value_html.empty? - <<-HTML + <<-HTML

#{h(label)} #{value_html} diff --git a/test/action_test.rb b/test/action_test.rb index b6fda9c9..c0319b12 100644 --- a/test/action_test.rb +++ b/test/action_test.rb @@ -445,21 +445,21 @@ def run(event = nil) end describe 'cancelling' do - include TestHelpers - - it "sends the cancel event to all actions that are running and support cancelling" do - triggered_plan = world.trigger(ParentAction, count: 2, suspend: true) - plan = wait_for do - plan = world.persistence.load_execution_plan(triggered_plan.id) - if plan.cancellable? - plan - end - end - plan.cancel - triggered_plan.finished.wait - triggered_plan.finished.value.state.must_equal :stopped - triggered_plan.finished.value.result.must_equal :success - end + include TestHelpers + + it "sends the cancel event to all actions that are running and support cancelling" do + triggered_plan = world.trigger(ParentAction, count: 2, suspend: true) + plan = wait_for do + plan = world.persistence.load_execution_plan(triggered_plan.id) + if plan.cancellable? + plan + end + end + plan.cancel + triggered_plan.finished.wait + triggered_plan.finished.value.state.must_equal :stopped + triggered_plan.finished.value.result.must_equal :success + end end end end diff --git a/test/middleware_test.rb b/test/middleware_test.rb index 059b7aa6..6f184a4c 100644 --- a/test/middleware_test.rb +++ b/test/middleware_test.rb @@ -51,12 +51,12 @@ module MiddlewareTest end it "puts the middleware to the beginning of the stack" do - world_with_middleware.trigger(Support::MiddlewareExample::Action, {}).finished.wait - log.must_equal %w[AnotherLogRunMiddleware::before_run - LogRunMiddleware::before_run - run - LogRunMiddleware::after_run - AnotherLogRunMiddleware::after_run] + world_with_middleware.trigger(Support::MiddlewareExample::Action, {}).finished.wait + log.must_equal %w[AnotherLogRunMiddleware::before_run + LogRunMiddleware::before_run + run + LogRunMiddleware::after_run + AnotherLogRunMiddleware::after_run] end end diff --git a/test/rescue_test.rb b/test/rescue_test.rb index 92f23df9..d7d28dd0 100644 --- a/test/rescue_test.rb +++ b/test/rescue_test.rb @@ -123,27 +123,27 @@ def execute(*args) describe 'of plan with skips' do - let :execution_plan do - execute(Example::ComplexActionWithSkip, :error_on_run) - end + let :execution_plan do + execute(Example::ComplexActionWithSkip, :error_on_run) + end - it 'skips the action and continues automatically' do - execution_plan.state.must_equal :stopped - execution_plan.result.must_equal :warning - end + it 'skips the action and continues automatically' do + execution_plan.state.must_equal :stopped + execution_plan.result.must_equal :warning + end end describe 'of plan faild on auto-rescue' do - let :execution_plan do - execute(Example::ActionWithSkip, 1, :error_on_skip) - end + let :execution_plan do + execute(Example::ActionWithSkip, 1, :error_on_skip) + end - it 'tryied to rescue only once' do - execution_plan.state.must_equal :paused - execution_plan.result.must_equal :error - end + it 'tryied to rescue only once' do + execution_plan.state.must_equal :paused + execution_plan.result.must_equal :error + end end @@ -153,10 +153,10 @@ def execute(*args) execute(Example::ComplexActionWithoutSkip, :error_on_run) end - it 'skips the action and continues automatically' do - execution_plan.state.must_equal :paused - execution_plan.result.must_equal :error - end + it 'skips the action and continues automatically' do + execution_plan.state.must_equal :paused + execution_plan.result.must_equal :error + end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 22a201ad..739d0ddf 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -12,14 +12,18 @@ require 'dynflow' require 'dynflow/testing' -begin require 'pry'; rescue LoadError; nil end - require 'support/code_workflow_example' require 'support/middleware_example' require 'support/rescue_example' require 'support/dummy_example' require 'support/test_execution_log' +begin + require 'pry' +rescue LoadError + puts "Pry not installed. Skipping." +end + Concurrent.disable_at_exit_handlers! # To be able to stop a process in some step and perform assertions while paused