Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
/spec/fixtures/modules/*
/tmp/
/vendor/
/.vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
.resource_types
.modules
.task_cache.json
.plan_cache.json
.rerun.json
bolt-debug.log
9 changes: 8 additions & 1 deletion .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@
/spec/fixtures/modules/*
/tmp/
/vendor/
/.vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/spec/fixtures/litmus_inventory.yaml
.resource_types
.modules
.task_cache.json
.plan_cache.json
.rerun.json
bolt-debug.log
/.fixtures.yml
/Gemfile
/.gitattributes
Expand All @@ -36,7 +43,7 @@
/Rakefile
/rakelib/
/.rspec
/..yml
/.rubocop.yml
/.yardopts
/spec/
/.vscode/
Expand Down
8 changes: 8 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
--fail-on-warnings
--relative
--no-80chars-check
--no-140chars-check
--no-class_inherits_from_params_class-check
--no-autoloader_layout-check
--no-documentation-check
--no-single_quote_string_with_variables-check
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp
167 changes: 142 additions & 25 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,147 @@
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rspec

---
plugins:
- rubocop-performance
- rubocop-hash_inspect
- rubocop-rspec
- rubocop-rspec_rails
- rubocop-factory_bot
- rubocop-capybara
AllCops:
Exclude:
- Gemfile
- Rakefile
- spec/fixtures/**/*
- vendor/bundle/**/*
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: '3.1'

# Disabled
DisplayCopNames: true
TargetRubyVersion: 3.1
Include:
- "**/*.rb"
Exclude:
- bin/*
- ".vendor/**/*"
- "**/Gemfile"
- "**/Rakefile"
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
inherit_from: ".rubocop_todo.yml"
inherit_mode:
merge:
- Exclude
Layout/LineLength:
Description: People have wide screens, use them.
Max: 200
Layout/EndOfLine:
Description: We enforce lf to ensure consistency across platforms.
EnforcedStyle: lf
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Exclude:
- spec/acceptance/**/*.rb
RSpec/HookArgument:
Description: Prefer explicit :each argument, matching existing module's style
EnforcedStyle: each
RSpec/DescribeSymbol:
Exclude:
- spec/unit/facter/**/*.rb
Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Enabled: false

Layout/LineLength:
Max: 196

####################################################
# Cops below here due for deprecation
####################################################
# ``Rspec/FilePath`` is going to be deprecated in the next major release of rubocop >=3.0.0: see <https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath>
# As the new cops are already present, e.g., Rspec/SpecFilePathPathFormat, then disabling this in preparation
RSpec/FilePath:
Style/EmptyElse:
Description: Enforce against empty else clauses, but allow `nil` for clarity.
EnforcedStyle: empty
Style/FormatString:
Description: Following the main puppet project's style, prefer the % format format.
EnforcedStyle: percent
Style/FormatStringToken:
Description: Following the main puppet project's style, prefer the simpler template
tokens over annotated ones.
EnforcedStyle: template
Style/Lambda:
Description: Prefer the keyword for easier discoverability.
EnforcedStyle: literal
Style/RegexpLiteral:
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
EnforcedStyle: percent_r
Style/TernaryParentheses:
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
on complex expressions for better readability, but seriously consider breaking
it up.
EnforcedStyle: require_parentheses_when_complex
Style/TrailingCommaInArguments:
Description: Prefer always trailing comma on multiline argument lists. This makes
diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArrayLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs,
and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
Style/WordArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
Style/TrailingCommaInHashLiteral:
Description: PDK generates multiline hashes with trailing commas. Align with Style/TrailingCommaInArguments
and Style/TrailingCommaInArrayLiteral (both comma) so hash literals follow the
same project style.
EnforcedStyleForMultiline: comma
RSpec/DescribeClass:
Description: rspec-puppet describes its subject by string class/define name (no
Ruby constant exists to reference), so this cop is never satisfiable for puppet
specs. This is structurally inapplicable, not a style preference -- distinct from
D-08 which governs style cops.
Enabled: false
RSpec/MessageSpies:
Description: PDK-generated specs and the rspec-puppet convention use the mock-style
`expect(...).to receive(...)` idiom throughout, not RuboCop's default spy-style
`have_received`. Restores the setting the old `strict` profile applied globally
(no Exclude needed -- provider/transport specs already comply).
EnforcedStyle: receive
RSpec/ExampleLength:
Description: The resource-API provider specs PDK generates contain multi-line examples
covering multiple CRUD operations. Scoped to PDK-generated provider and transport
spec paths only (D-08).
Exclude:
- spec/unit/puppet/provider/**/*_spec.rb
- spec/unit/puppet/transport/**/*_spec.rb
RSpec/MultipleExpectations:
Description: The resource-API provider specs PDK generates use multiple expectations
per example to cover resource attribute checks. Scoped to PDK-generated provider
and transport spec paths only (D-08).
Exclude:
- spec/unit/puppet/provider/**/*_spec.rb
- spec/unit/puppet/transport/**/*_spec.rb
RSpec/VerifiedDoubleReference:
Description: The resource-API provider and transport specs PDK generates use string-referenced
instance doubles (the Puppet provider constant is not loaded in the spec context).
Scoped to PDK-generated provider and transport spec paths only (D-08).
Exclude:
- spec/unit/puppet/provider/**/*_spec.rb
- spec/unit/puppet/transport/**/*_spec.rb
RSpec/ContextWording:
Description: rspec-puppet-facts uses the `context "on
Prefixes:
- when
- with
- without
- 'on'
Style/MixinUsage:
Description: rspec-puppet-facts requires the top-level `include RspecPuppetFacts`
idiom in spec_helper, which cannot be cleanly restructured without breaking the
facts test harness. Scoped to spec_helper only (D-07).
Exclude:
- spec/spec_helper.rb
Lint/EmptyClass:
Description: The generated transport device file uses the idiomatic Ruby namespace
forward-declaration `class Puppet::Util::NetworkDevice; end`. An empty class is
the standard namespace-shim idiom here and is not non-idiomatic code. Scoped to
the network_device path only (D-08).
Exclude:
- lib/puppet/util/network_device/**/*.rb
28 changes: 28 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,31 @@ Style/RedundantSelfAssignmentBranch:
Style/ReturnNilInPredicateMethodDefinition:
Exclude:
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'

# Added with the pdk update that moved the module to the template's stricter rubocop profile.
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
# Not applied: slice calls namevar_attributes once instead of once per entry, which breaks a unit test's call count.
Style/HashSlice:
Exclude:
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'

# Offense count: 2
# `private` has no effect on these constants; using private_constant would change their visibility.
Lint/UselessConstantScoping:
Exclude:
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'

# Offense count: 4
# The acceptance specs are run by the rake task's file pattern, not by a _spec.rb suffix.
RSpec/SpecFilePathSuffix:
Exclude:
- 'spec/acceptance/dsc/*.rb'

# Offense count: 3
# Spec files are named after the module path, not the described class.
RSpec/SpecFilePathFormat:
Exclude:
- 'spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb'
- 'spec/unit/pwsh/version_spec.rb'
- 'spec/unit/pwsh/windows_powershell_spec.rb'
6 changes: 6 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ spec/spec_helper.rb:
delete: true
Rakefile:
unmanaged: true
.rubocop.yml:
selected_profile: 'on'
include_todos: true
cop_overrides:
Style/ClassAndModuleChildren:
Enabled: false
Loading
Loading