rubocop-checkstyle_formatter 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84d348075a9ec939c1e7c4f190fc0aee41758b66525acafdf783680c95e30fe1
4
- data.tar.gz: 3885583e0db6fa3387578bba54454a99ce26c3333d1b4f49a00b737afaa8ccaa
3
+ metadata.gz: aae9d157a919387183639a6e19e6e9ac6bb7638b34bf1baea1261e95b9a3a85f
4
+ data.tar.gz: 208a865f267e4c9dd57c418a345f41a066fc9db2cf4dabf8e060115e92094d16
5
5
  SHA512:
6
- metadata.gz: cc6769ea9385d50d149db42f78076114fbb0e692c89ee534eadd432cd413ec657d2cb35e4a7d4d4ee40f49068282296432ed02efe8314f943187f7e53934c97d
7
- data.tar.gz: 6ddb1feda33de9f5fa3b2ff33cab5b886d3585b8a358450d2f2302c3663c8158f14e7afab7c9b7f4e714ea228719f4551f024157b5270832aad78ba2cf315e87
6
+ metadata.gz: 5ca0f13a8669914cd85df3b7b059908ff651b6b31aa9a3110ef4ca31281f1f19d43f70da33a70d1d8bb08f283cf744d6bd3bfbbb2421670cc7241441bbd64976
7
+ data.tar.gz: c27ef939b08f70f6ea2f7df49a70d70b76416e17118d68d02f7f71e9336aa33829b27f475c33e229010dafcf3c78af7ddc2bb97e1aa25015c1281e2b61fd5d25
@@ -0,0 +1,30 @@
1
+ changelog:
2
+ exclude:
3
+ labels:
4
+ - ignore-for-release
5
+ categories:
6
+ - title: Breaking Changes
7
+ labels:
8
+ - breaking
9
+ - breaking-change
10
+ - Semver-Major
11
+ - title: Features
12
+ labels:
13
+ - enhancement
14
+ - feature
15
+ - title: Bug Fixes
16
+ labels:
17
+ - bug
18
+ - bugfix
19
+ - fix
20
+ - title: Documentation
21
+ labels:
22
+ - documentation
23
+ - docs
24
+ - title: Dependencies
25
+ labels:
26
+ - dependencies
27
+ - dependabot
28
+ - title: Other Changes
29
+ labels:
30
+ - "*"
data/README.md CHANGED
@@ -23,6 +23,13 @@ Or install it yourself as:
23
23
 
24
24
  $ rubocop --require rubocop/formatter/checkstyle_formatter --format RuboCop::Formatter::CheckstyleFormatter
25
25
 
26
+ Set `RUBOCOP_CHECKSTYLE_FORMATTER_OUTPUT_EMPTY_RESULT=false` to omit `<file>`
27
+ elements for files without offenses. The value is case-insensitive; by default,
28
+ and for all other values, those empty elements are included.
29
+ When empty `<file>` elements are emitted, the formatter warns on stderr that
30
+ this default will change in a future version. Set the variable to `false` now
31
+ to omit them and suppress the warning.
32
+
26
33
  I use this formatter in Jenkins with [Checkstyle plugin](https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin).
27
34
  As a part of build, I execute rubocop as shell script like:
28
35
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rubocop-checkstyle_formatter (0.7.0)
4
+ rubocop-checkstyle_formatter (0.8.0)
5
5
  rexml
6
6
  rubocop (>= 1.14.0)
7
7
 
@@ -26,9 +26,14 @@ module RuboCop
26
26
  @document = REXML::Document.new
27
27
  @document << REXML::XMLDecl.new
28
28
  @checkstyle = REXML::Element.new('checkstyle', @document)
29
+ @empty_file_output_warning_emitted = false
29
30
  end
30
31
 
31
32
  def file_finished(file, offenses)
33
+ return if omit_empty_file?(offenses)
34
+
35
+ warn_about_empty_file_output if offenses.empty?
36
+
32
37
  file_element = REXML::Element.new('file', @checkstyle)
33
38
  file_element.attributes['name'] = file_path(file)
34
39
  add_offenses(file_element, offenses)
@@ -50,6 +55,18 @@ module RuboCop
50
55
  ENV.key?('RUBOCOP_CHECKSTYLE_FORMATTER_ABSOLUTE_PATH')
51
56
  end
52
57
 
58
+ def omit_empty_file?(offenses)
59
+ offenses.empty? &&
60
+ ENV['RUBOCOP_CHECKSTYLE_FORMATTER_OUTPUT_EMPTY_RESULT'].to_s.casecmp?('false')
61
+ end
62
+
63
+ def warn_about_empty_file_output
64
+ return if @empty_file_output_warning_emitted
65
+
66
+ warn 'RUBOCOP_CHECKSTYLE_FORMATTER_OUTPUT_EMPTY_RESULT will default to false in a future version.'
67
+ @empty_file_output_warning_emitted = true
68
+ end
69
+
53
70
  def add_offenses(parent, offenses)
54
71
  offenses.each do |offense|
55
72
  error = REXML::Element.new('error', parent)
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |gem|
8
8
  gem.name = 'rubocop-checkstyle_formatter'
9
- gem.version = '0.7.0'
9
+ gem.version = '0.8.0'
10
10
  gem.authors = ['Eito Katagiri']
11
11
  gem.email = ['eitoball@gmail.com']
12
12
  gem.description = 'A formatter for rubocop that outputs in checkstyle format'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-checkstyle_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eito Katagiri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-12 00:00:00.000000000 Z
11
+ date: 2026-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rexml
@@ -143,6 +143,7 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
+ - ".github/release.yml"
146
147
  - ".github/workflows/build.yml"
147
148
  - ".gitignore"
148
149
  - ".rubocop.yml"