Skip to content

Commit 6fd10d7

Browse files
authored
Merge pull request #34 from voxpupuli/modulesync
Drop Ruby < 2.7; Add RuboCop
2 parents 5d1a3eb + d32a815 commit 6fd10d7

File tree

10 files changed

+275
-102
lines changed

10 files changed

+275
-102
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
# raise PRs for gem updates
4+
- package-ecosystem: bundler
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
time: "13:00"
9+
open-pull-requests-limit: 10
10+
11+
# Maintain dependencies for GitHub Actions
12+
- package-ecosystem: github-actions
13+
directory: "/"
14+
schedule:
15+
interval: daily
16+
time: "13:00"
17+
open-pull-requests-limit: 10

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: github.repository_owner == 'voxpupuli'
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
- name: Install Ruby 3.0
1515
uses: ruby/setup-ruby@v1
1616
with:
1717
ruby-version: '3.0'
1818
bundler: 'none'
19+
env:
20+
BUNDLE_WITHOUT: release:development:rubocop
1921
- name: Build gem
20-
run: gem build *.gemspec
22+
run: gem build --strict --verbose *.gemspec
2123
- name: Publish gem to rubygems.org
2224
run: gem push *.gem
2325
env:

.github/workflows/test.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11
name: Test
22

33
on:
4-
- pull_request
5-
- push
4+
pull_request: {}
5+
push:
6+
branches:
7+
- master
8+
- main
69

710
env:
811
BUNDLE_WITHOUT: release
912

1013
jobs:
14+
rubocop:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Setup ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: '3.0'
22+
bundler-cache: true
23+
- name: Run rake rubocop
24+
run: bundle exec rake rubocop
1125
test:
1226
runs-on: ubuntu-latest
1327
strategy:
1428
fail-fast: false
1529
matrix:
1630
include:
17-
- ruby: "2.4"
18-
- ruby: "2.5"
19-
- ruby: "2.6"
2031
- ruby: "2.7"
2132
- ruby: "3.0"
2233
- ruby: "3.1"
2334
coverage: "yes"
35+
- ruby: "3.2"
2436
env:
2537
COVERAGE: ${{ matrix.coverage }}
2638
name: Ruby ${{ matrix.ruby }}
2739
steps:
28-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v3
2941
- name: Install Ruby ${{ matrix.ruby }}
3042
uses: ruby/setup-ruby@v1
3143
with:
@@ -34,4 +46,12 @@ jobs:
3446
- name: Run tests
3547
run: bundle exec rake spec
3648
- name: Verify gem builds
37-
run: gem build *.gemspec
49+
run: gem build --strict --verbose *.gemspec
50+
tests:
51+
needs:
52+
- rubocop
53+
- test
54+
runs-on: ubuntu-latest
55+
name: Test suite
56+
steps:
57+
- run: echo Test suite completed

.rubocop.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
inherit_from: .rubocop_todo.yml
3+
4+
# Managed by modulesync - DO NOT EDIT
5+
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
6+
7+
inherit_gem:
8+
voxpupuli-rubocop: rubocop.yml
9+
10+
Naming/FileName:
11+
Exclude:
12+
- "*.gemspec"

.rubocop_todo.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2023-04-21 12:08:55 UTC using RuboCop version 1.50.2.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
Lint/UselessAssignment:
11+
Exclude:
12+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
13+
14+
# Offense count: 4
15+
# Configuration parameters: ForbiddenDelimiters.
16+
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
17+
Naming/HeredocDelimiterNaming:
18+
Exclude:
19+
- 'puppet-lint-strict_indent-check.gemspec'
20+
- 'spec/puppet-lint/plugins/check_strict_indent_spec.rb'
21+
22+
# Offense count: 5
23+
# Configuration parameters: MinSize.
24+
Performance/CollectionLiteralInLoop:
25+
Exclude:
26+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
27+
28+
# Offense count: 4
29+
# Configuration parameters: Prefixes, AllowedPatterns.
30+
# Prefixes: when, with, without
31+
RSpec/ContextWording:
32+
Exclude:
33+
- 'spec/puppet-lint/plugins/check_strict_indent_spec.rb'
34+
35+
# Offense count: 1
36+
# Configuration parameters: IgnoredMetadata.
37+
RSpec/DescribeClass:
38+
Exclude:
39+
- '**/spec/features/**/*'
40+
- '**/spec/requests/**/*'
41+
- '**/spec/routing/**/*'
42+
- '**/spec/system/**/*'
43+
- '**/spec/views/**/*'
44+
- 'spec/puppet-lint/plugins/check_strict_indent_spec.rb'
45+
46+
# Offense count: 10
47+
# This cop supports unsafe autocorrection (--autocorrect-all).
48+
# Configuration parameters: EnforcedStyle.
49+
# SupportedStyles: always, conditionals
50+
Style/AndOr:
51+
Exclude:
52+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
53+
54+
# Offense count: 1
55+
# This cop supports safe autocorrection (--autocorrect).
56+
# Configuration parameters: EnforcedStyle, AllowComments.
57+
# SupportedStyles: empty, nil, both
58+
Style/EmptyElse:
59+
Exclude:
60+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
61+
62+
# Offense count: 5
63+
# This cop supports unsafe autocorrection (--autocorrect-all).
64+
# Configuration parameters: EnforcedStyle.
65+
# SupportedStyles: always, always_true, never
66+
Style/FrozenStringLiteralComment:
67+
Exclude:
68+
- 'Gemfile'
69+
- 'Rakefile'
70+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
71+
- 'puppet-lint-strict_indent-check.gemspec'
72+
- 'spec/puppet-lint/plugins/check_strict_indent_spec.rb'
73+
74+
# Offense count: 4
75+
Style/MultilineBlockChain:
76+
Exclude:
77+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
78+
- 'spec/puppet-lint/plugins/check_strict_indent_spec.rb'
79+
80+
# Offense count: 2
81+
# This cop supports unsafe autocorrection (--autocorrect-all).
82+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
83+
# SupportedStyles: predicate, comparison
84+
Style/NumericPredicate:
85+
Exclude:
86+
- 'spec/**/*'
87+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
88+
89+
# Offense count: 1
90+
# This cop supports unsafe autocorrection (--autocorrect-all).
91+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
92+
# AllowedMethods: present?, blank?, presence, try, try!
93+
Style/SafeNavigation:
94+
Exclude:
95+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
96+
97+
# Offense count: 1
98+
# This cop supports safe autocorrection (--autocorrect).
99+
Style/WhileUntilModifier:
100+
Exclude:
101+
- 'lib/puppet-lint/plugins/check_strict_indent.rb'
102+
103+
# Offense count: 2
104+
# This cop supports safe autocorrection (--autocorrect).
105+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
106+
# URISchemes: http, https
107+
Layout/LineLength:
108+
Max: 137

Gemfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
33
gemspec
44

55
group :release do
6-
gem 'github_changelog_generator', require: false
6+
gem 'faraday-retry', '~> 2.1', require: false
7+
gem 'github_changelog_generator', '~> 1.16.4', require: false
78
end
89

9-
group :coverage, optional: ENV['COVERAGE']!='yes' do
10-
gem 'simplecov-console', :require => false
11-
gem 'codecov', :require => false
10+
group :coverage, optional: ENV['COVERAGE'] != 'yes' do
11+
gem 'codecov', require: false
12+
gem 'simplecov-console', require: false
13+
end
14+
15+
group :development do
16+
gem 'rake', '~> 13.0', '>= 13.0.6'
17+
gem 'rspec', '~> 3.12'
18+
gem 'rspec-collection_matchers', '~> 1.2'
19+
gem 'rspec-its', '~> 1.3'
20+
gem 'voxpupuli-rubocop', '~> 1.1'
1221
end

Rakefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,28 @@ task default: :spec
77
begin
88
require 'rubygems'
99
require 'github_changelog_generator/task'
10-
10+
rescue LoadError
11+
# github-changelog-generator is an optional group
12+
else
1113
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
1214
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
13-
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog modulesync}
15+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog modulesync]
1416
config.user = 'voxpupuli'
1517
config.project = 'puppet-lint-strict_indent-check'
1618
config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
1719
end
20+
end
21+
22+
begin
23+
require 'rubocop/rake_task'
1824
rescue LoadError
25+
# RuboCop is an optional group
26+
else
27+
RuboCop::RakeTask.new(:rubocop) do |task|
28+
# These make the rubocop experience maybe slightly less terrible
29+
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
30+
31+
# Use Rubocop's Github Actions formatter if possible
32+
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
33+
end
1934
end

0 commit comments

Comments
 (0)