Skip to content

Commit 9b29ae2

Browse files
authored
Merge pull request #257 from willmeek/modulesync_rubocop
Modulesync rubocop
2 parents a400497 + e2bbc90 commit 9b29ae2

6 files changed

Lines changed: 80 additions & 177 deletions

File tree

.gitignore

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
#This file is generated by ModuleSync, do not edit.
2-
pkg/
3-
Gemfile.lock
4-
Gemfile.local
5-
vendor/
6-
spec/fixtures/manifests/
7-
spec/fixtures/modules/
8-
log/
9-
junit/
10-
.vagrant/
1+
#This file is generated by ModuleSync, do not edit.Z
2+
*.iml
3+
.*.sw[op]
4+
.DS_Store
115
.bundle/
12-
coverage/
13-
log/
146
.idea/
157
.metadata
16-
*.iml
17-
.*.sw[op]
8+
.vagrant/
189
.yardoc
1910
.yardwarns
20-
.DS_Store
11+
Gemfile.local
12+
Gemfile.lock
13+
bin/
14+
coverage/
15+
doc/
16+
junit/
17+
log/
18+
pkg/
19+
spec/fixtures/manifests/
20+
spec/fixtures/modules/
2121
tmp/
2222
vendor/
23-
doc/
2423

.rubocop.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,3 @@ Style/IfUnlessModifier:
9696
Enabled: false
9797
Style/SymbolProc:
9898
Enabled: false
99-
RSpec/NamedSubject:
100-
Enabled: false

.rubocop_todo.yml

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +0,0 @@
1-
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2017-12-07 14:50:29 +0000 using RuboCop version 0.51.0.
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-
# Cop supports --auto-correct.
11-
# Configuration parameters: EnforcedStyle, SupportedStyles.
12-
# SupportedStyles: normal, rails
13-
Layout/IndentationConsistency:
14-
Exclude:
15-
- 'nodeset_generation.rb'
16-
17-
# Offense count: 1
18-
# Cop supports --auto-correct.
19-
# Configuration parameters: Width, IgnoredPatterns.
20-
Layout/IndentationWidth:
21-
Exclude:
22-
- 'nodeset_generation.rb'
23-
24-
# Offense count: 27
25-
Lint/BooleanSymbol:
26-
Exclude:
27-
- 'lib/puppet/type/ini_setting.rb'
28-
- 'lib/puppet/type/ini_subsetting.rb'
29-
- 'lib/puppet/util/setting_value.rb'
30-
31-
# Offense count: 3
32-
# Configuration parameters: CountBlocks.
33-
Metrics/BlockNesting:
34-
Max: 4
35-
36-
# Offense count: 1
37-
# Configuration parameters: EnforcedStyle, SupportedStyles.
38-
# SupportedStyles: lowercase, uppercase
39-
Naming/HeredocDelimiterCase:
40-
Exclude:
41-
- 'lib/puppet/type/ini_subsetting.rb'
42-
43-
# Offense count: 112
44-
# Configuration parameters: Blacklist.
45-
# Blacklist: END, (?-mix:EO[A-Z]{1})
46-
Naming/HeredocDelimiterNaming:
47-
Exclude:
48-
- 'lib/puppet/parser/functions/create_ini_settings.rb'
49-
- 'spec/acceptance/ini_setting_spec.rb'
50-
- 'spec/acceptance/ini_subsetting_spec.rb'
51-
- 'spec/unit/puppet/provider/ini_setting/inheritance_spec.rb'
52-
- 'spec/unit/puppet/provider/ini_setting/ruby_spec.rb'
53-
- 'spec/unit/puppet/provider/ini_subsetting/ruby_spec.rb'
54-
- 'spec/unit/puppet/util/ini_file_spec.rb'
55-
56-
# Offense count: 15
57-
# Configuration parameters: Prefixes.
58-
# Prefixes: when, with, without
59-
RSpec/ContextWording:
60-
Exclude:
61-
- 'spec/acceptance/ini_setting_spec.rb'
62-
- 'spec/unit/puppet/type/ini_setting_spec.rb'
63-
- 'spec/unit/puppet/util/external_iterator_spec.rb'
64-
- 'spec/unit/puppet/util/ini_file_spec.rb'
65-
66-
# Offense count: 1
67-
# Configuration parameters: EnforcedStyle, SupportedStyles.
68-
# SupportedStyles: and_return, block
69-
RSpec/ReturnFromStub:
70-
Exclude:
71-
- 'spec/unit/puppet/util/ini_file_spec.rb'
72-
73-
# Offense count: 1
74-
# Cop supports --auto-correct.
75-
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
76-
# SupportedStyles: assign_to_condition, assign_inside_condition
77-
Style/ConditionalAssignment:
78-
Exclude:
79-
- 'nodeset_generation.rb'
80-
81-
# Offense count: 2
82-
# Configuration parameters: EnforcedStyle, SupportedStyles.
83-
# SupportedStyles: for, each
84-
Style/For:
85-
Exclude:
86-
- 'nodeset_generation.rb'
87-
88-
# Offense count: 1
89-
Style/MultipleComparison:
90-
Exclude:
91-
- 'nodeset_generation.rb'
92-
93-
# Offense count: 22
94-
# Cop supports --auto-correct.
95-
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
96-
# SupportedStyles: single_quotes, double_quotes
97-
Style/StringLiterals:
98-
Exclude:
99-
- 'nodeset_generation.rb'
100-
101-
# Offense count: 1
102-
# Cop supports --auto-correct.
103-
# Configuration parameters: EnforcedStyle, SupportedStyles, MinSize, WordRegex.
104-
# SupportedStyles: percent, brackets
105-
Style/WordArray:
106-
Exclude:
107-
- 'nodeset_generation.rb'

Gemfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,19 @@ def location_for(place_or_version, fake_version = nil)
2828
end
2929

3030
# Used for gem conditionals
31-
supports_windows = false
3231
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
3332
minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}"
3433

34+
# The following gems are not included by default as they require DevKit on Windows.
35+
# You should probably include them in a Gemfile.local or a ~/.gemfile
36+
#gem 'pry' #this may already be included in the gemfile
37+
#gem 'pry-stack_explorer', :require => false
38+
#if RUBY_VERSION =~ /^2/
39+
# gem 'pry-byebug'
40+
#else
41+
# gem 'pry-debugger'
42+
#end
43+
3544
group :development do
3645
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
3746
gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
@@ -62,7 +71,6 @@ gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
6271
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION']
6372
gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION']
6473

65-
6674
# Evaluate Gemfile.local if it exists
6775
if File.exists? "#{__FILE__}.local"
6876
eval(File.read("#{__FILE__}.local"), binding)

spec/unit/puppet/util/external_iterator_spec.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,34 @@
22
require 'puppet/util/external_iterator'
33

44
describe Puppet::Util::ExternalIterator do
5-
let(:subject) { described_class.new(%w[a b c]) }
5+
subject_class = nil
6+
expected_values = nil
67

7-
expected_values = [['a', 0], ['b', 1], ['c', 2]]
8+
before(:each) do
9+
subject_class = described_class.new(%w[a b c])
10+
expected_values = [['a', 0], ['b', 1], ['c', 2]]
11+
end
812

913
context '#next' do
1014
it 'iterates over the items' do
1115
expected_values.each do |expected_pair|
12-
expect(subject.next).to eq(expected_pair)
16+
expect(subject_class.next).to eq(expected_pair)
1317
end
1418
end
1519
end
1620

1721
context '#peek' do
1822
it 'returns the 0th item repeatedly' do
1923
(0..2).each do |_i|
20-
expect(subject.peek).to eq(expected_values[0])
24+
expect(subject_class.peek).to eq(expected_values[0])
2125
end
2226
end
2327

2428
it 'does not advance the iterator, but should reflect calls to #next' do # rubocop:disable RSpec/MultipleExpectations : No neat way to further reduce expectations
2529
expected_values.each do |expected_pair|
26-
expect(subject.peek).to eq(expected_pair)
27-
expect(subject.peek).to eq(expected_pair)
28-
expect(subject.next).to eq(expected_pair)
30+
expect(subject_class.peek).to eq(expected_pair)
31+
expect(subject_class.peek).to eq(expected_pair)
32+
expect(subject_class.next).to eq(expected_pair)
2933
end
3034
end
3135
end

0 commit comments

Comments
 (0)