Skip to content

Commit

Permalink
Introduce RuboCop
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Jun 21, 2023
1 parent a0de8ec commit 48eb9aa
Show file tree
Hide file tree
Showing 13 changed files with 718 additions and 433 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ on:
- master

jobs:
rubocop:
env:
BUNDLE_WITHOUT: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- name: Run Rubocop
run: bundle exec rake rubocop

test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -30,3 +44,12 @@ jobs:
run: bundle exec rake spec
- name: Build gem
run: gem build *.gemspec

tests:
needs:
- rubocop
- test
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
inherit_from: .rubocop_todo.yml

inherit_gem:
voxpupuli-rubocop: rubocop.yml
239 changes: 239 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-06-21 07:47:32 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: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'Gemfile'
- 'facts/Gemfile'

# Offense count: 1
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
Lint/DuplicateBranch:
Exclude:
- 'Rakefile'

# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Exclude:
- 'Rakefile'

# Offense count: 3
Lint/UselessAssignment:
Exclude:
- 'spec/facts_spec.rb'

# Offense count: 2
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'Rakefile'
- 'lib/facterdb.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/MapCompact:
Exclude:
- 'lib/facterdb.rb'

# Offense count: 7
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/StringInclude:
Exclude:
- 'Rakefile'

# Offense count: 3
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/facterdb_spec.rb'

# Offense count: 1
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- '**/spec/features/**/*'
- '**/spec/requests/**/*'
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/facts_spec.rb'

# Offense count: 12
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
- 'spec/facterdb_spec.rb'

# Offense count: 3
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 9

# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/facterdb_spec.rb'

# Offense count: 4
# Configuration parameters: Max.
RSpec/IndexedLet:
Exclude:
- 'spec/facterdb_spec.rb'

# Offense count: 4
RSpec/MultipleExpectations:
Max: 7

# Offense count: 11
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 6

# Offense count: 11
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 4

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
# SupportedStyles: inflected, explicit
RSpec/PredicateMatcher:
Exclude:
- 'spec/facterdb_spec.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: MinBranchesCount.
Style/CaseLikeIf:
Exclude:
- 'Rakefile'
- 'lib/facterdb.rb'

# Offense count: 2
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/facterdb.rb'
- 'lib/facterdb/bin.rb'

# Offense count: 13
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Gemfile'
- 'Rakefile'
- 'bin/facterdb'
- 'facterdb.gemspec'
- 'facts/Gemfile'
- 'facts/Vagrantfile'
- 'lib/facterdb.rb'
- 'lib/facterdb/bin.rb'
- 'lib/facterdb/version.rb'
- 'rakelib/rhel_alts.rake'
- 'spec/facterdb_spec.rb'
- 'spec/facts_spec.rb'
- 'spec/spec_helper.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
# AllowedReceivers: Thread.current
Style/HashEachMethods:
Exclude:
- 'spec/facts_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/HashTransformKeys:
Exclude:
- 'lib/facterdb.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'lib/facterdb.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/MapToHash:
Exclude:
- 'lib/facterdb.rb'

# Offense count: 1
Style/MixinUsage:
Exclude:
- 'spec/spec_helper.rb'

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

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

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/facterdb.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SlicingWithRange:
Exclude:
- 'Rakefile'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/facterdb.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method
Style/SymbolProc:
Exclude:
- 'Rakefile'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 179
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
gemspec

if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, :require => false
gem 'facter', facterversion, require: false
else
gem 'facter', :require => false
gem 'facter', require: false
end

group :development do
Expand Down
Loading

0 comments on commit 48eb9aa

Please sign in to comment.