xcop 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.0pdd.yml +22 -0
- data/.github/workflows/actionlint.yml +44 -0
- data/.github/workflows/copyrights.yml +38 -0
- data/.github/workflows/pdd.yml +34 -0
- data/.github/workflows/rake.yml +24 -2
- data/.github/workflows/xcop.yml +34 -0
- data/.github/workflows/yamllint.yml +38 -0
- data/.rubocop.yml +23 -1
- data/.rultor.yml +23 -0
- data/.simplecov +1 -1
- data/Gemfile +16 -1
- data/LICENSE.txt +1 -1
- data/README.md +6 -14
- data/Rakefile +6 -17
- data/bin/xcop +4 -13
- data/cucumber.yml +22 -0
- data/features/cli.feature +0 -39
- data/features/step_definitions/steps.rb +4 -4
- data/features/support/env.rb +1 -1
- data/lib/xcop/cli.rb +4 -12
- data/lib/xcop/document.rb +4 -19
- data/lib/xcop/rake_task.rb +8 -7
- data/lib/xcop/version.rb +3 -3
- data/logo.svg +1 -1
- data/renovate.json +6 -0
- data/test/test__helper.rb +6 -7
- data/test/test_document.rb +3 -55
- data/test/test_rake_task.rb +2 -3
- data/xcop.gemspec +5 -14
- metadata +10 -104
- data/.github/ISSUE_TEMPLATE.md +0 -12
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 621974a384c1f03cc98fbadc4faa33c68221c0c003bfdbdabdd6b8f8a5434e01
|
4
|
+
data.tar.gz: ae1523185af93addef82ef161f8d0c807cecfb0f6a9c7597907b31edad19c035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c34c3ce482c004d16ae4b6dee2ca731cfe1791ff219d2667de59d398e2281b7ec73a45fe59bf8f9466bd9ad32cda2e6fd596e47d5753e13c848e198d495e57
|
7
|
+
data.tar.gz: f86b27b0e738e26180d06f04079273d77b48b2f339d339ce11e42b4d968f9e094caaca361544201096ec2501a5702149298b5edc6260c727e5bce362ec33e2eb
|
data/.0pdd.yml
CHANGED
@@ -1,3 +1,25 @@
|
|
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.
|
22
|
+
---
|
1
23
|
errors:
|
2
24
|
- yegor256@gmail.com
|
3
25
|
# alerts:
|
@@ -0,0 +1,44 @@
|
|
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.
|
22
|
+
---
|
23
|
+
# yamllint disable rule:line-length
|
24
|
+
name: actionlint
|
25
|
+
'on':
|
26
|
+
push:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
pull_request:
|
30
|
+
branches:
|
31
|
+
- master
|
32
|
+
jobs:
|
33
|
+
actionlint:
|
34
|
+
timeout-minutes: 15
|
35
|
+
runs-on: ubuntu-24.04
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v4
|
38
|
+
- name: Download actionlint
|
39
|
+
id: get_actionlint
|
40
|
+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
41
|
+
shell: bash
|
42
|
+
- name: Check workflow files
|
43
|
+
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
44
|
+
shell: bash
|
@@ -0,0 +1,38 @@
|
|
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.
|
22
|
+
---
|
23
|
+
# yamllint disable rule:line-length
|
24
|
+
name: copyrights
|
25
|
+
'on':
|
26
|
+
push:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
pull_request:
|
30
|
+
branches:
|
31
|
+
- master
|
32
|
+
jobs:
|
33
|
+
copyrights:
|
34
|
+
timeout-minutes: 15
|
35
|
+
runs-on: ubuntu-24.04
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v4
|
38
|
+
- uses: yegor256/copyrights-action@0.0.8
|
@@ -0,0 +1,34 @@
|
|
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.
|
22
|
+
---
|
23
|
+
# yamllint disable rule:line-length
|
24
|
+
name: pdd
|
25
|
+
on:
|
26
|
+
push:
|
27
|
+
pull_request:
|
28
|
+
jobs:
|
29
|
+
pdd:
|
30
|
+
timeout-minutes: 15
|
31
|
+
runs-on: ubuntu-24.04
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v4
|
34
|
+
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,4 +1,26 @@
|
|
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
22
|
---
|
23
|
+
# yamllint disable rule:line-length
|
2
24
|
name: rake
|
3
25
|
on:
|
4
26
|
push:
|
@@ -11,11 +33,11 @@ jobs:
|
|
11
33
|
test:
|
12
34
|
strategy:
|
13
35
|
matrix:
|
14
|
-
os: [ubuntu-
|
36
|
+
os: [ubuntu-24.04, macos-15]
|
15
37
|
ruby: ['2.7', '3.0']
|
16
38
|
runs-on: ${{ matrix.os }}
|
17
39
|
steps:
|
18
|
-
- uses: actions/checkout@
|
40
|
+
- uses: actions/checkout@v4
|
19
41
|
- uses: ruby/setup-ruby@v1
|
20
42
|
with:
|
21
43
|
ruby-version: ${{ matrix.ruby }}
|
@@ -0,0 +1,34 @@
|
|
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.
|
22
|
+
---
|
23
|
+
# yamllint disable rule:line-length
|
24
|
+
name: xcop
|
25
|
+
on:
|
26
|
+
push:
|
27
|
+
pull_request:
|
28
|
+
jobs:
|
29
|
+
xcop:
|
30
|
+
timeout-minutes: 15
|
31
|
+
runs-on: ubuntu-24.04
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v4
|
34
|
+
- uses: g4s8/xcop-action@master
|
@@ -0,0 +1,38 @@
|
|
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.
|
22
|
+
---
|
23
|
+
# yamllint disable rule:line-length
|
24
|
+
name: yamllint
|
25
|
+
'on':
|
26
|
+
push:
|
27
|
+
branches:
|
28
|
+
- master
|
29
|
+
pull_request:
|
30
|
+
branches:
|
31
|
+
- master
|
32
|
+
jobs:
|
33
|
+
yamllint:
|
34
|
+
timeout-minutes: 15
|
35
|
+
runs-on: ubuntu-24.04
|
36
|
+
steps:
|
37
|
+
- uses: actions/checkout@v4
|
38
|
+
- uses: ibiqlik/action-yamllint@v3
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,25 @@
|
|
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.
|
22
|
+
---
|
1
23
|
AllCops:
|
2
24
|
Exclude:
|
3
25
|
- 'bin/**/*'
|
@@ -6,7 +28,6 @@ AllCops:
|
|
6
28
|
TargetRubyVersion: 2.2
|
7
29
|
NewCops: enable
|
8
30
|
SuggestExtensions: false
|
9
|
-
|
10
31
|
Metrics/CyclomaticComplexity:
|
11
32
|
Max: 10
|
12
33
|
Metrics/MethodLength:
|
@@ -21,3 +42,4 @@ Layout/EmptyLineAfterGuardClause:
|
|
21
42
|
Enabled: false
|
22
43
|
Style/ClassAndModuleChildren:
|
23
44
|
Enabled: false
|
45
|
+
require: []
|
data/.rultor.yml
CHANGED
@@ -1,9 +1,32 @@
|
|
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.
|
22
|
+
---
|
1
23
|
assets:
|
2
24
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
3
25
|
install: |
|
4
26
|
pdd -f /dev/null
|
5
27
|
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
6
28
|
release:
|
29
|
+
pre: false
|
7
30
|
script: |-
|
8
31
|
bundle exec rake
|
9
32
|
rm -rf *.gem
|
data/.simplecov
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,3 +20,18 @@
|
|
20
20
|
|
21
21
|
source 'https://rubygems.org'
|
22
22
|
gemspec
|
23
|
+
|
24
|
+
gem 'cucumber', '8.0.0', require: false
|
25
|
+
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
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
<img alt="XCOP logo" src="/logo.svg" width="64px"/>
|
2
2
|
|
3
3
|
[](https://www.elegantobjects.org)
|
4
|
-
[](https://www.0crat.com/p/C3RFVLU72)
|
5
4
|
[](http://www.rultor.com/p/yegor256/xcop)
|
6
5
|
[](https://www.jetbrains.com/ruby/)
|
7
6
|
|
@@ -9,7 +8,6 @@
|
|
9
8
|
[](http://www.0pdd.com/p?name=yegor256/xcop)
|
10
9
|
[](http://badge.fury.io/rb/xcop)
|
11
10
|
[](https://github.com/yegor256/xcop/blob/master/LICENSE.txt)
|
12
|
-
|
13
11
|
[](https://codeclimate.com/github/yegor256/xcop/maintainability)
|
14
12
|
[](https://codecov.io/github/yegor256/xcop?branch=master)
|
15
13
|

|
@@ -62,15 +60,15 @@ $ xcop --fix $(find . -name '*.xml')
|
|
62
60
|
|
63
61
|
You can put command line options into `.xcop` file in the directory
|
64
62
|
where you start `xcop`. Each option should take a single line in the file.
|
65
|
-
They all will be _added_ to the list of options you specify. For example
|
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):
|
66
65
|
|
67
66
|
```
|
68
|
-
--license LICENSE.txt
|
69
67
|
--nocolor
|
70
68
|
--quiet
|
71
|
-
--include
|
72
|
-
--exclude
|
73
|
-
--exclude
|
69
|
+
--include=**/*
|
70
|
+
--exclude=**/*.xsl
|
71
|
+
--exclude=**/*.html
|
74
72
|
```
|
75
73
|
|
76
74
|
You can also create `~/.xcop` file (in your personal home directory), which
|
@@ -84,7 +82,6 @@ This is what you need there:
|
|
84
82
|
require 'xcop/rake_task'
|
85
83
|
desc 'Run XCop on all XML/XSL files in all directories'
|
86
84
|
Xcop::RakeTask.new(:xcop) do |task|
|
87
|
-
task.license = 'LICENSE.txt' # no license by default
|
88
85
|
task.quiet = true # FALSE by default
|
89
86
|
task.includes = ['**/*.xml', '**/*.xsl'] # xml|xsd|xhtml|xsl|html by default
|
90
87
|
task.excludes = ['target/**/*'] # empty by default
|
@@ -115,12 +112,11 @@ jobs:
|
|
115
112
|
- uses: g4s8/xcop-action@master
|
116
113
|
```
|
117
114
|
|
118
|
-
To customize
|
115
|
+
To customize files pattern use `files`:
|
119
116
|
|
120
117
|
```yaml
|
121
118
|
- uses: g4s8/xcop-action@master
|
122
119
|
with:
|
123
|
-
license: MY_LICENSE.txt
|
124
120
|
files: "src/*.xml"
|
125
121
|
```
|
126
122
|
|
@@ -145,8 +141,6 @@ You can integrate it with the help of
|
|
145
141
|
<configuration>
|
146
142
|
<target>
|
147
143
|
<apply executable="xcop" failonerror="true">
|
148
|
-
<arg value="--license"/>
|
149
|
-
<arg value="LICENSE.txt"/>
|
150
144
|
<fileset dir=".">
|
151
145
|
<include name="**/*.xml"/>
|
152
146
|
<include name="**/*.xsd"/>
|
@@ -176,8 +170,6 @@ Something like this should work:
|
|
176
170
|
[...]
|
177
171
|
<target name="xcop">
|
178
172
|
<apply executable="xcop" failonerror="true">
|
179
|
-
<arg value="--license"/>
|
180
|
-
<arg value="LICENSE.txt"/>
|
181
173
|
<fileset dir=".">
|
182
174
|
<include name="**/*.xml"/>
|
183
175
|
<include name="**/*.xsd"/>
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -31,7 +31,7 @@ def version
|
|
31
31
|
Gem::Specification.load(Dir['*.gemspec'].first).version
|
32
32
|
end
|
33
33
|
|
34
|
-
task default: %i[clean test features rubocop
|
34
|
+
task default: %i[clean test features rubocop]
|
35
35
|
|
36
36
|
require 'rake/testtask'
|
37
37
|
desc 'Run all unit tests'
|
@@ -42,13 +42,10 @@ Rake::TestTask.new(:test) do |test|
|
|
42
42
|
test.verbose = false
|
43
43
|
end
|
44
44
|
|
45
|
-
require '
|
46
|
-
desc 'Build
|
47
|
-
Rake::
|
48
|
-
|
49
|
-
rdoc.title = "#{name} #{version}"
|
50
|
-
rdoc.rdoc_files.include('README*')
|
51
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
require 'yard'
|
46
|
+
desc 'Build Yard documentation'
|
47
|
+
YARD::Rake::YardocTask.new do |t|
|
48
|
+
t.files = ['lib/**/*.rb']
|
52
49
|
end
|
53
50
|
|
54
51
|
require 'rubocop/rake_task'
|
@@ -66,11 +63,3 @@ end
|
|
66
63
|
Cucumber::Rake::Task.new(:'features:html') do |t|
|
67
64
|
t.profile = 'html_report'
|
68
65
|
end
|
69
|
-
|
70
|
-
task :copyright do
|
71
|
-
sh "grep -q -r '2017-#{Date.today.strftime('%Y')}' \
|
72
|
-
--include '*.rb' \
|
73
|
-
--include '*.txt' \
|
74
|
-
--include 'Rakefile' \
|
75
|
-
."
|
76
|
-
end
|
data/bin/xcop
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2017-
|
2
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -47,7 +47,7 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
|
|
47
47
|
o.bool '--version', 'Show current version'
|
48
48
|
o.bool '--fix', 'Fix all files instead of reporting their problems'
|
49
49
|
o.bool '--nocolor', 'Suppress colored output'
|
50
|
-
o.string '--license', '
|
50
|
+
o.string '--license', 'This option is deprecated'
|
51
51
|
o.array '--include', 'Glob pattern(s) to include'
|
52
52
|
o.array '--exclude', 'Glob pattern(s) to exclude'
|
53
53
|
end
|
@@ -65,15 +65,6 @@ end
|
|
65
65
|
Encoding.default_external = Encoding::UTF_8
|
66
66
|
Encoding.default_internal = Encoding::UTF_8
|
67
67
|
|
68
|
-
license = ''
|
69
|
-
if opts.license?
|
70
|
-
unless File.exist?(opts[:license])
|
71
|
-
puts "License file is absent: #{opts[:license]}"
|
72
|
-
exit -1
|
73
|
-
end
|
74
|
-
license = File.read(opts[:license])
|
75
|
-
end
|
76
|
-
|
77
68
|
files = Set.new
|
78
69
|
|
79
70
|
if opts[:include]
|
@@ -91,12 +82,12 @@ if opts[:exclude]
|
|
91
82
|
end
|
92
83
|
|
93
84
|
if opts.fix?
|
94
|
-
Xcop::CLI.new(files
|
85
|
+
Xcop::CLI.new(files).fix do |f|
|
95
86
|
puts "#{f} fixed" unless opts.quiet?
|
96
87
|
end
|
97
88
|
else
|
98
89
|
begin
|
99
|
-
Xcop::CLI.new(files,
|
90
|
+
Xcop::CLI.new(files, nocolor: opts.nocolor?).run do |f|
|
100
91
|
puts "#{f} looks good" unless opts.quiet?
|
101
92
|
end
|
102
93
|
rescue StandardError => e
|
data/cucumber.yml
CHANGED
@@ -1,3 +1,25 @@
|
|
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.
|
22
|
+
---
|
1
23
|
default: --format pretty
|
2
24
|
travis: --format progress
|
3
25
|
html_report: --format progress --format html --out=features_report.html
|
data/features/cli.feature
CHANGED
@@ -22,26 +22,6 @@ Feature: Command Line Processing
|
|
22
22
|
Then Stdout contains "test.xml looks good"
|
23
23
|
And Exit code is zero
|
24
24
|
|
25
|
-
Scenario: Validating correct XML file with license
|
26
|
-
Given I have a "licensed.xml" file with content:
|
27
|
-
"""
|
28
|
-
<?xml version="1.0"?>
|
29
|
-
<!--
|
30
|
-
This is the license,
|
31
|
-
which is very very strict!
|
32
|
-
-->
|
33
|
-
<hello>Hello, world!</hello>
|
34
|
-
|
35
|
-
"""
|
36
|
-
And I have a "LICENSE" file with content:
|
37
|
-
"""
|
38
|
-
This is the license,
|
39
|
-
which is very very strict!
|
40
|
-
"""
|
41
|
-
When I run bin/xcop with "--quiet --license LICENSE licensed.xml"
|
42
|
-
Then Stdout is empty
|
43
|
-
And Exit code is zero
|
44
|
-
|
45
25
|
Scenario: Validating incorrect XML file
|
46
26
|
Given I have a "abc.xml" file with content:
|
47
27
|
"""
|
@@ -51,24 +31,6 @@ Feature: Command Line Processing
|
|
51
31
|
When I run bin/xcop with "abc.xml"
|
52
32
|
Then Exit code is not zero
|
53
33
|
|
54
|
-
Scenario: Validating correct XML file with broken license
|
55
|
-
Given I have a "licensed.xml" file with content:
|
56
|
-
"""
|
57
|
-
<?xml version="1.0"?>
|
58
|
-
<!--
|
59
|
-
This is the wrong license!
|
60
|
-
-->
|
61
|
-
<hello>Hello, world!</hello>
|
62
|
-
|
63
|
-
"""
|
64
|
-
And I have a "LICENSE" file with content:
|
65
|
-
"""
|
66
|
-
This is the right license.
|
67
|
-
"""
|
68
|
-
When I run bin/xcop with "--license LICENSE licensed.xml"
|
69
|
-
And Stdout contains "Broken license"
|
70
|
-
And Exit code is not zero
|
71
|
-
|
72
34
|
Scenario: Fixing incorrect XML file
|
73
35
|
Given I have a "broken.xml" file with content:
|
74
36
|
"""
|
@@ -79,4 +41,3 @@ Feature: Command Line Processing
|
|
79
41
|
Then Exit code is zero
|
80
42
|
Then I run bin/xcop with "broken.xml"
|
81
43
|
Then Exit code is zero
|
82
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -26,7 +26,7 @@ require 'English'
|
|
26
26
|
Before do
|
27
27
|
@cwd = Dir.pwd
|
28
28
|
@dir = Dir.mktmpdir('test')
|
29
|
-
FileUtils.mkdir_p(@dir)
|
29
|
+
FileUtils.mkdir_p(@dir)
|
30
30
|
Dir.chdir(@dir)
|
31
31
|
@opts = Slop.parse ['-v', '-s', @dir] do |o|
|
32
32
|
o.bool '-v', '--verbose'
|
@@ -36,12 +36,12 @@ end
|
|
36
36
|
|
37
37
|
After do
|
38
38
|
Dir.chdir(@cwd)
|
39
|
-
FileUtils.rm_rf(@dir)
|
39
|
+
FileUtils.rm_rf(@dir)
|
40
40
|
end
|
41
41
|
|
42
42
|
Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
|
43
43
|
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
|
44
|
-
File.write(file, text.gsub(
|
44
|
+
File.write(file, text.gsub('\\xFF', 0xFF.chr))
|
45
45
|
end
|
46
46
|
|
47
47
|
When(%r{^I run bin/xcop with "([^"]*)"$}) do |arg|
|
data/features/support/env.rb
CHANGED
data/lib/xcop/cli.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -26,12 +26,11 @@ require_relative 'document'
|
|
26
26
|
|
27
27
|
# Command line interface.
|
28
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
-
# Copyright:: Copyright (c) 2017-
|
29
|
+
# Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
|
30
30
|
# License:: MIT
|
31
31
|
class Xcop::CLI
|
32
|
-
def initialize(files,
|
32
|
+
def initialize(files, nocolor: false)
|
33
33
|
@files = files
|
34
|
-
@license = license
|
35
34
|
@nocolor = nocolor
|
36
35
|
end
|
37
36
|
|
@@ -43,13 +42,6 @@ class Xcop::CLI
|
|
43
42
|
puts diff
|
44
43
|
raise "Invalid XML formatting in #{f}"
|
45
44
|
end
|
46
|
-
unless @license.empty?
|
47
|
-
ldiff = doc.ldiff(@license)
|
48
|
-
unless ldiff.empty?
|
49
|
-
puts ldiff
|
50
|
-
raise "Broken license in #{f}"
|
51
|
-
end
|
52
|
-
end
|
53
45
|
yield(f) if block_given?
|
54
46
|
end
|
55
47
|
end
|
@@ -57,7 +49,7 @@ class Xcop::CLI
|
|
57
49
|
# Fix them all.
|
58
50
|
def fix
|
59
51
|
@files.each do |f|
|
60
|
-
Xcop::Document.new(f).fix
|
52
|
+
Xcop::Document.new(f).fix
|
61
53
|
yield(f) if block_given?
|
62
54
|
end
|
63
55
|
end
|
data/lib/xcop/document.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -25,7 +25,7 @@ require_relative 'version'
|
|
25
25
|
|
26
26
|
# One document.
|
27
27
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
-
# Copyright:: Copyright (c) 2017-
|
28
|
+
# Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
|
29
29
|
# License:: MIT
|
30
30
|
class Xcop::Document
|
31
31
|
# Ctor.
|
@@ -42,24 +42,9 @@ class Xcop::Document
|
|
42
42
|
differ(ideal, now, nocolor: nocolor)
|
43
43
|
end
|
44
44
|
|
45
|
-
# Return the difference for the license.
|
46
|
-
def ldiff(license)
|
47
|
-
xml = Nokogiri::XML(File.open(@path), &:noblanks)
|
48
|
-
comment = xml.xpath('/comment()')[0]
|
49
|
-
now = comment.nil? ? '' : comment.text.to_s.strip
|
50
|
-
ideal = license.strip
|
51
|
-
differ(ideal, now)
|
52
|
-
end
|
53
|
-
|
54
45
|
# Fixes the document.
|
55
|
-
def fix
|
46
|
+
def fix
|
56
47
|
xml = Nokogiri::XML(File.open(@path), &:noblanks)
|
57
|
-
unless license.empty?
|
58
|
-
xml.xpath('/comment()').remove
|
59
|
-
xml.children.before(
|
60
|
-
Nokogiri::XML::Comment.new(xml, "\n#{license.strip}\n")
|
61
|
-
)
|
62
|
-
end
|
63
48
|
ideal = xml.to_xml(indent: 2)
|
64
49
|
File.write(@path, ideal)
|
65
50
|
end
|
@@ -77,6 +62,6 @@ class Xcop::Document
|
|
77
62
|
end
|
78
63
|
|
79
64
|
def schars(text)
|
80
|
-
text.gsub(
|
65
|
+
text.gsub("\n", "\\n\n")
|
81
66
|
end
|
82
67
|
end
|
data/lib/xcop/rake_task.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -24,17 +24,16 @@ require_relative '../xcop/cli'
|
|
24
24
|
|
25
25
|
# Xcop rake task.
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
27
|
-
# Copyright:: Copyright (c) 2017-
|
27
|
+
# Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
|
28
28
|
# License:: MIT
|
29
29
|
class Xcop::RakeTask < Rake::TaskLib
|
30
|
-
attr_accessor :name, :fail_on_error, :excludes, :includes, :
|
30
|
+
attr_accessor :name, :fail_on_error, :excludes, :includes, :quiet
|
31
31
|
|
32
32
|
def initialize(*args, &task_block)
|
33
33
|
super()
|
34
34
|
@name = args.shift || :xcop
|
35
35
|
@includes = %w[xml xsd xhtml xsl html].map { |e| "**/*.#{e}" }
|
36
36
|
@excludes = []
|
37
|
-
@license = nil
|
38
37
|
@quiet = false
|
39
38
|
desc 'Run Xcop' unless ::Rake.application.last_description
|
40
39
|
task(name, *args) do |_, task_args|
|
@@ -53,15 +52,17 @@ class Xcop::RakeTask < Rake::TaskLib
|
|
53
52
|
good = Dir.glob(@includes).reject { |f| bad.include?(f) }
|
54
53
|
puts "Inspecting #{pluralize(good.length, 'file')}..." unless @quiet
|
55
54
|
begin
|
56
|
-
Xcop::CLI.new(good
|
55
|
+
Xcop::CLI.new(good).run do
|
57
56
|
print Rainbow('.').green unless @quiet
|
58
57
|
end
|
59
58
|
rescue StandardError => e
|
59
|
+
puts e.message
|
60
60
|
abort(e.message)
|
61
61
|
end
|
62
62
|
return if @quiet
|
63
|
-
puts
|
64
|
-
|
63
|
+
puts \
|
64
|
+
"\n#{pluralize(good.length, 'file')} checked, " \
|
65
|
+
"everything looks #{Rainbow('pretty').green}"
|
65
66
|
end
|
66
67
|
|
67
68
|
def pluralize(num, text)
|
data/lib/xcop/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,8 +20,8 @@
|
|
20
20
|
|
21
21
|
# Xcop main module.
|
22
22
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
23
|
-
# Copyright:: Copyright (c) 2017-
|
23
|
+
# Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
|
24
24
|
# License:: MIT
|
25
25
|
module Xcop
|
26
|
-
VERSION = '0.
|
26
|
+
VERSION = '0.8.0'.freeze
|
27
27
|
end
|
data/logo.svg
CHANGED
data/renovate.json
ADDED
data/test/test__helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,11 +20,10 @@
|
|
20
20
|
|
21
21
|
$stdout.sync = true
|
22
22
|
|
23
|
-
require 'simplecov'
|
24
|
-
SimpleCov.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
23
|
+
require 'simplecov-cobertura'
|
24
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
25
|
+
|
26
|
+
require 'minitest/reporters'
|
27
|
+
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
|
29
28
|
|
30
29
|
require 'minitest/autorun'
|
data/test/test_document.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -26,7 +26,7 @@ require_relative '../lib/xcop/document'
|
|
26
26
|
|
27
27
|
# Test for Document class.
|
28
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
-
# Copyright:: Copyright (c) 2017-
|
29
|
+
# Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
|
30
30
|
# License:: MIT
|
31
31
|
class TestXcop < Minitest::Test
|
32
32
|
def test_basic
|
@@ -47,64 +47,12 @@ class TestXcop < Minitest::Test
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def test_license_presence
|
51
|
-
Dir.mktmpdir 'test2' do |dir|
|
52
|
-
f = File.join(dir, 'a.xml')
|
53
|
-
license = " Copyright (c) All Good People\n Don't touch it!\n\n"
|
54
|
-
File.write(
|
55
|
-
f,
|
56
|
-
[
|
57
|
-
'<?xml version="1.0"?>',
|
58
|
-
'<!--',
|
59
|
-
' Copyright (c) All Good People',
|
60
|
-
' Don\'t touch it!',
|
61
|
-
'-->',
|
62
|
-
'<hello>Dude!</hello>',
|
63
|
-
''
|
64
|
-
].join("\n")
|
65
|
-
)
|
66
|
-
assert_equal(Xcop::Document.new(f).ldiff(license), '')
|
67
|
-
File.delete(f)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_license_absence
|
72
|
-
Dir.mktmpdir 'test3' do |dir|
|
73
|
-
f = File.join(dir, 'a.xml')
|
74
|
-
license = "Copyright (c) All Good People\nTouch me!\n\n"
|
75
|
-
File.write(
|
76
|
-
f,
|
77
|
-
[
|
78
|
-
'<?xml version="1.0"?>',
|
79
|
-
'<hello>My dear friend!</hello>',
|
80
|
-
''
|
81
|
-
].join("\n")
|
82
|
-
)
|
83
|
-
assert(Xcop::Document.new(f).ldiff(license) != '')
|
84
|
-
File.delete(f)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
50
|
def test_fixes_document
|
89
51
|
Dir.mktmpdir 'test3' do |dir|
|
90
52
|
f = File.join(dir, 'bad.xml')
|
91
|
-
license = " Copyright (c) Me, Myself, and I\n Like it?\n\n"
|
92
53
|
File.write(f, '<hello>My friend!</hello>')
|
93
|
-
Xcop::Document.new(f).fix
|
54
|
+
Xcop::Document.new(f).fix
|
94
55
|
assert_equal(Xcop::Document.new(f).diff, '')
|
95
|
-
assert_equal(Xcop::Document.new(f).ldiff(license), '')
|
96
|
-
File.delete(f)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_removes_previous_license
|
101
|
-
Dir.mktmpdir 'test4' do |dir|
|
102
|
-
f = File.join(dir, 'bad.xml')
|
103
|
-
license = "the license to add\n\n\nhey"
|
104
|
-
File.write(f, '<hello>how do you do?</hello>')
|
105
|
-
Xcop::Document.new(f).fix(license)
|
106
|
-
Xcop::Document.new(f).fix(license)
|
107
|
-
assert_equal(Nokogiri::XML(File.read(f)).xpath('/comment()').length, 1)
|
108
56
|
File.delete(f)
|
109
57
|
end
|
110
58
|
end
|
data/test/test_rake_task.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -25,7 +25,7 @@ require_relative '../lib/xcop/rake_task'
|
|
25
25
|
|
26
26
|
# Xcop rake task.
|
27
27
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
-
# Copyright:: Copyright (c) 2017-
|
28
|
+
# Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
|
29
29
|
# License:: MIT
|
30
30
|
class TestRakeTask < Minitest::Test
|
31
31
|
def test_basic
|
@@ -35,7 +35,6 @@ class TestRakeTask < Minitest::Test
|
|
35
35
|
File.write(f, "<?xml version=\"1.0\"?>\n<x/>\n")
|
36
36
|
Xcop::RakeTask.new(:xcop1) do |task|
|
37
37
|
task.quiet = true
|
38
|
-
# task.license = 'LICENSE.txt'
|
39
38
|
end
|
40
39
|
Rake::Task['xcop1'].invoke
|
41
40
|
File.delete(f)
|
data/xcop.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2017-
|
1
|
+
# Copyright (c) 2017-2025 Yegor Bugayenko
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -25,9 +25,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
25
25
|
require_relative 'lib/xcop/version'
|
26
26
|
|
27
27
|
Gem::Specification.new do |s|
|
28
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
29
28
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
30
|
-
s.rubygems_version = '2.2'
|
31
29
|
s.required_ruby_version = '>= 2.2'
|
32
30
|
s.name = 'xcop'
|
33
31
|
s.version = Xcop::VERSION
|
@@ -42,15 +40,8 @@ Gem::Specification.new do |s|
|
|
42
40
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
43
41
|
s.rdoc_options = ['--charset=UTF-8']
|
44
42
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
45
|
-
s.
|
46
|
-
s.
|
47
|
-
s.
|
48
|
-
s.
|
49
|
-
s.add_development_dependency 'codecov', '0.6.0'
|
50
|
-
s.add_development_dependency 'cucumber', '8.0.0'
|
51
|
-
s.add_development_dependency 'minitest', '5.15.0'
|
52
|
-
s.add_development_dependency 'rake', '13.0.6'
|
53
|
-
s.add_development_dependency 'rdoc', '6.4.0'
|
54
|
-
s.add_development_dependency 'rubocop', '1.30.1'
|
55
|
-
s.add_development_dependency 'rubocop-rspec', '2.11.1'
|
43
|
+
s.add_dependency 'differ', '~>0.1.2'
|
44
|
+
s.add_dependency 'nokogiri', '~>1.10'
|
45
|
+
s.add_dependency 'rainbow', '~>3.0'
|
46
|
+
s.add_dependency 'slop', '~>4.4'
|
56
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: differ
|
@@ -66,104 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.4'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: codecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.6.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.6.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: cucumber
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 8.0.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 8.0.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: minitest
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 5.15.0
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 5.15.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rake
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 13.0.6
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 13.0.6
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rdoc
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - '='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 6.4.0
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - '='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 6.4.0
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rubocop
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - '='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 1.30.1
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - '='
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 1.30.1
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop-rspec
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - '='
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 2.11.1
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - '='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 2.11.1
|
167
69
|
description: Validates XML-like documents for proper formatting
|
168
70
|
email: yegor256@gmail.com
|
169
71
|
executables:
|
@@ -175,9 +77,12 @@ extra_rdoc_files:
|
|
175
77
|
files:
|
176
78
|
- ".0pdd.yml"
|
177
79
|
- ".gitattributes"
|
178
|
-
- ".github/
|
179
|
-
- ".github/
|
80
|
+
- ".github/workflows/actionlint.yml"
|
81
|
+
- ".github/workflows/copyrights.yml"
|
82
|
+
- ".github/workflows/pdd.yml"
|
180
83
|
- ".github/workflows/rake.yml"
|
84
|
+
- ".github/workflows/xcop.yml"
|
85
|
+
- ".github/workflows/yamllint.yml"
|
181
86
|
- ".gitignore"
|
182
87
|
- ".pdd"
|
183
88
|
- ".rubocop.yml"
|
@@ -199,6 +104,7 @@ files:
|
|
199
104
|
- lib/xcop/rake_task.rb
|
200
105
|
- lib/xcop/version.rb
|
201
106
|
- logo.svg
|
107
|
+
- renovate.json
|
202
108
|
- test/test__helper.rb
|
203
109
|
- test/test_document.rb
|
204
110
|
- test/test_rake_task.rb
|
@@ -224,8 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
130
|
- !ruby/object:Gem::Version
|
225
131
|
version: '0'
|
226
132
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
133
|
+
rubygems_version: 3.4.10
|
228
134
|
signing_key:
|
229
|
-
specification_version:
|
135
|
+
specification_version: 4
|
230
136
|
summary: XML Formatting Static Validator
|
231
137
|
test_files: []
|
data/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Make sure the title of the issue explains the problem you are having. Also, the description of the issue must clearly explain what is broken, not what you want us to implement. Go through this checklist and make sure you answer "YES" to all points:
|
2
|
-
|
3
|
-
- You have all pre-requisites listed in README.md installed
|
4
|
-
- You are sure that you are not reporting a duplicate (search all issues)
|
5
|
-
- You say "is broken" or "doesn't work" in the title
|
6
|
-
- You tell us what you are trying to do
|
7
|
-
- You explain the results you are getting
|
8
|
-
- You suggest an alternative result you would like to see
|
9
|
-
|
10
|
-
This article will help you understand what we are looking for: http://www.yegor256.com/2014/11/24/principles-of-bug-tracking.html
|
11
|
-
|
12
|
-
Thank you for your contribution!
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Many thanks for your contribution, we truly appreciate it. We will appreciate it even more, if you make sure that you can say "YES" to each point in this short checklist:
|
2
|
-
|
3
|
-
- You made a small amount of changes (less than 100 lines, less than 10 files)
|
4
|
-
- You made changes related to only one bug (create separate PRs for separate problems)
|
5
|
-
- You are ready to defend your changes (there will be a code review)
|
6
|
-
- You don't touch what you don't understand
|
7
|
-
- You ran the build locally and it passed
|
8
|
-
|
9
|
-
This article will help you understand what we are looking for: http://www.yegor256.com/2015/02/09/serious-code-reviewer.html
|
10
|
-
|
11
|
-
Thank you for your contribution!
|