Skip to content

Commit dd3f29e

Browse files
Merge pull request #21 from corgibytes/add-acceptance-and-unit-testing
Add acceptance and unit testing
2 parents 4e5e4eb + f510a03 commit dd3f29e

25 files changed

+912
-15
lines changed

.github/workflows/ruby.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
name: Ruby CI
1+
name: Ruby
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
49

510
jobs:
611
build:
7-
812
runs-on: ubuntu-latest
13+
name: Ruby ${{ matrix.ruby }}
14+
strategy:
15+
matrix:
16+
ruby:
17+
- '3.2.2'
18+
- '3.1.4'
19+
- '3.0.6'
20+
- '2.7.7'
921

1022
steps:
1123
- uses: actions/checkout@v3
12-
- name: Set up Ruby 2.6
24+
- name: Set up Ruby ${{ matrix.ruby }}
1325
uses: ruby/setup-ruby@v1
1426
with:
15-
ruby-version: '2.6'
16-
- name: Build and test with Rake
17-
run: |
18-
gem install bundler
19-
bundle install --jobs 4 --retry 3
20-
bundle exec rake
27+
ruby-version: ${{ matrix.ruby }}
28+
bundler-cache: true
29+
- name: Run the default task
30+
run: bundle exec rake

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
.idea
1+
.idea
2+
/Gemfile.lock
3+
/tmp/aruba
4+
/coverage

.rubocop.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
AllCops:
2+
NewCops: enable
3+
TargetRubyVersion: 2.7
4+
5+
inherit_from: .rubocop_todo.yml
6+
7+
# The behavior of RuboCop can be controlled via the .rubocop.yml
8+
# configuration file. It makes it possible to enable/disable
9+
# certain cops (checks) and to alter their behavior if they accept
10+
# any parameters. The file can be placed either in your home
11+
# directory or in some project directory.
12+
#
13+
# RuboCop will start looking for the configuration file in the directory
14+
# where the inspected file is and continue its way up to the root directory.
15+
#
16+
# See https://docs.rubocop.org/rubocop/configuration
17+

.rubocop_todo.yml

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2023-04-05 19:57:43 UTC using RuboCop version 1.49.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+
# This cop supports safe autocorrection (--autocorrect).
11+
# Configuration parameters: Severity, Include.
12+
# Include: **/*.gemspec
13+
Gemspec/DeprecatedAttributeAssignment:
14+
Exclude:
15+
- 'cyclonedx-ruby.gemspec'
16+
17+
# Offense count: 4
18+
# This cop supports safe autocorrection (--autocorrect).
19+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
20+
# Include: **/*.gemspec
21+
Gemspec/OrderedDependencies:
22+
Exclude:
23+
- 'cyclonedx-ruby.gemspec'
24+
25+
# Offense count: 1
26+
# This cop supports safe autocorrection (--autocorrect).
27+
# Configuration parameters: Severity, Include.
28+
# Include: **/*.gemspec
29+
Gemspec/RequireMFA:
30+
Exclude:
31+
- 'cyclonedx-ruby.gemspec'
32+
33+
# Offense count: 1
34+
# This cop supports safe autocorrection (--autocorrect).
35+
Layout/EmptyLineAfterMagicComment:
36+
Exclude:
37+
- 'lib/bom_builder.rb'
38+
39+
# Offense count: 1
40+
# This cop supports safe autocorrection (--autocorrect).
41+
# Configuration parameters: EnforcedStyle.
42+
# SupportedStyles: around, only_before
43+
Layout/EmptyLinesAroundAccessModifier:
44+
Exclude:
45+
- 'lib/bom_builder.rb'
46+
47+
# Offense count: 1
48+
# This cop supports safe autocorrection (--autocorrect).
49+
Layout/EmptyLinesAroundMethodBody:
50+
Exclude:
51+
- 'lib/bom_component.rb'
52+
53+
# Offense count: 1
54+
# This cop supports safe autocorrection (--autocorrect).
55+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
56+
Layout/ExtraSpacing:
57+
Exclude:
58+
- 'cyclonedx-ruby.gemspec'
59+
60+
# Offense count: 1
61+
# This cop supports safe autocorrection (--autocorrect).
62+
# Configuration parameters: EnforcedStyle, IndentationWidth.
63+
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
64+
Layout/FirstArrayElementIndentation:
65+
Exclude:
66+
- 'lib/bom_component.rb'
67+
68+
# Offense count: 1
69+
# This cop supports safe autocorrection (--autocorrect).
70+
Layout/LeadingEmptyLines:
71+
Exclude:
72+
- 'lib/bom_component.rb'
73+
74+
# Offense count: 2
75+
# This cop supports safe autocorrection (--autocorrect).
76+
# Configuration parameters: EnforcedStyle.
77+
# SupportedStyles: final_newline, final_blank_line
78+
Layout/TrailingEmptyLines:
79+
Exclude:
80+
- 'Rakefile'
81+
- 'lib/bom_component.rb'
82+
83+
# Offense count: 3
84+
# This cop supports safe autocorrection (--autocorrect).
85+
# Configuration parameters: AllowInHeredoc.
86+
Layout/TrailingWhitespace:
87+
Exclude:
88+
- 'Rakefile'
89+
- 'spec/bom_component_spec.rb'
90+
91+
# Offense count: 2
92+
Lint/IneffectiveAccessModifier:
93+
Exclude:
94+
- 'lib/bom_builder.rb'
95+
96+
# Offense count: 1
97+
# This cop supports safe autocorrection (--autocorrect).
98+
Lint/ScriptPermission:
99+
Exclude:
100+
- 'Rakefile'
101+
102+
# Offense count: 1
103+
Lint/ShadowingOuterLocalVariable:
104+
Exclude:
105+
- 'lib/bom_builder.rb'
106+
107+
# Offense count: 19
108+
# This cop supports safe autocorrection (--autocorrect).
109+
# Configuration parameters: EnforcedStyle.
110+
# SupportedStyles: strict, consistent
111+
Lint/SymbolConversion:
112+
Exclude:
113+
- 'lib/bom_component.rb'
114+
- 'lib/bom_helpers.rb'
115+
116+
# Offense count: 1
117+
# This cop supports safe autocorrection (--autocorrect).
118+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
119+
Lint/UnusedMethodArgument:
120+
Exclude:
121+
- 'lib/bom_builder.rb'
122+
123+
# Offense count: 1
124+
# This cop supports safe autocorrection (--autocorrect).
125+
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
126+
Lint/UselessAccessModifier:
127+
Exclude:
128+
- 'lib/bom_builder.rb'
129+
130+
# Offense count: 4
131+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
132+
Metrics/AbcSize:
133+
Max: 67
134+
135+
# Offense count: 4
136+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
137+
# AllowedMethods: refine
138+
Metrics/BlockLength:
139+
Max: 38
140+
141+
# Offense count: 1
142+
# Configuration parameters: CountComments, CountAsOne.
143+
Metrics/ClassLength:
144+
Max: 128
145+
146+
# Offense count: 1
147+
# Configuration parameters: AllowedMethods, AllowedPatterns.
148+
Metrics/CyclomaticComplexity:
149+
Max: 9
150+
151+
# Offense count: 6
152+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
153+
Metrics/MethodLength:
154+
Max: 68
155+
156+
# Offense count: 1
157+
# Configuration parameters: AllowedMethods, AllowedPatterns.
158+
Metrics/PerceivedComplexity:
159+
Max: 12
160+
161+
# Offense count: 1
162+
# This cop supports safe autocorrection (--autocorrect).
163+
# Configuration parameters: PreferredName.
164+
Naming/RescuedExceptionsVariableName:
165+
Exclude:
166+
- 'Rakefile'
167+
168+
# Offense count: 3
169+
# Configuration parameters: AllowedConstants.
170+
Style/Documentation:
171+
Exclude:
172+
- 'spec/**/*'
173+
- 'test/**/*'
174+
- 'Rakefile'
175+
- 'lib/bom_builder.rb'
176+
- 'lib/bom_component.rb'
177+
178+
# Offense count: 1
179+
# This cop supports safe autocorrection (--autocorrect).
180+
# Configuration parameters: AllowedVars.
181+
Style/FetchEnvVar:
182+
Exclude:
183+
- 'lib/bom_helpers.rb'
184+
185+
# Offense count: 1
186+
# This cop supports safe autocorrection (--autocorrect).
187+
Style/FileWrite:
188+
Exclude:
189+
- 'lib/bom_builder.rb'
190+
191+
# Offense count: 12
192+
# This cop supports unsafe autocorrection (--autocorrect-all).
193+
# Configuration parameters: EnforcedStyle.
194+
# SupportedStyles: always, always_true, never
195+
Style/FrozenStringLiteralComment:
196+
Exclude:
197+
- '.simplecov'
198+
- 'Gemfile'
199+
- 'Rakefile'
200+
- 'features/fixtures/simple/Gemfile'
201+
- 'features/step_definitions/json_bom_matching.rb'
202+
- 'features/step_definitions/xml_bom_matching.rb'
203+
- 'features/support/env.rb'
204+
- 'features/support/simplecov_support.rb'
205+
- 'lib/bom_component.rb'
206+
- 'spec/bom_component_spec.rb'
207+
- 'spec/bom_helpers_spec.rb'
208+
- 'spec/spec_helper.rb'
209+
210+
# Offense count: 1
211+
# This cop supports safe autocorrection (--autocorrect).
212+
# Configuration parameters: AllowedMethods, AllowedPatterns.
213+
Style/MethodCallWithoutArgsParentheses:
214+
Exclude:
215+
- 'lib/bom_helpers.rb'
216+
217+
# Offense count: 1
218+
# This cop supports unsafe autocorrection (--autocorrect-all).
219+
# Configuration parameters: EnforcedStyle.
220+
# SupportedStyles: literals, strict
221+
Style/MutableConstant:
222+
Exclude:
223+
- 'lib/bom_builder.rb'
224+
225+
# Offense count: 2
226+
Style/OpenStructUse:
227+
Exclude:
228+
- 'lib/bom_builder.rb'
229+
- 'spec/bom_component_spec.rb'
230+
231+
# Offense count: 1
232+
# This cop supports safe autocorrection (--autocorrect).
233+
# Configuration parameters: PreferredDelimiters.
234+
Style/PercentLiteralDelimiters:
235+
Exclude:
236+
- 'Rakefile'
237+
238+
# Offense count: 19
239+
# This cop supports safe autocorrection (--autocorrect).
240+
# Configuration parameters: .
241+
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
242+
Style/QuotedSymbols:
243+
EnforcedStyle: double_quotes
244+
245+
# Offense count: 1
246+
# This cop supports safe autocorrection (--autocorrect).
247+
Style/RedundantBegin:
248+
Exclude:
249+
- 'Rakefile'
250+
251+
# Offense count: 6
252+
# This cop supports safe autocorrection (--autocorrect).
253+
Style/RedundantRegexpEscape:
254+
Exclude:
255+
- 'features/step_definitions/json_bom_matching.rb'
256+
- 'features/step_definitions/xml_bom_matching.rb'
257+
258+
# Offense count: 20
259+
# This cop supports safe autocorrection (--autocorrect).
260+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
261+
# SupportedStyles: single_quotes, double_quotes
262+
Style/StringLiterals:
263+
Exclude:
264+
- '.simplecov'
265+
- 'Rakefile'
266+
- 'cyclonedx-ruby.gemspec'
267+
- 'lib/bom_component.rb'
268+
- 'lib/bom_helpers.rb'
269+
- 'spec/bom_component_spec.rb'
270+
- 'spec/bom_helpers_spec.rb'
271+
272+
# Offense count: 1
273+
# This cop supports safe autocorrection (--autocorrect).
274+
# Configuration parameters: MinSize.
275+
# SupportedStyles: percent, brackets
276+
Style/SymbolArray:
277+
EnforcedStyle: brackets
278+
279+
# Offense count: 2
280+
# This cop supports safe autocorrection (--autocorrect).
281+
Style/SymbolLiteral:
282+
Exclude:
283+
- 'lib/bom_component.rb'
284+
285+
# Offense count: 5
286+
# This cop supports safe autocorrection (--autocorrect).
287+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
288+
# URISchemes: http, https
289+
Layout/LineLength:
290+
Max: 237

.simplecov

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copied from https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/.simplecov
2+
# Licensed under MIT - https://github.com/cucumber/aruba/blob/3b1a6cea6e3ba55370c3396eef0a955aeb40f287/LICENSE
3+
4+
SimpleCov.configure do
5+
enable_for_subprocesses true
6+
7+
# Activate branch coverage
8+
enable_coverage :branch
9+
10+
# ignore this file
11+
add_filter ".simplecov"
12+
add_filter "features"
13+
14+
# Rake tasks aren't tested with rspec
15+
add_filter "Rakefile"
16+
add_filter "lib/tasks"
17+
18+
#
19+
# Changed Files in Git Group
20+
# @see http://fredwu.me/post/35625566267/simplecov-test-coverage-for-changed-files-only
21+
untracked = `git ls-files --exclude-standard --others`
22+
unstaged = `git diff --name-only`
23+
staged = `git diff --name-only --cached`
24+
all = untracked + unstaged + staged
25+
changed_filenames = all.split("\n")
26+
27+
add_group "Changed" do |source_file|
28+
changed_filenames.select do |changed_filename|
29+
source_file.filename.end_with?(changed_filename)
30+
end
31+
end
32+
33+
add_group "Libraries", "lib"
34+
35+
# Specs are reported on to ensure that all examples are being run and all
36+
# lets, befores, afters, etc are being used.
37+
add_group "Specs", "spec/"
38+
end

0 commit comments

Comments
 (0)