Skip to content

Commit

Permalink
Merge pull request #55 from voxpupuli/modulesync
Browse files Browse the repository at this point in the history
Drop Ruby < 2.7; Add RuboCop
  • Loading branch information
bastelfreak authored Apr 21, 2023
2 parents 675ca08 + b47c2da commit 341ee71
Show file tree
Hide file tree
Showing 12 changed files with 377 additions and 197 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
# raise PRs for gem updates
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10

# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler: 'none'
env:
BUNDLE_WITHOUT: release:development:rubocop
- name: Build gem
run: gem build *.gemspec
run: gem build --strict --verbose *.gemspec
- name: Publish gem to rubygems.org
run: gem push *.gem
env:
Expand Down
34 changes: 27 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
name: Test

on:
- pull_request
- push
pull_request: {}
push:
branches:
- master
- main

env:
BUNDLE_WITHOUT: release

jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run rake rubocop
run: bundle exec rake rubocop
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ruby: "2.4"
- ruby: "2.5"
- ruby: "2.6"
- ruby: "2.7"
- ruby: "3.0"
- ruby: "3.1"
coverage: "yes"
- ruby: "3.2"
env:
COVERAGE: ${{ matrix.coverage }}
name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
Expand All @@ -34,4 +46,12 @@ jobs:
- name: Run tests
run: bundle exec rake spec
- name: Verify gem builds
run: gem build *.gemspec
run: gem build --strict --verbose *.gemspec
tests:
needs:
- rubocop
- test
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
12 changes: 12 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
inherit_from: .rubocop_todo.yml

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

inherit_gem:
voxpupuli-rubocop: rubocop.yml

Naming/FileName:
Exclude:
- "*.gemspec"
108 changes: 108 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-04-21 11:55:33 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
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Exclude:
- 'lib/puppet-lint/plugins/check_parameter_documentation.rb'

# Offense count: 39
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'puppet-lint-param-docs.gemspec'
- 'spec/puppet-lint/plugins/check_parameter_documentation_spec.rb'

# Offense count: 2
# Configuration parameters: MinSize.
Performance/CollectionLiteralInLoop:
Exclude:
- 'lib/puppet-lint/plugins/check_parameter_documentation.rb'

# Offense count: 49
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/puppet-lint/plugins/check_parameter_documentation_spec.rb'

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

# Offense count: 6
RSpec/MultipleExpectations:
Max: 3

# Offense count: 2
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/puppet-lint-param-docs/tasks.rb'

# Offense count: 7
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Gemfile'
- 'Rakefile'
- 'lib/puppet-lint-param-docs/tasks.rb'
- 'lib/puppet-lint/plugins/check_parameter_documentation.rb'
- 'lib/puppet_lint_param_docs.rb'
- 'puppet-lint-param-docs.gemspec'
- 'spec/puppet-lint/plugins/check_parameter_documentation_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/InfiniteLoop:
Exclude:
- 'lib/puppet-lint/plugins/check_parameter_documentation.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-lint/plugins/check_parameter_documentation.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: short, verbose
Style/PreferredHashMethods:
Exclude:
- 'lib/puppet-lint/plugins/check_parameter_documentation.rb'

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

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

group :release do
gem 'github_changelog_generator', require: false
gem 'faraday-retry', '~> 2.1', require: false
gem 'github_changelog_generator', '~> 1.16.4', require: false
end

group :coverage, optional: ENV['COVERAGE']!='yes' do
gem 'simplecov-console', :require => false
gem 'codecov', :require => false
group :coverage, optional: ENV['COVERAGE'] != 'yes' do
gem 'codecov', require: false
gem 'simplecov-console', require: false
end

group :development do
gem 'rake', '~> 13.0', '>= 13.0.6'
gem 'rspec', '~> 3.12'
gem 'rspec-collection_matchers', '~> 1.2'
gem 'rspec-its', '~> 1.3'
gem 'voxpupuli-rubocop', '~> 1.1'
end
19 changes: 17 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,28 @@ task default: :spec
begin
require 'rubygems'
require 'github_changelog_generator/task'

rescue LoadError
# github-changelog-generator is an optional group
else
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
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 skip-changelog modulesync}
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog modulesync]
config.user = 'voxpupuli'
config.project = 'puppet-lint-param-docs'
config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
end
end

begin
require 'rubocop/rake_task'
rescue LoadError
# RuboCop is an optional group
else
RuboCop::RakeTask.new(:rubocop) do |task|
# These make the rubocop experience maybe slightly less terrible
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']

# Use Rubocop's Github Actions formatter if possible
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
end
end
2 changes: 1 addition & 1 deletion lib/puppet-lint-param-docs/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.define_selective(&task_block)
class RakeTask < ::Rake::TaskLib
include ::Rake::DSL if defined?(::Rake::DSL)

def define_selective(&task_block)
def define_selective
PuppetLint::RakeTask.new(:lint_param_docs) do |config|
config.fail_on_warnings = true
config.disable_checks = (PuppetLint.configuration.checks - [:parameter_documentation])
Expand Down
Loading

0 comments on commit 341ee71

Please sign in to comment.