rspec-sonarqube-formatter 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d03dc70a76120bbde342dc6f56331c72ae5248387f708e38536f9004e001bce0
4
+ data.tar.gz: 13d4cea8db2682c5bc4f5746d623d96e263ea1fb497be01f8cc74ecf5963d8f7
5
+ SHA512:
6
+ metadata.gz: ab2aca3efd4faf359b44f2cd72de0577aaf36e107e0225cb8b0ab1ad87b61a8662a2793d15abe5729a5e5166c62e6f6e98cd77e5da01cafe139e39422e2ff970
7
+ data.tar.gz: 49264403b0ba4672af8e300745d16a62c57dc97304fd6f2483d481104394dde1ba7e39fe09276f44ad1cadb1123a1d73789584a0b4148b5ffaba8958e5ea12ac
@@ -0,0 +1,13 @@
1
+ version: "2"
2
+ plugins:
3
+ git-legal:
4
+ enabled: true
5
+ fixme:
6
+ enabled: true
7
+ bundler-audit:
8
+ enabled: true
9
+ editorconfig:
10
+ enabled: true
11
+ rubocop:
12
+ enabled: true
13
+
@@ -0,0 +1,13 @@
1
+ # https://dependabot.com/
2
+ version: 1
3
+ update_configs:
4
+ - package_manager: "ruby:bundler"
5
+ directory: "/"
6
+ update_schedule: "live"
7
+ default_reviewers:
8
+ - "otherguy"
9
+ default_assignees:
10
+ - "otherguy"
11
+ default_labels:
12
+ - "dependabot 🤖"
13
+ version_requirement_updates: "auto"
@@ -0,0 +1,16 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ # Unix-style newlines with a newline ending every file
7
+ [*]
8
+ indent_style = space
9
+ end_of_line = lf
10
+ insert_final_newline = true
11
+ trim_trailing_whitespace = true
12
+ charset = utf-8
13
+ indent_size = 2
14
+
15
+ [*.md]
16
+ indent_size = 4
@@ -0,0 +1,37 @@
1
+ ### macOS ###
2
+ .DS_Store
3
+ .AppleDouble
4
+ .LSOverride
5
+
6
+ # Thumbnails
7
+ ._*
8
+
9
+ # Files that might appear in the root of a volume
10
+ .DocumentRevisions-V100
11
+ .fseventsd
12
+ .Spotlight-V100
13
+ .TemporaryItems
14
+ .Trashes
15
+ .VolumeIcon.icns
16
+ .com.apple.timemachine.donotpresent
17
+
18
+
19
+ ### VisualStudioCode ###
20
+ .vscode/*
21
+ !.vscode/settings.json
22
+ !.vscode/tasks.json
23
+ !.vscode/launch.json
24
+ !.vscode/extensions.json
25
+ .history
26
+
27
+
28
+ ### Application ###
29
+ .rspec_status
30
+ coverage
31
+ test-report.xml
32
+ .scannerwork
33
+ rubocop.json
34
+ .idea
35
+ *.gem
36
+ .bundle/
37
+ cc-test-reporter
@@ -0,0 +1,28 @@
1
+ pull_request_rules:
2
+
3
+ # Automatically merge Dependabot Pull Requests
4
+ - name: Automatic merge for Dependabot
5
+ conditions:
6
+ - author=dependabot-preview[bot]
7
+ - status-success=Travis CI - Pull Request
8
+ - base=master
9
+ actions:
10
+ merge:
11
+ method: squash
12
+ strict: smart
13
+
14
+ # Delete branch after automatic merge
15
+ - name: Delete branch after merge
16
+ conditions:
17
+ - merged
18
+ actions:
19
+ delete_head_branch: {}
20
+
21
+ # Remove outdated reviews
22
+ - name: Remove outdated reviews
23
+ conditions:
24
+ - base=master
25
+ actions:
26
+ dismiss_reviews:
27
+ approved: True
28
+ changes_requested: True
data/.rspec ADDED
@@ -0,0 +1,5 @@
1
+ --require spec_helper
2
+ --color
3
+ --format RspecSonarqubeFormatter
4
+ --out test-report.xml
5
+ --format documentation
@@ -0,0 +1,76 @@
1
+ # Common configuration.
2
+ AllCops:
3
+ RubyInterpreters:
4
+ - ruby
5
+ - rake
6
+ DisplayStyleGuide: true
7
+ ExtraDetails: true
8
+ TargetRubyVersion: ~
9
+ Exclude:
10
+ - 'vendor/**/*'
11
+ - 'bin/**/*'
12
+
13
+ # and/&& or/|| should not be replaced!
14
+ # http://www.virtuouscode.com/2010/08/02/using-and-and-or-in-ruby/
15
+ Style/AndOr:
16
+ EnforcedStyle: conditionals
17
+
18
+ # Modern screens can easily display more than 80 characters.
19
+ Metrics/LineLength:
20
+ Max: 250
21
+
22
+ Metrics/BlockLength:
23
+ Exclude:
24
+ - '**/*.gemspec'
25
+ - 'spec/**/*_spec.rb'
26
+
27
+ # FrozenStringLiteralComment for Ruby 3 upgrade
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: true
30
+
31
+ # Conditional assignments make the code unreadable sometimes.
32
+ Style/ConditionalAssignment:
33
+ Enabled: false
34
+
35
+ # Check with yard instead.
36
+ Style/Documentation:
37
+ Enabled: false
38
+
39
+ # Consistent hash indentation
40
+ Layout/FirstHashElementIndentation:
41
+ EnforcedStyle: consistent
42
+
43
+ # Consistent array indentation
44
+ Layout/FirstArrayElementIndentation:
45
+ EnforcedStyle: consistent
46
+
47
+ # Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
48
+ # The argument that fail should be used to abort the program is wrong too,
49
+ # there's Kernel#abort for that.
50
+ Style/SignalException:
51
+ EnforcedStyle: only_raise
52
+
53
+ # Symbol Arrays cop enabled (drops support for Ruby 1.9)
54
+ Style/SymbolArray:
55
+ Enabled: true
56
+
57
+ # Mixing the styles looks just silly
58
+ Style/HashSyntax:
59
+ EnforcedStyle: ruby19_no_mixed_keys
60
+
61
+ # has_key? and has_value? are far more readable than key? and value?
62
+ Style/PreferredHashMethods:
63
+ Enabled: false
64
+
65
+ # Align hashes like a table
66
+ Layout/HashAlignment:
67
+ EnforcedColonStyle: table
68
+ EnforcedHashRocketStyle: table
69
+
70
+ # Align arguments with the same indentation level
71
+ Layout/ArgumentAlignment:
72
+ EnforcedStyle: with_fixed_indentation
73
+
74
+ # Allow braces around hash parameters, context dependent
75
+ Style/BracesAroundHashParameters:
76
+ EnforcedStyle: context_dependent
@@ -0,0 +1 @@
1
+ rspec-sonarqube-formatter
@@ -0,0 +1,2 @@
1
+ 2.6.5
2
+
@@ -0,0 +1,60 @@
1
+ language: ruby
2
+ os: linux
3
+ cache: bundler
4
+
5
+ env:
6
+ global:
7
+ # This is a write-only ID that can only post test reports.
8
+ - CC_TEST_REPORTER_ID=fe29c7a08645a8e6de55dd7d55b2ae357d92ae9ee154874c900b5a6faa3ec8ec
9
+ - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
10
+
11
+ rvm:
12
+ - 2.3
13
+ - 2.4
14
+ - 2.5
15
+ - 2.6
16
+
17
+ before_install: gem install bundler
18
+
19
+ install:
20
+ - bundle install --retry=3
21
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
22
+ - chmod +x ./cc-test-reporter
23
+ - ./cc-test-reporter before-build
24
+
25
+ script:
26
+ - bundle exec rake spec
27
+ - bundle exec rubocop --format progress --format json --out rubocop.json
28
+ - sonar-scanner
29
+
30
+ after_script:
31
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
32
+
33
+ addons:
34
+ sonarcloud:
35
+ organization: otherguy
36
+ token:
37
+ secure: o3T/a0jNWWHRQhsbH2NvdFYbC8fugnWwQD1QUdMR/s2/GzPRTud6eQlBP15bxY3kedEtwXx/368A5urO/ciIQf+OFiG9/fMdLU2PUgZgX8y8OMuD7w3nVHTSbPTj4ZOytMWZwGDThms/yCfYlnc7LaiDJTVWDSMXGU1UCpwyTkxAnr/4rXqK6YMAR4eqFLyzNw2b0JC0C/PRbIU7So4hfzqe4O0DC0VfVmrqRjlp6sfX5/KHPPXSgW/CETpR6JrS4SV7xVjW8nsBXHUFWGl1RCLSUf8CT58kLCO0Vl+OAqcUbTGQJVMlLSYc5YgdFqtacCXw5eJUIb+sCot91IyV2uz98tfhWd8BXolifVUEhsdQd17GpaKHUlT+if28TUUgUMVbLEXoUqwHtfFY6dHjui2oRElFpRYyOlqedcgM1MLzvnK8DGTRWuhuoYZmVUkDsE28vauGP/UWgykLrMc6wFwPW042NMrXzEiifLmXihU+lW4eFYOW0wW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fo6ZVg3qXs7Ll3jbs7nUjBq8yVIIXLVgwQ7JgmnPgsMQ05PcSc1GZG5rJ+sgbapbTLhss3ygsXPpJg7Tfu3JzJ6zAHrPc/I3HWVvYV2mz7rqhKiXVHKEDN9yULDGIBKgrNZmvyinJhPQay1a1h/jLfX5hp0wSjUeiyZKmdKYOu/6a4myrq+GHaUwtGyWcAk1DzX0d1sMptSKKmj56vjAiLZtGawVazkMdYzMZ5szOCI2wz1ps2A+3h28TL8UOSGCjZgx3dyuXBY9QHweEAJqDy7FlFN8=
56
+ file: "*.gem"
57
+ skip_cleanup: true
58
+ on:
59
+ tags: true
60
+ rvm: 2.6
@@ -0,0 +1,3 @@
1
+ {
2
+ "ruby.rubocop.useBundler": true
3
+ }
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in rspec_sonarqube_formatter.gemspec
8
+ gemspec
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspec-sonarqube-formatter (1.0.0)
5
+ rspec (~> 3.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ coveralls (0.8.23)
12
+ json (>= 1.8, < 3)
13
+ simplecov (~> 0.16.1)
14
+ term-ansicolor (~> 1.3)
15
+ thor (>= 0.19.4, < 2.0)
16
+ tins (~> 1.6)
17
+ diff-lcs (1.3)
18
+ docile (1.3.2)
19
+ jaro_winkler (1.5.4)
20
+ json (2.2.0)
21
+ parallel (1.19.1)
22
+ parser (2.6.5.0)
23
+ ast (~> 2.4.0)
24
+ rainbow (3.0.0)
25
+ rake (13.0.1)
26
+ rspec (3.9.0)
27
+ rspec-core (~> 3.9.0)
28
+ rspec-expectations (~> 3.9.0)
29
+ rspec-mocks (~> 3.9.0)
30
+ rspec-core (3.9.0)
31
+ rspec-support (~> 3.9.0)
32
+ rspec-expectations (3.9.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.9.0)
35
+ rspec-mocks (3.9.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.9.0)
38
+ rspec-support (3.9.0)
39
+ rubocop (0.77.0)
40
+ jaro_winkler (~> 1.5.1)
41
+ parallel (~> 1.10)
42
+ parser (>= 2.6)
43
+ rainbow (>= 2.2.2, < 4.0)
44
+ ruby-progressbar (~> 1.7)
45
+ unicode-display_width (>= 1.4.0, < 1.7)
46
+ ruby-progressbar (1.10.1)
47
+ simplecov (0.16.1)
48
+ docile (~> 1.1)
49
+ json (>= 1.8, < 3)
50
+ simplecov-html (~> 0.10.0)
51
+ simplecov-html (0.10.2)
52
+ simplecov-json (0.2)
53
+ json
54
+ simplecov
55
+ term-ansicolor (1.7.1)
56
+ tins (~> 1.0)
57
+ thor (0.20.3)
58
+ tins (1.22.2)
59
+ unicode-display_width (1.6.0)
60
+
61
+ PLATFORMS
62
+ ruby
63
+
64
+ DEPENDENCIES
65
+ bundler (~> 2.0.2)
66
+ coveralls (~> 0.8.23)
67
+ rake (~> 13.0.1)
68
+ rspec-sonarqube-formatter!
69
+ rubocop (~> 0.77.0)
70
+ simplecov (~> 0.16.1)
71
+ simplecov-json (~> 0.2.0)
72
+
73
+ BUNDLED WITH
74
+ 2.0.2
@@ -0,0 +1,25 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright © `2019` `Alexander Graf`
5
+
6
+ Permission is hereby granted, free of charge, to any person
7
+ obtaining a copy of this software and associated documentation
8
+ files (the “Software”), to deal in the Software without
9
+ restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the
12
+ Software is furnished to do so, subject to the following
13
+ conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # RSpec SonarQube Formatter
2
+
3
+ Rspec formatter to generates an xml file for SonarQube, using the generec-test-data format,
4
+
5
+ [![Gem Version](https://img.shields.io/gem/v/rspec-sonarqube-formatter)][rubygems]
6
+ [![Downloads](https://img.shields.io/gem/dt/rspec-sonarqube-formatter)][rubygems]
7
+ [![GitHub issues](https://img.shields.io/github/issues/otherguy/rspec-sonarqube-formatter)][issues]
8
+ [![Travis](https://img.shields.io/travis/com/otherguy/rspec-sonarqube-formatter)][travis]
9
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=otherguy_rspec-sonarqube-formatter&metric=alert_status)][sonarqube]
10
+ [![Coveralls](https://img.shields.io/coveralls/github/otherguy/rspec-sonarqube-formatter)][coveralls]
11
+ [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/otherguy/rspec-sonarqube-formatter)][codeclimate]
12
+ [![License](https://img.shields.io/github/license/otherguy/rspec-sonarqube-formatter)][license]
13
+
14
+ [rubygems]: https://rubygems.org/gems/rspec-sonarqube-formatter
15
+ [issues]: https://github.com/otherguy/rspec-sonarqube-formatter/issues
16
+ [travis]: https://travis-ci.com/otherguy/rspec-sonarqube-formatter
17
+ [coveralls]: https://coveralls.io/github/otherguy/rspec-sonarqube-formatter
18
+ [codeclimate]: https://codeclimate.com/github/otherguy/rspec-sonarqube-formatter
19
+ [sonarqube]: https://sonarcloud.io/dashboard?id=otherguy_rspec-sonarqube-formatter
20
+ [license]: https://github.com/otherguy/rspec-sonarqube-formatter/blob/master/LICENSE.md
21
+
22
+
23
+ ## Development
24
+
25
+ gem install bundler -v 2.0.2
26
+ bundle install
27
+
28
+
29
+ Tests:
30
+ bundle exec rake spec
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RspecSonarqubeFormatter
4
+ ::RSpec::Core::Formatters.register self, :example_group_started, :example_started, :example_passed,
5
+ :example_pending, :example_failed, :start, :stop, :exam
6
+
7
+ def initialize(output)
8
+ @output = output
9
+ @current_file = ''
10
+ @last_failure_index = 0
11
+ end
12
+
13
+ def start(_notification)
14
+ @output.puts '<?xml version="1.0" encoding="UTF-8"?>'
15
+ @output.puts '<testExecutions version="1">'
16
+ end
17
+
18
+ def stop(_notification)
19
+ @output.puts ' </file>' if @current_file != ''
20
+ @output.puts '</testExecutions>'
21
+ end
22
+
23
+ def example_group_started(notification)
24
+ return if notification.group.metadata[:file_path] == @current_file
25
+
26
+ @output.puts ' </file>' if @current_file != ''
27
+ @output.puts " <file path=\"#{notification.group.metadata[:file_path]}\">"
28
+
29
+ @current_file = notification.group.metadata[:file_path]
30
+ end
31
+
32
+ def example_started(notification)
33
+ @output.puts " <testCase name=\"#{clean_string(notification.example.description)}\" duration=\"#{(notification.example.execution_result.run_time.to_f * 1000).round}\">"
34
+ end
35
+
36
+ def example_failed(notification)
37
+ @output.puts " <failure message=\"#{notification.exception}\" stacktrace=\"#{notification.example.location}\" />"
38
+ @output.puts ' </testCase>'
39
+ end
40
+
41
+ def example_passed(_notification)
42
+ @output.puts ' </testCase>'
43
+ end
44
+
45
+ def example_pending(notification)
46
+ @output.puts " <skipped message=\"#{clean_string(notification.example.execution_result.pending_message)}\" />"
47
+ @output.puts ' </testCase>'
48
+ end
49
+
50
+ def clean_string(input)
51
+ input.to_s.gsub(/\e\[\d;*\d*m/, '').tr('"', "'")
52
+ end
53
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rspec-sonarqube-formatter'
8
+
9
+ # rubocop:disable Gemspec/DuplicatedAssignment
10
+ spec.version = '1.0.0-pre'
11
+ spec.version = ENV.fetch('TRAVIS_TAG') { spec.version }.to_s if ENV['TRAVIS']
12
+ # rubocop:enable Gemspec/DuplicatedAssignment
13
+
14
+ spec.platform = Gem::Platform::RUBY
15
+ spec.authors = ['Alexander Graf']
16
+ spec.email = ['alex@otherguy.uo']
17
+
18
+ spec.metadata = {
19
+ 'bug_tracker_uri' => 'https://github.com/otherguy/rspec-sonarqube-formatter/issues',
20
+ 'source_code_uri' => 'https://github.com/otherguy/rspec-sonarqube-formatter'
21
+ }
22
+
23
+ spec.summary = 'Generic test data formatter for SonarQube'
24
+ spec.description = 'Generates an XML report that the SonarQube Generic Test Data parser can understand'
25
+ spec.homepage = 'https://github.com/otherguy/rspec-sonarqube-formatter'
26
+ spec.license = 'MIT'
27
+
28
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
29
+
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ spec.add_dependency 'rspec', '~> 3.0'
35
+ spec.add_development_dependency 'bundler', '~> 2.0.2'
36
+ spec.add_development_dependency 'coveralls', '~> 0.8.23'
37
+ spec.add_development_dependency 'rake', '~> 13.0.1'
38
+ spec.add_development_dependency 'rubocop', '~> 0.77.0'
39
+ spec.add_development_dependency 'simplecov', '~> 0.16.1'
40
+ spec.add_development_dependency 'simplecov-json', '~> 0.2.0'
41
+ end
@@ -0,0 +1,31 @@
1
+ sonar.projectKey=otherguy_rspec-sonarqube-formatter
2
+ sonar.organization=otherguy
3
+
4
+ sonar.host.url=https://sonarcloud.io
5
+
6
+ sonar.language=ruby
7
+
8
+ # This is the name and version displayed in the SonarCloud UI.
9
+ sonar.projectName=rspec-sonarqube-formatter
10
+
11
+ # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
12
+ sonar.projectBaseDir=.
13
+ sonar.sources=lib
14
+ sonar.tests=spec
15
+
16
+ # Exclude coverage
17
+ sonar.exclusions=coverage/**/*,**/*.css,**/*.js
18
+
19
+ # Encoding of the source code. Default is default system encoding
20
+ sonar.sourceEncoding=UTF-8
21
+
22
+ # Test report XML
23
+ sonar.testExecutionReportPaths=test-report.xml
24
+
25
+ sonar.ruby.rubocop.reportPaths=rubocop.json
26
+ sonar.ruby.coverage.reportPaths=coverage/.resultset.json
27
+
28
+ # External links
29
+ sonar.links.ci=https://travis-ci.com/otherguy/rspec-sonarqube-formatter
30
+ sonar.links.issue=https://github.com/otherguy/rspec-sonarqube-formatter/issues
31
+ sonar.links.scm=https://github.com/otherguy/rspec-sonarqube-formatter
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-sonarqube-formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Graf
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.23
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.23
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 13.0.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 13.0.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.77.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.77.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.16.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.16.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov-json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.2.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.2.0
111
+ description: Generates an XML report that the SonarQube Generic Test Data parser can
112
+ understand
113
+ email:
114
+ - alex@otherguy.uo
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".codeclimate.yml"
120
+ - ".dependabot/config.yml"
121
+ - ".editorconfig"
122
+ - ".gitignore"
123
+ - ".mergify.yml"
124
+ - ".rspec"
125
+ - ".rubocop.yml"
126
+ - ".ruby-gemset"
127
+ - ".ruby-version"
128
+ - ".travis.yml"
129
+ - ".vscode/settings.json"
130
+ - Gemfile
131
+ - Gemfile.lock
132
+ - LICENSE.md
133
+ - README.md
134
+ - Rakefile
135
+ - lib/rspec_sonarqube_formatter.rb
136
+ - rspec-sonarqube-formatter.gemspec
137
+ - sonar-project.properties
138
+ homepage: https://github.com/otherguy/rspec-sonarqube-formatter
139
+ licenses:
140
+ - MIT
141
+ metadata:
142
+ bug_tracker_uri: https://github.com/otherguy/rspec-sonarqube-formatter/issues
143
+ source_code_uri: https://github.com/otherguy/rspec-sonarqube-formatter
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">"
156
+ - !ruby/object:Gem::Version
157
+ version: 1.3.1
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.7.7
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Generic test data formatter for SonarQube
164
+ test_files: []