xcop 0.8.0 → 0.10.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: 621974a384c1f03cc98fbadc4faa33c68221c0c003bfdbdabdd6b8f8a5434e01
4
- data.tar.gz: ae1523185af93addef82ef161f8d0c807cecfb0f6a9c7597907b31edad19c035
3
+ metadata.gz: 20e82504b35cb8e894ef5b12fee7e8b4a1043397dab64d017c62055716235dbd
4
+ data.tar.gz: 778ca1912da6fe7fdfdcf9e5a087048404a8f6a6b4b8968a4173159a460d88b4
5
5
  SHA512:
6
- metadata.gz: 83c34c3ce482c004d16ae4b6dee2ca731cfe1791ff219d2667de59d398e2281b7ec73a45fe59bf8f9466bd9ad32cda2e6fd596e47d5753e13c848e198d495e57
7
- data.tar.gz: f86b27b0e738e26180d06f04079273d77b48b2f339d339ce11e42b4d968f9e094caaca361544201096ec2501a5702149298b5edc6260c727e5bce362ec33e2eb
6
+ metadata.gz: 4095800866e282a2bfca1634eed729a30701278a2ba57bbbf8600a8c4129d269910d39e596ec6b1d2ae5492de7e3fd0d7a15f43e68e5892ed7a4ef4ae9966495
7
+ data.tar.gz: 0b416653535d27f02157d7ffe7c3aeba8fb3a14ccd32f54ade5281e77fca8bc996c21b7b3acb576bfef0c1da4488bdc80502cddc0b72dd53cc35af8849238e31
data/Gemfile CHANGED
@@ -1,37 +1,20 @@
1
- # Copyright (c) 2017-2025 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
 
21
4
  source 'https://rubygems.org'
22
5
  gemspec
23
6
 
24
- gem 'cucumber', '8.0.0', require: false
7
+ gem 'cucumber', '~>11.0', require: false
8
+ gem 'erb', '~>6.0', require: false
25
9
  gem 'loog', '>0', require: false
26
- gem 'minitest', '5.25.4', require: false
27
- gem 'minitest-reporters', '1.7.1', require: false
28
- gem 'rake', '13.2.1', require: false
29
- gem 'rspec-rails', '7.1.1', require: false
30
- gem 'rubocop', '1.71.2', require: false
31
- gem 'rubocop-minitest', '>0', require: false
32
- gem 'rubocop-performance', '>0', require: false
33
- gem 'rubocop-rake', '>0', require: false
34
- gem 'rubocop-rspec', '>0', require: false
35
- gem 'simplecov', '0.22.0', require: false
36
- gem 'simplecov-cobertura', '2.1.0', require: false
37
- gem 'yard', '0.9.37', require: false
10
+ gem 'minitest', '~>6.0', require: false
11
+ gem 'minitest-reporters', '~>1.7', require: false
12
+ gem 'rake', '~>13.2', require: false
13
+ gem 'rubocop', '~>1.75', require: false
14
+ gem 'rubocop-elegant', '~>0.5', require: false
15
+ gem 'rubocop-minitest', '~>0.38', require: false
16
+ gem 'rubocop-performance', '~>1.25', require: false
17
+ gem 'rubocop-rake', '~>0.7', require: false
18
+ gem 'simplecov', '~>0.22', require: false
19
+ gem 'simplecov-cobertura', '~>3.1', require: false
20
+ gem 'yard', '~>0.9', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,186 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ xcop (0.0.0)
5
+ differ (~> 0.1.2)
6
+ nokogiri (~> 1.8)
7
+ rainbow (~> 3.0)
8
+ slop (~> 4.4)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ ansi (1.6.0)
14
+ ast (2.4.3)
15
+ base64 (0.3.0)
16
+ bigdecimal (4.1.2)
17
+ builder (3.3.0)
18
+ cucumber (11.1.1)
19
+ base64 (~> 0.2)
20
+ builder (~> 3.2)
21
+ cucumber-ci-environment (> 9, < 12)
22
+ cucumber-core (>= 16.2.0, < 17)
23
+ cucumber-cucumber-expressions (> 17, < 20)
24
+ cucumber-html-formatter (> 21, < 24)
25
+ diff-lcs (~> 1.5)
26
+ logger (~> 1.6)
27
+ mini_mime (~> 1.1)
28
+ multi_test (~> 1.1)
29
+ sys-uname (~> 1.5)
30
+ cucumber-ci-environment (11.0.0)
31
+ cucumber-core (16.2.0)
32
+ cucumber-gherkin (> 36, < 40)
33
+ cucumber-messages (> 31, < 33)
34
+ cucumber-tag-expressions (> 6, < 9)
35
+ cucumber-cucumber-expressions (19.0.1)
36
+ bigdecimal
37
+ cucumber-gherkin (39.1.0)
38
+ cucumber-messages (>= 31, < 33)
39
+ cucumber-html-formatter (23.1.0)
40
+ cucumber-messages (> 23, < 33)
41
+ cucumber-messages (32.3.1)
42
+ cucumber-tag-expressions (8.1.0)
43
+ diff-lcs (1.6.2)
44
+ differ (0.1.2)
45
+ docile (1.4.1)
46
+ drb (2.2.3)
47
+ ellipsized (0.3.0)
48
+ erb (6.0.5)
49
+ ffi (1.17.4-aarch64-linux-gnu)
50
+ ffi (1.17.4-aarch64-linux-musl)
51
+ ffi (1.17.4-arm-linux-gnu)
52
+ ffi (1.17.4-arm-linux-musl)
53
+ ffi (1.17.4-arm64-darwin)
54
+ ffi (1.17.4-x64-mingw-ucrt)
55
+ ffi (1.17.4-x86_64-darwin)
56
+ ffi (1.17.4-x86_64-linux-gnu)
57
+ ffi (1.17.4-x86_64-linux-musl)
58
+ json (2.20.0)
59
+ language_server-protocol (3.17.0.6)
60
+ lint_roller (1.1.0)
61
+ logger (1.7.0)
62
+ loog (0.8.0)
63
+ ellipsized
64
+ logger (~> 1.0)
65
+ memoist3 (1.0.0)
66
+ mini_mime (1.1.5)
67
+ minitest (6.0.6)
68
+ drb (~> 2.0)
69
+ prism (~> 1.5)
70
+ minitest-reporters (1.8.0)
71
+ ansi
72
+ builder
73
+ minitest (>= 5.0, < 7)
74
+ ruby-progressbar
75
+ multi_test (1.1.0)
76
+ nokogiri (1.19.3-aarch64-linux-gnu)
77
+ racc (~> 1.4)
78
+ nokogiri (1.19.3-aarch64-linux-musl)
79
+ racc (~> 1.4)
80
+ nokogiri (1.19.3-arm-linux-gnu)
81
+ racc (~> 1.4)
82
+ nokogiri (1.19.3-arm-linux-musl)
83
+ racc (~> 1.4)
84
+ nokogiri (1.19.3-arm64-darwin)
85
+ racc (~> 1.4)
86
+ nokogiri (1.19.3-x64-mingw-ucrt)
87
+ racc (~> 1.4)
88
+ nokogiri (1.19.3-x86_64-darwin)
89
+ racc (~> 1.4)
90
+ nokogiri (1.19.3-x86_64-linux-gnu)
91
+ racc (~> 1.4)
92
+ nokogiri (1.19.3-x86_64-linux-musl)
93
+ racc (~> 1.4)
94
+ parallel (1.28.0)
95
+ parser (3.3.11.1)
96
+ ast (~> 2.4.1)
97
+ racc
98
+ prism (1.9.0)
99
+ racc (1.8.1)
100
+ rainbow (3.1.1)
101
+ rake (13.4.2)
102
+ regexp_parser (2.12.0)
103
+ rexml (3.4.4)
104
+ rubocop (1.88.2)
105
+ json (~> 2.3)
106
+ language_server-protocol (~> 3.17.0.2)
107
+ lint_roller (~> 1.1.0)
108
+ parallel (>= 1.10)
109
+ parser (>= 3.3.0.2)
110
+ rainbow (>= 2.2.2, < 4.0)
111
+ regexp_parser (>= 2.9.3, < 3.0)
112
+ rubocop-ast (>= 1.49.0, < 2.0)
113
+ ruby-progressbar (~> 1.7)
114
+ unicode-display_width (>= 2.4.0, < 4.0)
115
+ rubocop-ast (1.49.1)
116
+ parser (>= 3.3.7.2)
117
+ prism (~> 1.7)
118
+ rubocop-elegant (0.7.1)
119
+ lint_roller (~> 1.1)
120
+ rubocop (~> 1.75)
121
+ rubocop-minitest (0.39.1)
122
+ lint_roller (~> 1.1)
123
+ rubocop (>= 1.75.0, < 2.0)
124
+ rubocop-ast (>= 1.38.0, < 2.0)
125
+ rubocop-performance (1.26.1)
126
+ lint_roller (~> 1.1)
127
+ rubocop (>= 1.75.0, < 2.0)
128
+ rubocop-ast (>= 1.47.1, < 2.0)
129
+ rubocop-rake (0.7.1)
130
+ lint_roller (~> 1.1)
131
+ rubocop (>= 1.72.1)
132
+ ruby-progressbar (1.13.0)
133
+ simplecov (0.22.0)
134
+ docile (~> 1.1)
135
+ simplecov-html (~> 0.11)
136
+ simplecov_json_formatter (~> 0.1)
137
+ simplecov-cobertura (3.1.0)
138
+ rexml
139
+ simplecov (~> 0.19)
140
+ simplecov-html (0.13.2)
141
+ simplecov_json_formatter (0.1.4)
142
+ slop (4.10.1)
143
+ sys-uname (1.5.1)
144
+ ffi (~> 1.1)
145
+ memoist3 (~> 1.0.0)
146
+ sys-uname (1.5.1-universal-mingw32)
147
+ ffi (~> 1.1)
148
+ memoist3 (~> 1.0.0)
149
+ win32ole
150
+ unicode-display_width (3.2.0)
151
+ unicode-emoji (~> 4.1)
152
+ unicode-emoji (4.2.0)
153
+ win32ole (1.9.3)
154
+ yard (0.9.44)
155
+
156
+ PLATFORMS
157
+ aarch64-linux-gnu
158
+ aarch64-linux-musl
159
+ arm-linux-gnu
160
+ arm-linux-musl
161
+ arm64-darwin
162
+ arm64-darwin-23
163
+ x64-mingw-ucrt
164
+ x86_64-darwin
165
+ x86_64-linux-gnu
166
+ x86_64-linux-musl
167
+
168
+ DEPENDENCIES
169
+ cucumber (~> 11.0)
170
+ erb (~> 6.0)
171
+ loog (> 0)
172
+ minitest (~> 6.0)
173
+ minitest-reporters (~> 1.7)
174
+ rake (~> 13.2)
175
+ rubocop (~> 1.75)
176
+ rubocop-elegant (~> 0.5)
177
+ rubocop-minitest (~> 0.38)
178
+ rubocop-performance (~> 1.25)
179
+ rubocop-rake (~> 0.7)
180
+ simplecov (~> 0.22)
181
+ simplecov-cobertura (~> 3.1)
182
+ xcop!
183
+ yard (~> 0.9)
184
+
185
+ BUNDLED WITH
186
+ 2.5.16
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2025 Yegor Bugayenko
3
+ Copyright (c) 2017-2026 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/LICENSES/MIT.txt ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2026 Yegor Bugayenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the 'Software'), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,69 +1,68 @@
1
- <img alt="XCOP logo" src="/logo.svg" width="64px"/>
1
+ # Style Checker (Linter) for XML Files
2
2
 
3
3
  [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/xcop)](http://www.rultor.com/p/yegor256/xcop)
4
+ [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/xcop)](https://www.rultor.com/p/yegor256/xcop)
5
5
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
6
6
 
7
7
  [![rake](https://github.com/yegor256/xcop/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/xcop/actions/workflows/rake.yml)
8
- [![PDD status](http://www.0pdd.com/svg?name=yegor256/xcop)](http://www.0pdd.com/p?name=yegor256/xcop)
9
- [![Gem Version](https://badge.fury.io/rb/xcop.svg)](http://badge.fury.io/rb/xcop)
8
+ [![PDD status](https://www.0pdd.com/svg?name=yegor256/xcop)](https://www.0pdd.com/p?name=yegor256/xcop)
9
+ [![Gem Version](https://badge.fury.io/rb/xcop.svg)](https://badge.fury.io/rb/xcop)
10
10
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/xcop/blob/master/LICENSE.txt)
11
- [![Maintainability](https://api.codeclimate.com/v1/badges/396ec0584e0a84adc723/maintainability)](https://codeclimate.com/github/yegor256/xcop/maintainability)
12
11
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/xcop.svg)](https://codecov.io/github/yegor256/xcop?branch=master)
13
- ![Lines of code](https://img.shields.io/tokei/lines/github/yegor256/xcop)
14
12
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/xcop)](https://hitsofcode.com/view/github/yegor256/xcop)
15
13
 
16
14
  This command line tool validates your XML files for proper formatting.
17
- If they are not formatted correctly, it prints the difference and
18
- exits with an error. You can use it two ways: 1) to fail your build
19
- if any XML-ish files (for example, XML, XSD, XSL, or XHTML) are not formatted correctly,
20
- and 2) to format them correctly using `--fix` option.
15
+ If they are not formatted correctly, it prints the difference
16
+ and exits with an error.
17
+ You can use it in two ways: 1) to fail your build if any XML-ish files
18
+ (for example, XML, XSD, XSL, or XHTML) are not formatted correctly,
19
+ and 2) to format them correctly using the `--fix` option.
21
20
 
22
- Read this blog post first:
23
- [_XCOP—XML Style Checker_](https://www.yegor256.com/2017/08/29/xcop.html).
21
+ Read this blog post first: [_XCOP—XML Style Checker_][blog].
24
22
 
25
- Make sure you have [Ruby installed](https://www.ruby-lang.org/en/documentation/installation/)
26
- and then install the tool:
23
+ Make sure you have [Ruby] installed and then install the tool:
27
24
 
28
25
  ```bash
29
- $ gem install xcop
26
+ gem install xcop
30
27
  ```
31
28
 
32
29
  Run it locally and read its output:
33
30
 
34
31
  ```bash
35
- $ xcop --help
32
+ xcop --help
36
33
  ```
37
34
 
38
35
  To validate formatting of your XML files just pass their names
39
36
  as arguments:
40
37
 
41
38
  ```bash
42
- $ xcop file1.xml file2.xml
39
+ xcop file1.xml file2.xml
43
40
  ```
44
41
 
45
42
  If your files are not formatted correctly and `xcop` complains, you
46
- can ask it to "beautify" them, using `--fix` option:
43
+ can ask it to "beautify" them using the `--fix` option:
47
44
 
48
45
  ```bash
49
- $ xcop --fix broken-file.xml
46
+ xcop --fix broken-file.xml
50
47
  ```
51
48
 
52
- To fix all files in the directory you can do
53
- ([won't work](https://askubuntu.com/questions/343727/) if your file names contain spaces):
49
+ You can also pass a directory as an argument. In that case `xcop` will
50
+ recursively find every `.xml`, `.xsd`, `.xhtml`, `.xsl`, and `.html`
51
+ file inside it:
54
52
 
55
53
  ```bash
56
- $ xcop --fix $(find . -name '*.xml')
54
+ xcop .
55
+ xcop --fix src/resources
57
56
  ```
58
57
 
59
58
  ## Defaults
60
59
 
61
- You can put command line options into `.xcop` file in the directory
60
+ You can put command line options into a `.xcop` file in the directory
62
61
  where you start `xcop`. Each option should take a single line in the file.
63
- They all will be _added_ to the list of options you specify. For example,
64
- as it was suggested in [this blog post](https://www.yegor256.com/2022/07/20/command-line-defaults.html):
62
+ They will all be _added_ to the list of options you specify. For example,
63
+ as suggested in [this blog post](https://www.yegor256.com/2022/07/20/command-line-defaults.html):
65
64
 
66
- ```
65
+ ```text
67
66
  --nocolor
68
67
  --quiet
69
68
  --include=**/*
@@ -90,7 +89,7 @@ end
90
89
 
91
90
  ## How to use as GitHub action?
92
91
 
93
- Create new workflow file in repository under `.github/workflows/xcop.yml`:
92
+ Create a new workflow file in your repository under `.github/workflows/xcop.yml`:
94
93
 
95
94
  ```yaml
96
95
  ---
@@ -112,7 +111,7 @@ jobs:
112
111
  - uses: g4s8/xcop-action@master
113
112
  ```
114
113
 
115
- To customize files pattern use `files`:
114
+ To customize the files pattern, use the `files` parameter:
116
115
 
117
116
  ```yaml
118
117
  - uses: g4s8/xcop-action@master
@@ -123,7 +122,7 @@ To customize files pattern use `files`:
123
122
  ## How to use in Maven `pom.xml`?
124
123
 
125
124
  You can integrate it with the help of
126
- [maven-antrun-plugin](http://maven.apache.org/plugins/maven-antrun-plugin/):
125
+ [maven-antrun-plugin](https://maven.apache.org/plugins/maven-antrun-plugin/):
127
126
 
128
127
  ```xml
129
128
  <project>
@@ -184,13 +183,16 @@ Something like this should work:
184
183
  ## How to contribute
185
184
 
186
185
  Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
187
- Make sure you build is green before you contribute
188
- your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
186
+ Make sure your build is green before you contribute your pull request.
187
+ You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
189
188
  [Bundler](https://bundler.io/) installed. Then:
190
189
 
191
- ```
192
- $ bundle update
193
- $ bundle exec rake
190
+ ```bash
191
+ bundle update
192
+ bundle exec rake
194
193
  ```
195
194
 
196
195
  If it's clean and you don't see any error messages, submit your pull request.
196
+
197
+ [Ruby]: https://www.ruby-lang.org/en/documentation/installation/
198
+ [blog]: https://www.yegor256.com/2017/08/29/xcop.html
data/REUSE.toml ADDED
@@ -0,0 +1,36 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ version = 1
5
+ [[annotations]]
6
+ path = [
7
+ ".DS_Store",
8
+ ".gitattributes",
9
+ ".gitignore",
10
+ ".pdd",
11
+ "**.json",
12
+ "**.md",
13
+ "**.png",
14
+ "**.svg",
15
+ "**.txt",
16
+ "**/.DS_Store",
17
+ "**/.gitignore",
18
+ "**/.pdd",
19
+ "**/*.csv",
20
+ "**/*.jpg",
21
+ "**/*.json",
22
+ "**/*.md",
23
+ "**/*.pdf",
24
+ "**/*.png",
25
+ "**/*.svg",
26
+ "**/*.txt",
27
+ "**/*.vm",
28
+ "**/CNAME",
29
+ "**/Gemfile.lock",
30
+ "Gemfile.lock",
31
+ "README.md",
32
+ "renovate.json",
33
+ ]
34
+ precedence = "override"
35
+ SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
36
+ SPDX-License-Identifier = "MIT"
data/Rakefile CHANGED
@@ -1,27 +1,9 @@
1
- # Copyright (c) 2017-2025 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
 
21
- require 'rubygems'
22
4
  require 'rake'
23
- require 'rdoc'
24
5
  require 'rake/clean'
6
+ require 'rubygems'
25
7
 
26
8
  def name
27
9
  @name ||= File.basename(Dir['*.gemspec'].first, '.*')
@@ -46,14 +28,14 @@ require 'yard'
46
28
  desc 'Build Yard documentation'
47
29
  YARD::Rake::YardocTask.new do |t|
48
30
  t.files = ['lib/**/*.rb']
31
+ t.options = ['--fail-on-warning']
49
32
  end
50
33
 
51
34
  require 'rubocop/rake_task'
52
35
  desc 'Run RuboCop on all directories'
53
36
  RuboCop::RakeTask.new(:rubocop) do |task|
54
37
  task.fail_on_error = true
55
- task.requires << 'rubocop-rspec'
56
- task.options = ['--display-cop-names']
38
+ task.options = ['--display-cop-names', '--config', '.rubocop.yml']
57
39
  end
58
40
 
59
41
  require 'cucumber/rake/task'
data/bin/xcop CHANGED
@@ -1,23 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (c) 2017-2025 Yegor Bugayenko
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the 'Software'), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in all
12
- # copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- # SOFTWARE.
2
+ # SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
3
+ # SPDX-License-Identifier: MIT
21
4
 
22
5
  STDOUT.sync = true
23
6
 
@@ -82,8 +65,8 @@ if opts[:exclude]
82
65
  end
83
66
 
84
67
  if opts.fix?
85
- Xcop::CLI.new(files).fix do |f|
86
- puts "#{f} fixed" unless opts.quiet?
68
+ Xcop::CLI.new(files).fix do |f, status|
69
+ puts "#{f} #{status}" unless opts.quiet?
87
70
  end
88
71
  else
89
72
  begin
@@ -92,6 +75,6 @@ else
92
75
  end
93
76
  rescue StandardError => e
94
77
  puts e.message
95
- exit -1
78
+ exit 1
96
79
  end
97
80
  end
data/cucumber.yml CHANGED
@@ -1,24 +1,5 @@
1
- # (The MIT License)
2
- #
3
- # Copyright (c) 2017-2025 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
22
3
  ---
23
4
  default: --format pretty
24
5
  travis: --format progress
data/features/cli.feature CHANGED
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Command Line Processing
2
4
  As an author of XML I want to be able to
3
5
  call XCOP as a command line tool
@@ -41,3 +43,21 @@ Feature: Command Line Processing
41
43
  Then Exit code is zero
42
44
  Then I run bin/xcop with "broken.xml"
43
45
  Then Exit code is zero
46
+
47
+ Scenario: Validating a directory of XML files recursively
48
+ Given I have a "pkg/top.xml" file with content:
49
+ """
50
+ <?xml version="1.0"?>
51
+ <hello>Hello, world!</hello>
52
+
53
+ """
54
+ And I have a "pkg/nested/deep.xsl" file with content:
55
+ """
56
+ <?xml version="1.0"?>
57
+ <hello>Hello, world!</hello>
58
+
59
+ """
60
+ When I run bin/xcop with "pkg"
61
+ Then Stdout contains "top.xml looks good"
62
+ And Stdout contains "deep.xsl looks good"
63
+ And Exit code is zero
@@ -0,0 +1,65 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+ Feature: Comment Formatting
4
+ As an author of XML I want XCOP to enforce
5
+ a single canonical layout for XML comments
6
+
7
+ Scenario: Messy single-line comment is rejected
8
+ Given I have a "single.xml" file with content:
9
+ """
10
+ <?xml version="1.0"?>
11
+ <a>
12
+ <!-- text -->
13
+ </a>
14
+
15
+ """
16
+ When I run bin/xcop with "single.xml"
17
+ Then Exit code is not zero
18
+
19
+ Scenario: Messy single-line comment is fixed
20
+ Given I have a "single.xml" file with content:
21
+ """
22
+ <?xml version="1.0"?>
23
+ <a>
24
+ <!-- text -->
25
+ </a>
26
+
27
+ """
28
+ When I run bin/xcop with "--fix single.xml"
29
+ Then Exit code is zero
30
+ And I run bin/xcop with "single.xml"
31
+ Then Exit code is zero
32
+ And Stdout contains "single.xml looks good"
33
+
34
+ Scenario: Over-indented multi-line comment is rejected
35
+ Given I have a "multi.xml" file with content:
36
+ """
37
+ <?xml version="1.0"?>
38
+ <a>
39
+ <!--
40
+ line1
41
+ line2
42
+ -->
43
+ </a>
44
+
45
+ """
46
+ When I run bin/xcop with "multi.xml"
47
+ Then Exit code is not zero
48
+
49
+ Scenario: Over-indented multi-line comment is fixed
50
+ Given I have a "multi.xml" file with content:
51
+ """
52
+ <?xml version="1.0"?>
53
+ <a>
54
+ <!--
55
+ line1
56
+ line2
57
+ -->
58
+ </a>
59
+
60
+ """
61
+ When I run bin/xcop with "--fix multi.xml"
62
+ Then Exit code is zero
63
+ And I run bin/xcop with "multi.xml"
64
+ Then Exit code is zero
65
+ And Stdout contains "multi.xml looks good"