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.
@@ -1,44 +0,0 @@
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
@@ -1,38 +0,0 @@
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
@@ -1,34 +0,0 @@
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
@@ -1,45 +0,0 @@
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: rake
25
- on:
26
- push:
27
- branches:
28
- - master
29
- pull_request:
30
- branches:
31
- - master
32
- jobs:
33
- test:
34
- strategy:
35
- matrix:
36
- os: [ubuntu-24.04, macos-15]
37
- ruby: ['2.7', '3.0']
38
- runs-on: ${{ matrix.os }}
39
- steps:
40
- - uses: actions/checkout@v4
41
- - uses: ruby/setup-ruby@v1
42
- with:
43
- ruby-version: ${{ matrix.ruby }}
44
- - run: bundle update
45
- - run: bundle exec rake
@@ -1,34 +0,0 @@
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
@@ -1,38 +0,0 @@
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/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- coverage/
2
- Gemfile.lock
3
- .idea/
4
- *.gem
5
- .bundle/
6
- .DS_Store
7
- rdoc/
data/.pdd DELETED
@@ -1,7 +0,0 @@
1
- --source=.
2
- --verbose
3
- --exclude target/**/*
4
- --exclude coverage/**/*
5
- --rule min-words:20
6
- --rule min-estimate:15
7
- --rule max-estimate:90
data/.rubocop.yml DELETED
@@ -1,45 +0,0 @@
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
- AllCops:
24
- Exclude:
25
- - 'bin/**/*'
26
- - 'assets/**/*'
27
- DisplayCopNames: true
28
- TargetRubyVersion: 2.2
29
- NewCops: enable
30
- SuggestExtensions: false
31
- Metrics/CyclomaticComplexity:
32
- Max: 10
33
- Metrics/MethodLength:
34
- Enabled: false
35
- Layout/MultilineMethodCallIndentation:
36
- Enabled: false
37
- Metrics/AbcSize:
38
- Enabled: false
39
- Metrics/BlockLength:
40
- Max: 50
41
- Layout/EmptyLineAfterGuardClause:
42
- Enabled: false
43
- Style/ClassAndModuleChildren:
44
- Enabled: false
45
- require: []
data/.rultor.yml DELETED
@@ -1,45 +0,0 @@
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
- assets:
24
- rubygems.yml: yegor256/home#assets/rubygems.yml
25
- install: |
26
- pdd -f /dev/null
27
- sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
28
- release:
29
- pre: false
30
- script: |-
31
- bundle exec rake
32
- rm -rf *.gem
33
- sed -i "s/0\.0\.0/${tag}/g" lib/xcop/version.rb
34
- git add lib/xcop/version.rb
35
- git commit -m "version set to ${tag}"
36
- gem build xcop.gemspec
37
- chmod 0600 ../rubygems.yml
38
- gem push *.gem --config-file ../rubygems.yml
39
- merge:
40
- script: |-
41
- bundle exec rake
42
- deploy:
43
- script: |-
44
- echo "There is nothing to deploy"
45
- exit -1
data/.simplecov DELETED
@@ -1,38 +0,0 @@
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 NONINFINGEMENT. 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.
20
-
21
- if Gem.win_platform?
22
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
23
- SimpleCov::Formatter::HTMLFormatter
24
- ]
25
- SimpleCov.start do
26
- add_filter '/test/'
27
- add_filter '/features/'
28
- end
29
- else
30
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
31
- [SimpleCov::Formatter::HTMLFormatter]
32
- )
33
- SimpleCov.start do
34
- add_filter '/test/'
35
- add_filter '/features/'
36
- minimum_coverage 80
37
- end
38
- end
data/renovate.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base"
5
- ]
6
- }
data/test/test__helper.rb DELETED
@@ -1,29 +0,0 @@
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 NONINFINGEMENT. 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.
20
-
21
- $stdout.sync = true
22
-
23
- require 'simplecov-cobertura'
24
- SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
25
-
26
- require 'minitest/reporters'
27
- Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
28
-
29
- require 'minitest/autorun'
@@ -1,59 +0,0 @@
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 NONINFINGEMENT. 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.
20
-
21
- require 'minitest/autorun'
22
- require 'nokogiri'
23
- require 'tmpdir'
24
- require 'slop'
25
- require_relative '../lib/xcop/document'
26
-
27
- # Test for Document class.
28
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
30
- # License:: MIT
31
- class TestXcop < Minitest::Test
32
- def test_basic
33
- Dir.mktmpdir 'test1' do |dir|
34
- f = File.join(dir, 'a.xml')
35
- File.write(f, "<?xml version=\"1.0\"?>\n<hello>Dude!</hello>\n")
36
- assert_equal(Xcop::Document.new(f).diff, '')
37
- File.delete(f)
38
- end
39
- end
40
-
41
- def test_file_without_tail_eol
42
- Dir.mktmpdir 'test9' do |dir|
43
- f = File.join(dir, 'no-eol.xml')
44
- File.write(f, "<?xml version=\"1.0\"?>\n<x/>")
45
- assert(Xcop::Document.new(f).diff != '')
46
- File.delete(f)
47
- end
48
- end
49
-
50
- def test_fixes_document
51
- Dir.mktmpdir 'test3' do |dir|
52
- f = File.join(dir, 'bad.xml')
53
- File.write(f, '<hello>My friend!</hello>')
54
- Xcop::Document.new(f).fix
55
- assert_equal(Xcop::Document.new(f).diff, '')
56
- File.delete(f)
57
- end
58
- end
59
- end
@@ -1,58 +0,0 @@
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 NONINFINGEMENT. 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.
20
-
21
- require 'minitest/autorun'
22
- require 'tmpdir'
23
- require 'rake'
24
- require_relative '../lib/xcop/rake_task'
25
-
26
- # Xcop rake task.
27
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2017-2025 Yegor Bugayenko
29
- # License:: MIT
30
- class TestRakeTask < Minitest::Test
31
- def test_basic
32
- Dir.mktmpdir 'test' do |dir|
33
- Dir.chdir(dir)
34
- f = File.join(dir, 'a.xml')
35
- File.write(f, "<?xml version=\"1.0\"?>\n<x/>\n")
36
- Xcop::RakeTask.new(:xcop1) do |task|
37
- task.quiet = true
38
- end
39
- Rake::Task['xcop1'].invoke
40
- File.delete(f)
41
- end
42
- end
43
-
44
- def test_with_broken_xml
45
- Dir.mktmpdir 'test' do |dir|
46
- Dir.chdir(dir)
47
- f = File.join(dir, 'broken.xml')
48
- File.write(f, "<z><a><b></b></a>\n\n</z>")
49
- Xcop::RakeTask.new(:xcop2) do |task|
50
- task.excludes = ['test/**/*']
51
- end
52
- assert_raises SystemExit do
53
- Rake::Task['xcop2'].invoke
54
- end
55
- File.delete(f)
56
- end
57
- end
58
- end