Skip to content

Commit

Permalink
Merge pull request #148 from bastelfreak/vprc
Browse files Browse the repository at this point in the history
Switch to voxpupuli-rubocop
  • Loading branch information
bastelfreak authored Jul 14, 2023
2 parents 4f555fa + c218949 commit f7e83a6
Show file tree
Hide file tree
Showing 15 changed files with 293 additions and 267 deletions.
30 changes: 2 additions & 28 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,8 @@
---
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: '2.7'
Exclude:
- vendor/**/*

Style/TrailingCommaInHashLiteral:
Enabled: True
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArrayLiteral:
Enabled: True
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArguments:
Enabled: True
EnforcedStyleForMultiline: comma
inherit_gem:
voxpupuli-rubocop: rubocop.yml

Metrics:
Enabled: false

Style:
Enabled: false

Layout:
Enabled: false
216 changes: 139 additions & 77 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-03-15 20:57:21 UTC using RuboCop version 1.12.1.
# on 2023-07-07 07:29:59 UTC using RuboCop version 1.50.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
# Include: **/*.gemspec
Gemspec/OrderedDependencies:
Exclude:
- 'puppet-syntax.gemspec'

# Offense count: 1
# Offense count: 2
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
Lint/DuplicateBranch:
Exclude:
Expand All @@ -25,12 +17,6 @@ Lint/MissingSuper:
Exclude:
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'

# Offense count: 1
# Cop supports --auto-correct.
Lint/ParenthesesAsGroupedExpression:
Exclude:
- 'spec/puppet-syntax/manifests_spec.rb'

# Offense count: 1
Lint/RescueException:
Exclude:
Expand All @@ -42,27 +28,14 @@ Lint/SuppressedException:
Exclude:
- 'Rakefile'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'lib/puppet-syntax/templates.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
Lint/UnusedMethodArgument:
Exclude:
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'

# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'lib/puppet-syntax/templates.rb'

# Offense count: 4
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
Expand All @@ -71,31 +44,15 @@ Naming/FileName:
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
- 'spec/puppet-syntax_spec.rb'

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: PreferredName.
Naming/RescuedExceptionsVariableName:
Exclude:
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/templates.rb'

# Offense count: 1
# Cop supports --auto-correct.
Performance/RedundantSplitRegexpArgument:
# Offense count: 11
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/BeEq:
Exclude:
- 'lib/puppet-syntax/hiera.rb'

# Offense count: 7
# Cop supports --auto-correct.
Performance/RegexpMatch:
Exclude:
- 'Rakefile'
- 'lib/puppet-syntax/hiera.rb'
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax_spec.rb'

# Offense count: 1
# Configuration parameters: Prefixes.
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
Expand All @@ -105,10 +62,15 @@ RSpec/ContextWording:
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- '**/spec/features/**/*'
- '**/spec/requests/**/*'
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'

# Offense count: 19
# Cop supports --auto-correct.
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Expand All @@ -118,22 +80,11 @@ RSpec/DescribedClass:
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppet-syntax_spec.rb'

# Offense count: 8
# Offense count: 7
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 14

# Offense count: 40
# Cop supports --auto-correct.
# Configuration parameters: CustomTransform, IgnoredWords.
RSpec/ExampleWording:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppet-syntax_spec.rb'

# Offense count: 4
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
Expand All @@ -144,21 +95,13 @@ RSpec/FilePath:
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppet-syntax_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'

# Offense count: 29
RSpec/MultipleExpectations:
Max: 8

# Offense count: 30
# Configuration parameters: IgnoreSharedExamples.
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
Expand All @@ -170,8 +113,127 @@ RSpec/RepeatedDescription:
Exclude:
- 'spec/puppet-syntax/templates_spec.rb'

# Offense count: 3
RSpec/SubjectDeclaration:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# This cop supports safe autocorrection (--autocorrect).
Rake/Desc:
Exclude:
- 'Rakefile'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, conditionals
Style/AndOr:
Exclude:
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/templates.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: MinBranchesCount.
Style/CaseLikeIf:
Exclude:
- 'lib/puppet-syntax/hiera.rb'

# Offense count: 5
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/puppet-syntax.rb'
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'
- 'lib/puppet-syntax/templates.rb'

# Offense count: 15
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Gemfile'
- 'Rakefile'
- 'lib/puppet-syntax.rb'
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'
- 'lib/puppet-syntax/templates.rb'
- 'lib/puppet-syntax/version.rb'
- 'puppet-syntax.gemspec'
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppet-syntax_spec.rb'
- 'spec/spec_helper.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/IdenticalConditionalBranches:
Exclude:
- 'lib/puppet-syntax/templates.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Style/MutableConstant:
Exclude:
- 'lib/puppet-syntax/version.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/puppet-syntax/hiera.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'spec/puppet-syntax/templates_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SelectByRegexp:
Exclude:
- 'lib/puppet-syntax/manifests.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: RequireEnglish, EnforcedStyle.
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
Style/SpecialGlobalVars:
Exclude:
- 'puppet-syntax.gemspec'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method
Style/SymbolProc:
Exclude:
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/templates.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 211
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ source 'https://rubygems.org'
# is specified as `file://some/location/on/disk`.
def location_for(place_or_version, fake_version = nil)
if place_or_version =~ /^(https[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place_or_version =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
elsif place_or_version =~ %r{^file://(.*)}
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
else
[place_or_version, { :require => false }]
[place_or_version, { require: false }]
end
end

Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ task :publish_gem do
puts "Published #{gem}" if gem
end

task :default => [:spec]
task default: [:spec]
begin
require 'github_changelog_generator/task'
require 'puppet-syntax/version'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = PuppetSyntax::VERSION
config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/
config.future_release = "v#{version}" if /^\d+\.\d+.\d+$/.match?(version)
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix modulesync skip-changelog]
config.user = 'voxpupuli'
config.project = 'puppet-syntax'
end
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet-syntax.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "puppet-syntax/version"
require 'puppet-syntax/version'

module PuppetSyntax
autoload :Hiera, 'puppet-syntax/hiera'
Expand All @@ -7,9 +7,9 @@ module PuppetSyntax

@exclude_paths = []
@hieradata_paths = [
"**/data/**/*.*{yaml,yml}",
"hieradata/**/*.*{yaml,yml}",
"hiera*.*{yaml,yml}",
'**/data/**/*.*{yaml,yml}',
'hieradata/**/*.*{yaml,yml}',
'hiera*.*{yaml,yml}',
]
@manifests_paths = [
'**/*.pp',
Expand Down
Loading

0 comments on commit f7e83a6

Please sign in to comment.