xcop 0.8.0 → 0.9.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.
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