diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index c1c0e8c48..000000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Linting - -on: - pull_request: - types: [opened, reopened, edited, synchronize] - paths: - - .github/workflows/lint.yaml - - '**.rb' - -jobs: - - rubocop: - name: Rubocop - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.2 - - name: Install rubocop - run: | - gem install rubocop --version 1.9.1 - gem install rubocop-rake - - name: Run rubocop - run: rubocop --display-cop-names --display-style-guide --parallel diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e2a688692..c312c86ed 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -11,13 +11,31 @@ permissions: contents: read jobs: + rubocop_and_matrix: + runs-on: ubuntu-24.04 + outputs: + ruby: ${{ steps.ruby.outputs.versions }} + steps: + - uses: actions/checkout@v4 + - name: Install Ruby ${{ matrix.ruby }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + - name: Run Rubocop + run: bundle exec rake rubocop + - id: ruby + uses: voxpupuli/ruby-version@v1 unit: + needs: rubocop_and_matrix name: "Ruby ${{ matrix.ruby }} ${{ matrix.os }}" strategy: fail-fast: false matrix: os: [ubuntu-24.04, windows-latest] + # don't generate the matrix dynamically until we switch from puppet to openvox, puppet fails on Ruby 3.4 + #ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }} ruby: ['3.2', '3.3'] runs-on: ${{ matrix.os }} steps: @@ -44,6 +62,7 @@ jobs: tests: needs: + - rubocop_and_matrix - unit runs-on: ubuntu-24.04 name: Test suite diff --git a/.rubocop.yml b/.rubocop.yml index 4543ad5bb..eb8aa56ed 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,352 +1,8 @@ -require: - - rubocop-rake +--- +inherit_from: .rubocop_todo.yml -AllCops: - NewCops: enable - Exclude: - - Boltdir/**/* - - vendor/**/* - - vendored/**/* - - acceptance/vendor/**/* - - modules/**/* - - docs/**/* - - site-modules/**/* - - tasks/**/* - SuggestExtensions: false - TargetRubyVersion: 2.5 - -# Layout cops -# https://docs.rubocop.org/rubocop/cops_layout.html - -Layout/BeginEndAlignment: - Enabled: true - -Layout/ClosingHeredocIndentation: - Enabled: false - -Layout/EmptyLineAfterGuardClause: - Enabled: false - -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: true - -Layout/EndOfLine: - EnforcedStyle: lf - -Layout/HashAlignment: - EnforcedColonStyle: - - key - - table - EnforcedHashRocketStyle: - - key - - table - -Layout/HeredocIndentation: - Enabled: false - -Layout/LineLength: - Max: 120 - -Layout/SpaceAroundMethodCallOperator: - Enabled: true - -Layout/SpaceBeforeBrackets: - Enabled: true - -Layout/TrailingWhitespace: - AllowInHeredoc: true - -# Lint cops -# https://docs.rubocop.org/rubocop/cops_lint.html - -Lint/AmbiguousAssignment: - Enabled: true - -Lint/BinaryOperatorWithIdenticalOperands: - Enabled: true - -Lint/ConstantDefinitionInBlock: - Enabled: true - -Lint/DeprecatedConstants: - Enabled: true - -Lint/DeprecatedOpenSSLConstant: - Enabled: true - -Lint/DuplicateBranch: - Enabled: true - -Lint/DuplicateElsifCondition: - Enabled: true - -Lint/DuplicateRegexpCharacterClassElement: - Enabled: true - -Lint/DuplicateRequire: - Enabled: true - -Lint/DuplicateRescueException: - Enabled: true - -Lint/EmptyBlock: - Enabled: true - Exclude: - - bolt-modules/**/lib/puppet/functions/**/* - - lib/bolt/transport/orch.rb - - spec/**/* - -Lint/EmptyClass: - Enabled: true - -Lint/EmptyConditionalBody: - Enabled: true - -Lint/EmptyFile: - Enabled: true - -Lint/FloatComparison: - Enabled: true - -Lint/HashCompareByIdentity: - Enabled: false - -Lint/IdentityComparison: - Enabled: true - -Lint/LambdaWithoutLiteralBlock: - Enabled: true - -Lint/MissingSuper: - Enabled: false - -Lint/MixedRegexpCaptureTypes: - Enabled: false - -Lint/NoReturnInBeginEndBlocks: - Enabled: true - -Lint/OutOfRangeRegexpRef: - Enabled: true - -Lint/RaiseException: - Enabled: true - -Lint/RedundantDirGlobSort: - Enabled: true - -Lint/RedundantSafeNavigation: - Enabled: true - -Lint/SelfAssignment: - Enabled: true - -Lint/StructNewOverride: - Enabled: true - -Lint/SuppressedException: - Exclude: - - lib/bolt/shell/bash.rb - - lib/bolt/module_installer.rb - -Lint/ToEnumArguments: - Enabled: true - -Lint/TopLevelReturnWithArgument: - Enabled: true - -Lint/TrailingCommaInAttributeDeclaration: - Enabled: true - -Lint/UnexpectedBlockArity: - Enabled: true - -Lint/UnmodifiedReduceAccumulator: - Enabled: true - -Lint/UnreachableLoop: - Enabled: true - -Lint/UselessMethodDefinition: - Enabled: false - -Lint/UselessTimes: - Enabled: true - -# Metrics cops -# https://docs.rubocop.org/rubocop/cops_metrics.html - -Metrics/AbcSize: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Metrics/BlockNesting: - Enabled: false - -Metrics/ClassLength: - Enabled: false +inherit_gem: + voxpupuli-rubocop: rubocop.yml -Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - Enabled: false - -Metrics/ParameterLists: - Enabled: false - -Metrics/PerceivedComplexity: - Enabled: false - -# Style cops -# https://docs.rubocop.org/rubocop/cops_style.html - -Style/AccessModifierDeclarations: - Enabled: false - -Style/AccessorGrouping: - Enabled: true - -Style/ArgumentsForwarding: - Enabled: true - -Style/ArrayCoercion: - Enabled: true - -Style/BisectedAttrAccessor: - Enabled: true - -Style/BlockDelimiters: - Enabled: false - -Style/CaseLikeIf: - Enabled: true - -Style/CollectionCompact: - Enabled: true - -Style/ClassEqualityComparison: - Enabled: true - -Style/CombinableLoops: - Enabled: true - -Style/Documentation: - Enabled: false - -Style/DocumentDynamicEvalDefinition: - Enabled: true - -Style/DoubleNegation: - Enabled: false - -Style/EndlessMethod: - Enabled: true - -Style/ExplicitBlockArgument: - Enabled: false - -Style/ExponentialNotation: - Enabled: true - -Style/GlobalStdStream: - Enabled: true - -Style/GuardClause: - Enabled: false - -Style/HashAsLastArrayItem: - Enabled: false - -Style/HashEachMethods: - Enabled: true - -Style/HashExcept: - Enabled: true - -Style/HashLikeCase: - Enabled: true - -Style/HashTransformKeys: - Enabled: true - -Style/HashTransformValues: - Enabled: true - -Style/IfUnlessModifier: - Enabled: false - -Style/KeywordParametersOrder: - Enabled: true - -Style/MultilineBlockChain: - Enabled: false - -Style/NegatedIfElseCondition: - Enabled: true - -Style/NilLambda: - Enabled: true - -Style/NumericLiterals: - Enabled: false - -Style/NumericPredicate: - Enabled: false - -Style/OptionalBooleanParameter: - Enabled: false - -Style/RedundantArgument: - Enabled: true - -Style/RedundantAssignment: - Enabled: true - -Style/RedundantFetchBlock: - Enabled: true - -Style/RedundantFileExtensionInRequire: - Enabled: true - -Style/RedundantRegexpCharacterClass: - Enabled: true - -Style/RedundantRegexpEscape: - Enabled: true - -Style/RedundantSelfAssignment: - Enabled: true - -Style/RegexpLiteral: - Enabled: true - EnforcedStyle: mixed - -Style/SafeNavigation: - Enabled: false - -Style/SingleArgumentDig: - Enabled: false - -Style/SlicingWithRange: - Enabled: false - -Style/SoleNestedConditional: - Enabled: false - -Style/StderrPuts: - Enabled: false - -Style/StringConcatenation: - Enabled: false - -Style/StringLiterals: - Enabled: false - -Style/SwapValues: - Enabled: true +AllCops: + TargetRubyVersion: '3.2' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..ca47f78ce --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,1208 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --no-auto-gen-timestamp` +# using RuboCop version 1.75.8. +# 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: 15 +# This cop supports safe autocorrection (--autocorrect). +Layout/ClosingHeredocIndentation: + Exclude: + - 'acceptance/setup/common/pre-suite/010_install_ruby.rb' + - 'acceptance/tests/apply_plan_ssh.rb' + - 'lib/bolt/inventory/group.rb' + - 'scripts/server_client.rb' + - 'spec/integration/transport/winrm_spec.rb' + - 'spec/pal/result_set_spec.rb' + - 'spec/pal/result_spec.rb' + - 'spec/shared_examples/transport.rb' + - 'spec/unit/pal/yaml_plan/step_spec.rb' + - 'spec/unit/pal_spec.rb' + - 'spec/unit/util/format_spec.rb' + +# Offense count: 124 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + EnforcedStyle: special_inside_parentheses + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/FirstHashElementIndentation: + EnforcedStyle: special_inside_parentheses + +# Offense count: 664 +# This cop supports safe autocorrection (--autocorrect). +# 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 + +# Offense count: 54 +# This cop supports safe autocorrection (--autocorrect). +Layout/HeredocIndentation: + Enabled: false + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: leading, trailing +Layout/LineContinuationLeadingSpace: + Exclude: + - 'lib/bolt/config/transport/options.rb' + - 'lib/bolt/pal/yaml_plan/parameter.rb' + - 'rakelib/docs.rake' + - 'spec/unit/pal/yaml_plan/step_spec.rb' + +# Offense count: 252 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/LineContinuationSpacing: + Enabled: false + +# Offense count: 24 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Enabled: false + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: space + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - 'modules/aggregate/lib/puppet/functions/aggregate/nodes.rb' + - 'modules/aggregate/spec/functions/nodes_spec.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'lib/bolt/bolt_option_parser.rb' + - 'lib/bolt/module_installer/puppetfile.rb' + - 'lib/bolt/outputter/human.rb' + - 'lib/bolt/pal/yaml_plan/step/resources.rb' + - 'lib/bolt/plan_creator.rb' + - 'spec/integration/transport/winrm_spec.rb' + - 'spec/unit/outputter/human_spec.rb' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'lib/bolt/outputter/rainbow.rb' + - 'lib/bolt/pal/yaml_plan/parameter.rb' + - 'spec/integration/transport/winrm_spec.rb' + +# Offense count: 27 +# Configuration parameters: AllowComments, AllowEmptyLambdas. +Lint/EmptyBlock: + Enabled: false + +# Offense count: 4 +Lint/HashCompareByIdentity: + Exclude: + - 'lib/bolt/util.rb' + +# Offense count: 3 +# Configuration parameters: AllowedParentClasses. +Lint/MissingSuper: + Exclude: + - 'lib/bolt/apply_result.rb' + - 'lib/bolt/transport/podman/connection.rb' + - 'spec/unit/logger_spec.rb' + +# Offense count: 2 +Lint/MixedRegexpCaptureTypes: + Exclude: + - 'rakelib/docs.rake' + - 'rakelib/pwsh.rake' + +# Offense count: 11 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/NonAtomicFileOperation: + Exclude: + - 'lib/bolt/cli.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt/rerun.rb' + - 'rakelib/pwsh.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/RedundantCopDisableDirective: + Exclude: + - 'lib/bolt/apply_inventory.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +Lint/RedundantRequireStatement: + Exclude: + - 'lib/bolt/executor.rb' + - 'lib/bolt/inventory.rb' + - 'lib/bolt/module_installer/specs/forge_spec.rb' + - 'lib/bolt/module_installer/specs/git_spec.rb' + - 'lib/bolt/plan_future.rb' + - 'lib/bolt_spec/plans/mock_executor.rb' + +# Offense count: 3 +# Configuration parameters: AllowComments, AllowNil. +Lint/SuppressedException: + Exclude: + - 'lib/bolt/shell/bash.rb' + +# Offense count: 1 +Lint/UselessConstantScoping: + Exclude: + - 'lib/bolt/transport/winrm/connection.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, BlockForwardingName. +# SupportedStyles: anonymous, explicit +Naming/BlockForwarding: + Exclude: + - 'lib/bolt/executor.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt_server/file_cache.rb' + - 'lib/bolt_spec/bolt_context.rb' + +# Offense count: 15 +# Configuration parameters: MinSize. +Performance/CollectionLiteralInLoop: + Exclude: + - 'bolt-modules/boltlib/lib/puppet/functions/wait.rb' + - 'lib/bolt/apply_result.rb' + - 'lib/bolt/fiber_executor.rb' + - 'lib/bolt/outputter/human.rb' + - 'lib/bolt/result.rb' + - 'lib/bolt/transport/orch.rb' + - 'lib/bolt/transport/winrm/connection.rb' + - 'libexec/apply_catalog.rb' + - 'rakelib/pwsh.rake' + - 'rakelib/schemas.rake' + - 'spec/unit/executor_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Performance/CompareWithBlock: + Exclude: + - 'rakelib/docs.rake' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Performance/ConstantRegexp: + Exclude: + - 'spec/unit/cli_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/Count: + Exclude: + - 'spec/integration/apply_spec.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/Detect: + Exclude: + - 'acceptance/tests/apply_plan_ssh.rb' + - 'lib/bolt/fiber_executor.rb' + - 'lib/bolt/transport/jail/connection.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IncludeActiveSupportAliases. +Performance/DoubleStartEndWith: + Exclude: + - 'lib/bolt/outputter/human.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/InefficientHashSearch: + Exclude: + - 'lib/bolt/project_manager/config_migrator.rb' + - 'lib/bolt/transport/local/connection.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/MapCompact: + Exclude: + - 'lib/bolt/applicator.rb' + - 'lib/bolt_spec/plans/mock_executor.rb' + +# Offense count: 3 +Performance/MapMethodChain: + Exclude: + - 'lib/bolt/outputter/human.rb' + - 'spec/unit/executor_spec.rb' + +# Offense count: 6 +Performance/MethodObjectAsBlock: + Exclude: + - 'lib/bolt/executor.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Performance/RedundantMatch: + Exclude: + - 'lib/bolt/bolt_option_parser.rb' + +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: MaxKeyValuePairs. +Performance/RedundantMerge: + Exclude: + - 'lib/bolt/plugin/cache.rb' + - 'lib/bolt/project_manager/module_migrator.rb' + - 'spec/unit/inventory/inventory_spec.rb' + - 'spec/unit/plugin_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Performance/RedundantStringChars: + Exclude: + - 'lib/bolt/config/transport/base.rb' + +# Offense count: 35 +# This cop supports safe autocorrection (--autocorrect). +Performance/RegexpMatch: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Performance/Size: + Exclude: + - 'lib/bolt/validator.rb' + +# Offense count: 20 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/StringInclude: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Performance/StringReplacement: + Exclude: + - 'rakelib/docs.rake' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: OnlySumOrWithInitialValue. +Performance/Sum: + Exclude: + - 'lib/bolt/executor.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/TimesMap: + Exclude: + - 'spec/bolt_server/file_cache_spec.rb' + +# Offense count: 13 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/UnfreezeString: + Exclude: + - 'lib/bolt/cli.rb' + - 'lib/bolt/module_installer/specs.rb' + - 'lib/bolt/outputter/rainbow.rb' + - 'lib/bolt/pal/yaml_plan/parameter.rb' + - 'lib/bolt/pal/yaml_plan/step.rb' + - 'lib/bolt/pal/yaml_plan/step/eval.rb' + - 'lib/bolt/pal/yaml_plan/transpiler.rb' + - 'lib/bolt/plugin/puppetdb.rb' + - 'lib/bolt/shell/bash.rb' + - 'lib/bolt/util.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Performance/ZipWithoutBlock: + Exclude: + - 'lib/bolt/transport/base.rb' + +# Offense count: 33 +RSpec/AnyInstance: + Enabled: false + +# Offense count: 45 +RSpec/Be: + Enabled: false + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect. +RSpec/BeEmpty: + Exclude: + - 'spec/unit/project_manager/module_migrator_spec.rb' + +# Offense count: 103 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEql: + Exclude: + - 'modules/puppet_connect/spec/plans/test_input_data_spec.rb' + +# Offense count: 17 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: be, be_nil +RSpec/BeNil: + Exclude: + - 'spec/unit/apply_result_spec.rb' + - 'spec/unit/inventory/inventory_spec.rb' + - 'spec/unit/module_installer/puppetfile/forge_module_spec.rb' + - 'spec/unit/project_manager/module_migrator_spec.rb' + - 'spec/unit/target_spec.rb' + +# Offense count: 27 +RSpec/BeforeAfterAll: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: be_a, be_kind_of +RSpec/ClassCheck: + Exclude: + - 'spec/integration/puppetdb/puppetdb_spec.rb' + +# Offense count: 70 +# This cop supports safe autocorrection (--autocorrect). +RSpec/ContextMethod: + Enabled: false + +# Offense count: 341 +# Configuration parameters: Prefixes, AllowedPatterns. +# Prefixes: when, with, without +RSpec/ContextWording: + Enabled: false + +# Offense count: 120 +# Configuration parameters: IgnoredMetadata. +RSpec/DescribeClass: + Enabled: false + +# Offense count: 28 +RSpec/DescribeSymbol: + Exclude: + - 'spec/integration/pal_spec.rb' + - 'spec/integration/transport/orch_spec.rb' + - 'spec/unit/apply_result_spec.rb' + - 'spec/unit/inventory/inventory_spec.rb' + - 'spec/unit/inventory_spec.rb' + - 'spec/unit/pal_spec.rb' + - 'spec/unit/plan_future_spec.rb' + - 'spec/unit/plugin/module_spec.rb' + - 'spec/unit/result_spec.rb' + +# Offense count: 283 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. +# SupportedStyles: described_class, explicit +RSpec/DescribedClass: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterExampleGroup: + Exclude: + - 'spec/bolt_server/transport_app_spec.rb' + +# Offense count: 43 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterFinalLet: + Enabled: false + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterHook: + Exclude: + - 'spec/integration/local_spec.rb' + - 'spec/integration/transpiler_spec.rb' + - 'spec/unit/executor_spec.rb' + - 'spec/unit/fiber_executor_spec.rb' + - 'spec/unit/pal_spec.rb' + +# Offense count: 729 +# Configuration parameters: CountAsOne. +RSpec/ExampleLength: + Max: 42 + +# Offense count: 182 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. +# DisallowedExamples: works +RSpec/ExampleWording: + Enabled: false + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +RSpec/ExcessiveDocstringSpacing: + Exclude: + - 'spec/bolt_server/config_spec.rb' + - 'spec/integration/transport/winrm_spec.rb' + - 'spec/unit/plugin/puppetdb_spec.rb' + +# Offense count: 35 +RSpec/ExpectInHook: + Exclude: + - 'spec/bolt_spec/run_spec.rb' + - 'spec/integration/logging_spec.rb' + - 'spec/integration/modules/write_file_spec.rb' + - 'spec/integration/transport/orch_spec.rb' + - 'spec/unit/cli_spec.rb' + +# Offense count: 283 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + Enabled: false + +# Offense count: 2 +RSpec/IdenticalEqualityAssertion: + Exclude: + - 'spec/unit/application_spec.rb' + +# Offense count: 381 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit +RSpec/ImplicitSubject: + Enabled: false + +# Offense count: 74 +# This cop supports safe autocorrection (--autocorrect). +RSpec/IncludeExamples: + Enabled: false + +# Offense count: 16 +# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns. +RSpec/IndexedLet: + Exclude: + - 'bolt-modules/boltlib/spec/functions/remove_from_group_spec.rb' + - 'spec/unit/executor_spec.rb' + - 'spec/unit/module_installer/specs_spec.rb' + - 'spec/unit/outputter/json_spec.rb' + - 'spec/unit/project_manager/inventory_migrator_spec.rb' + - 'spec/unit/result_set_spec.rb' + - 'spec/unit/util/format_spec.rb' + +# Offense count: 257 +# Configuration parameters: AssignmentOnly. +RSpec/InstanceVariable: + Enabled: false + +# Offense count: 11 +RSpec/IteratedExpectation: + Exclude: + - 'spec/integration/parallel_spec.rb' + - 'spec/unit/executor_spec.rb' + - 'spec/unit/fiber_executor_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +RSpec/LeadingSubject: + Exclude: + - 'spec/unit/analytics_spec.rb' + +# Offense count: 20 +# This cop supports safe autocorrection (--autocorrect). +RSpec/MatchArray: + Exclude: + - 'spec/integration/project_spec.rb' + - 'spec/shared_examples/transport.rb' + - 'spec/unit/bolt_option_parser_spec.rb' + - 'spec/unit/logger_spec.rb' + - 'spec/unit/module_installer/installer_spec.rb' + - 'spec/unit/module_installer_spec.rb' + - 'spec/unit/project_manager/module_migrator_spec.rb' + - 'spec/unit/target_spec.rb' + - 'spec/unit/transport/ssh/connection_spec.rb' + +# Offense count: 364 +# Configuration parameters: . +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + EnforcedStyle: receive + +# Offense count: 160 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: hash, symbol +RSpec/MetadataStyle: + Enabled: false + +# Offense count: 4 +RSpec/MultipleDescribes: + Exclude: + - 'spec/integration/cli/cli_spec.rb' + - 'spec/integration/logging_spec.rb' + - 'spec/unit/analytics_spec.rb' + - 'spec/unit/config/options_spec.rb' + +# Offense count: 723 +RSpec/MultipleExpectations: + Max: 9 + +# Offense count: 681 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 27 + +# Offense count: 143 +# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. +# SupportedStyles: always, named_only +RSpec/NamedSubject: + Exclude: + - 'bolt-modules/prompt/spec/functions/prompt_spec.rb' + - 'spec/unit/analytics_spec.rb' + - 'spec/unit/pal/yaml_plan/evaluator_spec.rb' + - 'spec/unit/plan_creator_spec.rb' + - 'spec/unit/plugin/env_var_spec.rb' + - 'spec/unit/plugin/prompt_spec.rb' + - 'spec/unit/plugin/puppet_connect_data_spec.rb' + - 'spec/unit/transport/local_spec.rb' + - 'spec/unit/transport/ssh/connection_spec.rb' + - 'spec/unit/transport/ssh/exec_connection_spec.rb' + +# Offense count: 114 +# Configuration parameters: AllowedGroups. +RSpec/NestedGroups: + Max: 5 + +# Offense count: 8 +# Configuration parameters: AllowedPatterns. +# AllowedPatterns: ^expect_, ^assert_ +RSpec/NoExpectationExample: + Exclude: + - 'spec/integration/parallel_spec.rb' + - 'spec/integration/private_plan_spec.rb' + - 'spec/unit/analytics_spec.rb' + - 'spec/unit/pal/yaml_plan/evaluator_spec.rb' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: + Exclude: + - 'spec/integration/transport/winrm_spec.rb' + - 'spec/unit/applicator_spec.rb' + - 'spec/unit/plugin/puppet_library_spec.rb' + +# Offense count: 29 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/ReceiveMessages: + Exclude: + - 'spec/integration/cli/rerun_spec.rb' + - 'spec/integration/puppetdb/client_spec.rb' + - 'spec/unit/cli_spec.rb' + - 'spec/unit/executor_spec.rb' + - 'spec/unit/inventory/inventory_spec.rb' + - 'spec/unit/plugin/puppetdb_spec.rb' + - 'spec/unit/project_spec.rb' + - 'spec/unit/shell/powershell_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +RSpec/ReceiveNever: + Exclude: + - 'spec/integration/puppetdb/client_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +RSpec/RedundantPredicateMatcher: + Exclude: + - 'spec/unit/target_spec.rb' + +# Offense count: 26 +RSpec/RepeatedDescription: + Exclude: + - 'bolt-modules/boltlib/spec/functions/get_resources_spec.rb' + - 'spec/integration/fail_plan_spec.rb' + - 'spec/integration/parsing_spec.rb' + - 'spec/integration/plan_spec.rb' + - 'spec/integration/run_as_spec.rb' + - 'spec/integration/transport/winrm_spec.rb' + - 'spec/pal/apply_result_spec.rb' + - 'spec/pal/result_spec.rb' + - 'spec/unit/config/transport/ssh_spec.rb' + - 'spec/unit/config/transport/winrm_spec.rb' + - 'spec/unit/pal/yaml_plan_spec.rb' + - 'spec/unit/plugin/module_spec.rb' + +# Offense count: 6 +RSpec/RepeatedExample: + Exclude: + - 'spec/integration/policy_spec.rb' + - 'spec/integration/private_plan_spec.rb' + - 'spec/integration/project_spec.rb' + +# Offense count: 11 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/bolt_server/transport_app_spec.rb' + - 'spec/integration/docker_spec.rb' + - 'spec/integration/pal_spec.rb' + - 'spec/unit/plan_future_spec.rb' + - 'spec/unit/plugin/puppet_library_spec.rb' + +# Offense count: 13 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect. +RSpec/ScatteredLet: + Exclude: + - 'bolt-modules/boltlib/spec/functions/set_resources_spec.rb' + - 'spec/integration/inventory_spec.rb' + - 'spec/integration/transport/orch_spec.rb' + - 'spec/unit/applicator_spec.rb' + - 'spec/unit/executor_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +RSpec/SortMetadata: + Exclude: + - 'spec/integration/apply_error_spec.rb' + - 'spec/integration/inventory_spec.rb' + +# Offense count: 80 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. +# Include: **/*_spec.rb +RSpec/SpecFilePathFormat: + Enabled: false + +# Offense count: 3 +# Configuration parameters: Include. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/SpecFilePathSuffix: + Exclude: + - 'bolt-modules/boltlib/spec/functions/puppetdb_fact.rb' + - 'bolt-modules/boltlib/spec/functions/puppetdb_query.rb' + - 'spec/integration/task_param.rb' + +# Offense count: 127 +RSpec/StubbedMock: + Enabled: false + +# Offense count: 3 +RSpec/SubjectDeclaration: + Exclude: + - 'spec/unit/plugin/puppet_connect_data_spec.rb' + - 'spec/unit/transport/ssh/connection_spec.rb' + - 'spec/unit/transport/ssh/exec_connection_spec.rb' + +# Offense count: 20 +RSpec/SubjectStub: + Exclude: + - 'spec/unit/analytics_spec.rb' + - 'spec/unit/transport/ssh/connection_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symbols, strings +RSpec/VariableDefinition: + Exclude: + - 'spec/integration/plugin/task_spec.rb' + +# Offense count: 7 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/VerifiedDoubleReference: + Exclude: + - 'spec/integration/transport/orch_spec.rb' + - 'spec/lib/bolt_spec/logger.rb' + - 'spec/unit/applicator_spec.rb' + - 'spec/unit/inventory/group_spec.rb' + +# Offense count: 111 +# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. +RSpec/VerifiedDoubles: + Enabled: false + +# Offense count: 2 +RSpec/VoidExpect: + Exclude: + - 'spec/bolt_server/app_integration_spec.rb' + - 'spec/unit/plugin/env_var_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +RSpec/Yield: + Exclude: + - 'spec/unit/application_spec.rb' + - 'spec/unit/cli_spec.rb' + +# Offense count: 52 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols, AllowModifiersOnAttrs, AllowModifiersOnAliasMethod. +# SupportedStyles: inline, group +Style/AccessModifierDeclarations: + Enabled: false + +# Offense count: 30 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. +# RedundantRestArgumentNames: args, arguments +# RedundantKeywordRestArgumentNames: kwargs, options, opts +# RedundantBlockArgumentNames: blk, block, proc +Style/ArgumentsForwarding: + Exclude: + - 'lib/bolt/config/transport/base.rb' + - 'lib/bolt/error.rb' + - 'lib/bolt/executor.rb' + - 'lib/bolt/outputter/json.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt/plan_result.rb' + - 'lib/bolt_server/file_cache.rb' + - 'lib/bolt_spec/bolt_context.rb' + - 'spec/lib/bolt_spec/integration.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ArrayIntersect: + Exclude: + - 'bolt-modules/boltlib/lib/puppet/functions/download_file.rb' + +# Offense count: 273 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, 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: + Enabled: false + +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ConcatArrayLiterals: + Exclude: + - 'lib/bolt/cli.rb' + - 'spec/integration/cli/cli_spec.rb' + - 'spec/unit/module_installer_spec.rb' + +# Offense count: 193 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Enabled: false + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: allowed_in_returns, forbidden +Style/DoubleNegation: + Exclude: + - 'lib/bolt/executor.rb' + - 'lib/bolt/task.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/EnvHome: + Exclude: + - 'lib/bolt/puppetdb/config.rb' + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +Style/ExplicitBlockArgument: + Exclude: + - 'bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb' + - 'lib/bolt/executor.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt/plugin.rb' + - 'lib/bolt/result_set.rb' + - 'spec/lib/bolt_spec/errors.rb' + +# Offense count: 17 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedVars. +Style/FetchEnvVar: + Exclude: + - 'acceptance/Rakefile' + - 'acceptance/setup/package/pre-suite/020_install.rb' + - 'bolt-modules/system/lib/puppet/functions/system/env.rb' + - 'bolt-modules/system/spec/functions/system/env_spec.rb' + - 'developer-docs/examples/bolt_spec_example/tasks/init.rb' + - 'lib/bolt/applicator.rb' + - 'lib/bolt/config.rb' + - 'lib/bolt/plugin/env_var.rb' + - 'lib/bolt/puppetdb/config.rb' + - 'lib/bolt_server/config.rb' + - 'scripts/generate_changelog.rb' + - 'spec/integration/local_spec.rb' + - 'spec/lib/bolt_spec/env_var.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/FileEmpty: + Exclude: + - 'lib/bolt/util.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/FileNull: + Exclude: + - 'lib/bolt/puppetdb/config.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +Style/FileRead: + Exclude: + - 'lib/bolt/transport/orch.rb' + - 'libexec/bolt_catalog' + - 'spec/integration/local_spec.rb' + - 'spec/integration/transport/ssh_spec.rb' + - 'spec/integration/winrm_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/FileWrite: + Exclude: + - 'lib/bolt_server/file_cache.rb' + - 'spec/lib/bolt_spec/pal.rb' + +# Offense count: 107 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Enabled: false + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: braces, no_braces +Style/HashAsLastArrayItem: + Exclude: + - 'lib/bolt/config.rb' + - 'lib/bolt/inventory.rb' + - 'lib/bolt/project.rb' + - 'spec/unit/applicator_spec.rb' + - 'spec/unit/pal/yaml_plan/evaluator_spec.rb' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'lib/bolt/cli.rb' + - 'lib/bolt/transport/orch.rb' + - 'lib/bolt_server/transport_app.rb' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedReceivers. +# AllowedReceivers: Thread.current +Style/HashEachMethods: + Exclude: + - 'acceptance/Rakefile' + - 'lib/bolt/plugin/module.rb' + - 'lib/bolt/shell/bash.rb' + - 'spec/unit/executor_spec.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/HashExcept: + Exclude: + - 'lib/bolt/module_installer.rb' + - 'lib/bolt/plugin/cache.rb' + - 'lib/bolt/result.rb' + - 'lib/bolt/transport/orch/connection.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/HashSlice: + Exclude: + - 'lib/bolt/transport/orch/connection.rb' + - 'lib/bolt_server/base_config.rb' + +# Offense count: 159 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/MapIntoArray: + Exclude: + - 'lib/bolt_server/acl.rb' + +# Offense count: 7 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/MapToHash: + Exclude: + - 'lib/bolt/config.rb' + - 'lib/bolt/inventory.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt/plugin.rb' + - 'lib/bolt/project.rb' + - 'spec/lib/bolt_spec/env_var.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMethodComparison, ComparisonsThreshold. +Style/MultipleComparison: + Exclude: + - 'lib/bolt/cli.rb' + +# Offense count: 41 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/bolt/bolt_option_parser.rb' + +# Offense count: 32 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. +Style/NumericLiterals: + MinDigits: 7 + +# Offense count: 14 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'acceptance/setup/common/pre-suite/031_add_local_nix_user.rb' + - 'acceptance/tests/apply_plan_winrm.rb' + - 'lib/bolt/executor.rb' + - 'lib/bolt/outputter/human.rb' + - 'lib/bolt/plugin/cache.rb' + - 'lib/bolt/puppetdb/config.rb' + - 'lib/bolt/result.rb' + - 'lib/bolt/transport/ssh/connection.rb' + - 'lib/bolt_server/transport_app.rb' + - 'lib/bolt_spec/plans/action_stubs.rb' + - 'libexec/apply_catalog.rb' + +# Offense count: 20 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: same_as_string_literals, single_quotes, double_quotes +Style/QuotedSymbols: + Exclude: + - 'spec/integration/transport/winrm_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantConstantBase: + Exclude: + - 'spec/integration/transport/winrm_spec.rb' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantFreeze: + Exclude: + - 'lib/bolt/inventory/group.rb' + - 'lib/bolt/inventory/inventory.rb' + - 'lib/bolt/inventory/target.rb' + - 'lib/bolt/module.rb' + - 'lib/bolt/module_installer/specs/forge_spec.rb' + - 'lib/bolt/module_installer/specs/git_spec.rb' + - 'lib/bolt/pal/yaml_plan.rb' + - 'libexec/query_resources.rb' + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantInterpolationUnfreeze: + Exclude: + - 'config/transport_service_config.rb' + - 'lib/bolt/inventory/group.rb' + - 'lib/bolt/outputter/human.rb' + - 'rakelib/pwsh.rake' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantParentheses: + Exclude: + - 'lib/bolt/cli.rb' + - 'lib/bolt/pal.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpArgument: + Exclude: + - 'lib/bolt/pal/yaml_plan/step/eval.rb' + - 'rakelib/docs.rake' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantSelfAssignmentBranch: + Exclude: + - 'lib/bolt/catalog/logging.rb' + - 'lib/bolt_server/transport_app.rb' + - 'rakelib/schemas.rake' + +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Exclude: + - 'bolt-modules/boltlib/spec/functions/run_task_spec.rb' + - 'spec/integration/cli/cli_spec.rb' + - 'spec/integration/parallel_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods, AllowedPatterns. +Style/ReturnNilInPredicateMethodDefinition: + Exclude: + - 'lib/bolt/validator.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/bolt/application.rb' + - 'lib/bolt/module_installer/puppetfile/forge_module.rb' + - 'lib/bolt/pal.rb' + - 'lib/bolt_spec/plans/mock_executor.rb' + - 'rakelib/pwsh.rake' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SelectByRegexp: + Exclude: + - 'rakelib/pwsh.rake' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SingleArgumentDig: + Exclude: + - 'lib/bolt/module_installer/resolver.rb' + - 'lib/bolt/module_installer/specs/git_spec.rb' + - 'spec/shared_examples/transport_config.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/SingleLineDoEndBlock: + Exclude: + - 'spec/unit/transport/local_spec.rb' + +# Offense count: 13 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'acceptance/tests/plan_ssh.rb' + - 'acceptance/tests/plan_winrm.rb' + - 'lib/bolt/config.rb' + - 'lib/bolt/logger.rb' + - 'lib/bolt/module_installer/puppetfile.rb' + - 'lib/bolt/shell/bash.rb' + - 'lib/bolt_spec/plans/mock_executor.rb' + - 'scripts/generate_changelog.rb' + - 'spec/integration/transport/local_spec.rb' + - 'spec/unit/outputter/human_spec.rb' + - 'spec/unit/outputter/rainbow_spec.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'lib/bolt/cli.rb' + - 'lib/bolt/inventory/inventory.rb' + - 'lib/bolt/transport/local/connection.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Style/StderrPuts: + Exclude: + - 'lib/bolt/outputter/json.rb' + - 'lib/bolt/pal/yaml_plan/transpiler.rb' + - 'lib/bolt_spec/plans/action_stubs.rb' + - 'libexec/apply_catalog.rb' + +# Offense count: 157 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Enabled: false + +# Offense count: 3466 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Style/SuperArguments: + Exclude: + - 'lib/bolt/bolt_option_parser.rb' + - 'lib/bolt/config/transport/ssh.rb' + - 'lib/bolt/error.rb' + - 'lib/bolt_spec/plans/action_stubs/plan_stub.rb' + +# Offense count: 30 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Enabled: false + +# Offense count: 539 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Enabled: false + +# Offense count: 246 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Enabled: false + +# Offense count: 1610 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma +Style/TrailingCommaInHashLiteral: + Enabled: false + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/YAMLFileRead: + Exclude: + - 'spec/unit/module_installer_spec.rb' diff --git a/Gemfile b/Gemfile index 2ca669384..fe5a7b2e5 100644 --- a/Gemfile +++ b/Gemfile @@ -27,8 +27,6 @@ group(:test) do gem "beaker-hostgenerator" gem "mocha", '~> 1.4.0' gem "rack-test", '~> 1.0' - gem "rubocop", '~> 1.9.0', require: false - gem "rubocop-rake", require: false end group(:release, optional: true) do diff --git a/Rakefile b/Rakefile index ec1ba6f16..6be3256c0 100644 --- a/Rakefile +++ b/Rakefile @@ -21,3 +21,9 @@ desc "Check for new versions of bundled modules" task :update_modules do sh "scripts/update_modules.rb" end + +begin + require 'voxpupuli/rubocop/rake' +rescue LoadError + # the voxpupuli-rubocop gem is optional +end diff --git a/openbolt.gemspec b/openbolt.gemspec index 04e254b3a..51e09c951 100644 --- a/openbolt.gemspec +++ b/openbolt.gemspec @@ -71,4 +71,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "puppetlabs_spec_helper", ">= 5.0", "< 8" spec.add_development_dependency "rake", ">= 12.0", "< 14" spec.add_development_dependency "rspec", ">= 3.0", "< 4" + spec.add_development_dependency 'voxpupuli-rubocop', '~> 4.1.0' end diff --git a/spec/integration/inventory_spec.rb b/spec/integration/inventory_spec.rb index bd5be4a23..f1f2532bb 100644 --- a/spec/integration/inventory_spec.rb +++ b/spec/integration/inventory_spec.rb @@ -18,29 +18,29 @@ let(:inventory) do { targets: [ - { uri: conn[:host], - config: { - transport: conn[:protocol], - conn[:protocol] => { - user: conn[:user], - port: conn[:port], - 'connect-timeout': conn[:'connect-timeout'] || 120 - } - } }, - { name: 'uriless', - config: { - transport: conn[:protocol], - conn[:protocol] => { - host: conn[:host], - user: conn[:user], - port: conn[:port] - } - } }, - { name: 'hostless', - config: { - transport: conn[:protocol] - } } - ], + { uri: conn[:host], + config: { + transport: conn[:protocol], + conn[:protocol] => { + user: conn[:user], + port: conn[:port], + 'connect-timeout': conn[:'connect-timeout'] || 120 + } + } }, + { name: 'uriless', + config: { + transport: conn[:protocol], + conn[:protocol] => { + host: conn[:host], + user: conn[:user], + port: conn[:port] + } + } }, + { name: 'hostless', + config: { + transport: conn[:protocol] + } } + ], groups: [{ name: "group1", targets: [ diff --git a/spec/integration/jail_spec.rb b/spec/integration/jail_spec.rb index 6a7c06703..f329bac26 100644 --- a/spec/integration/jail_spec.rb +++ b/spec/integration/jail_spec.rb @@ -85,8 +85,7 @@ let(:default_inv) do { 'config' => { - 'jail' => { - } + 'jail' => {} } } end @@ -102,8 +101,7 @@ let(:run_as_conf) do { 'config' => { - 'jail' => { - } + 'jail' => {} } } end diff --git a/spec/integration/puppetdb/client_spec.rb b/spec/integration/puppetdb/client_spec.rb index 9ca4f8ac9..5c63a9a37 100644 --- a/spec/integration/puppetdb/client_spec.rb +++ b/spec/integration/puppetdb/client_spec.rb @@ -126,9 +126,9 @@ def facts_hash { 'node1' => { - 'foo' => 'bar', + 'foo' => 'bar', 'name' => 'node1' - }, + }, 'node2' => { 'foo' => 'bar', '1' => 'the loneliest number', diff --git a/spec/integration/remote_spec.rb b/spec/integration/remote_spec.rb index 39ab6272f..bf16cf42f 100644 --- a/spec/integration/remote_spec.rb +++ b/spec/integration/remote_spec.rb @@ -14,28 +14,28 @@ let(:conn) { conn_info('ssh') } let(:inventory) do { 'targets' => [ - { 'uri' => conn[:host], - 'config' => { - 'transport' => conn[:protocol], - conn[:protocol] => { - 'user' => conn[:user], - 'port' => conn[:port], - 'password' => conn[:password] - } - } }, - { 'uri' => 'remote://simple.example.com', - 'config' => { - 'remote' => { - 'run-on' => conn[:host], - 'token' => 'token_val' - } - } }, - { 'uri' => 'https://www.example.com', - 'config' => { - 'transport' => 'remote', - 'remote' => { 'run-on': conn[:host] } - } } - ], + { 'uri' => conn[:host], + 'config' => { + 'transport' => conn[:protocol], + conn[:protocol] => { + 'user' => conn[:user], + 'port' => conn[:port], + 'password' => conn[:password] + } + } }, + { 'uri' => 'remote://simple.example.com', + 'config' => { + 'remote' => { + 'run-on' => conn[:host], + 'token' => 'token_val' + } + } }, + { 'uri' => 'https://www.example.com', + 'config' => { + 'transport' => 'remote', + 'remote' => { 'run-on': conn[:host] } + } } + ], 'config' => { 'ssh' => { 'host-key-check' => false }, 'winrm' => { 'ssl' => false, 'ssl-verify' => false } diff --git a/spec/lib/bolt_spec/puppetdb.rb b/spec/lib/bolt_spec/puppetdb.rb index c78be71e0..e46e935a2 100644 --- a/spec/lib/bolt_spec/puppetdb.rb +++ b/spec/lib/bolt_spec/puppetdb.rb @@ -31,22 +31,20 @@ def make_command(command:, version:, payload:, wait: nil) end def replace_facts(certname, facts, wait: nil) - make_command(command: 'replace facts', version: 5, payload: { + make_command(command: 'replace facts', version: 5, payload: + { certname: certname, environment: 'production', producer_timestamp: Time.now.iso8601(3), producer: 'bolt', - values: facts + values: facts }, wait: wait) end def deactivate_node(certname, wait: nil) - make_command(command: 'deactivate node', version: 3, payload: { - certname: certname, - producer_timestamp: Time.now.iso8601(3) - }, - wait: wait) + make_command(command: 'deactivate node', version: 3, + payload: { certname: certname, producer_timestamp: Time.now.iso8601(3) }, wait: wait) end def push_facts(facts_hash) diff --git a/spec/unit/logger_spec.rb b/spec/unit/logger_spec.rb index a450edc09..aafcc8ce5 100644 --- a/spec/unit/logger_spec.rb +++ b/spec/unit/logger_spec.rb @@ -53,8 +53,7 @@ def initialize(*args) describe '::configure' do let(:appenders) { { - 'file:/bolt.log' => { - }, + 'file:/bolt.log' => {}, 'file:/debug.log' => { level: :debug, append: false