xcop 0.7.2 → 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.
- checksums.yaml +4 -4
- data/Gemfile +14 -32
- data/Gemfile.lock +182 -0
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +35 -40
- data/REUSE.toml +36 -0
- data/Rakefile +4 -22
- data/bin/xcop +6 -32
- data/cucumber.yml +2 -21
- data/features/cli.feature +19 -38
- data/features/gem_package.feature +2 -0
- data/features/rake.feature +2 -0
- data/features/step_definitions/steps.rb +2 -19
- data/features/support/env.rb +2 -19
- data/lib/xcop/cli.rb +14 -31
- data/lib/xcop/document.rb +4 -36
- data/lib/xcop/rake_task.rb +5 -23
- data/lib/xcop/version.rb +4 -21
- data/logo.svg +1 -1
- data/xcop.gemspec +5 -22
- metadata +8 -22
- data/.0pdd.yml +0 -31
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -44
- data/.github/workflows/copyrights.yml +0 -37
- data/.github/workflows/pdd.yml +0 -33
- data/.github/workflows/rake.yml +0 -44
- data/.github/workflows/xcop.yml +0 -33
- data/.github/workflows/yamllint.yml +0 -37
- data/.gitignore +0 -7
- data/.pdd +0 -7
- data/.rubocop.yml +0 -45
- data/.rultor.yml +0 -45
- data/.simplecov +0 -38
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -29
- data/test/test_document.rb +0 -111
- data/test/test_rake_task.rb +0 -59
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
|
|
@@ -22,26 +24,6 @@ Feature: Command Line Processing
|
|
|
22
24
|
Then Stdout contains "test.xml looks good"
|
|
23
25
|
And Exit code is zero
|
|
24
26
|
|
|
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
27
|
Scenario: Validating incorrect XML file
|
|
46
28
|
Given I have a "abc.xml" file with content:
|
|
47
29
|
"""
|
|
@@ -51,24 +33,6 @@ Feature: Command Line Processing
|
|
|
51
33
|
When I run bin/xcop with "abc.xml"
|
|
52
34
|
Then Exit code is not zero
|
|
53
35
|
|
|
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
36
|
Scenario: Fixing incorrect XML file
|
|
73
37
|
Given I have a "broken.xml" file with content:
|
|
74
38
|
"""
|
|
@@ -80,3 +44,20 @@ Feature: Command Line Processing
|
|
|
80
44
|
Then I run bin/xcop with "broken.xml"
|
|
81
45
|
Then Exit code is zero
|
|
82
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
|
data/features/rake.feature
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
20
3
|
|
|
21
4
|
require 'nokogiri'
|
|
22
5
|
require 'tmpdir'
|
data/features/support/env.rb
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
20
3
|
|
|
21
4
|
require 'simplecov'
|
data/lib/xcop/cli.rb
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
20
3
|
|
|
21
4
|
require 'nokogiri'
|
|
22
5
|
require 'differ'
|
|
@@ -26,15 +9,22 @@ require_relative 'document'
|
|
|
26
9
|
|
|
27
10
|
# Command line interface.
|
|
28
11
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
29
|
-
# Copyright:: Copyright (c) 2017-
|
|
12
|
+
# Copyright:: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
30
13
|
# License:: MIT
|
|
31
14
|
class Xcop::CLI
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
# Extensions recognized when a directory is passed as input.
|
|
16
|
+
EXTENSIONS = %w[xml xsd xhtml xsl html].freeze
|
|
17
|
+
|
|
18
|
+
def initialize(files, nocolor: false)
|
|
19
|
+
@files = files.flat_map { |f| File.directory?(f) ? Xcop::CLI.expand(f) : [f] }
|
|
35
20
|
@nocolor = nocolor
|
|
36
21
|
end
|
|
37
22
|
|
|
23
|
+
# Recursively collect XML-like files inside a directory.
|
|
24
|
+
def self.expand(dir)
|
|
25
|
+
EXTENSIONS.flat_map { |ext| Dir.glob(File.join(dir, '**', "*.#{ext}")) }.sort
|
|
26
|
+
end
|
|
27
|
+
|
|
38
28
|
def run
|
|
39
29
|
@files.each do |f|
|
|
40
30
|
doc = Xcop::Document.new(f)
|
|
@@ -43,13 +33,6 @@ class Xcop::CLI
|
|
|
43
33
|
puts diff
|
|
44
34
|
raise "Invalid XML formatting in #{f}"
|
|
45
35
|
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
36
|
yield(f) if block_given?
|
|
54
37
|
end
|
|
55
38
|
end
|
|
@@ -57,7 +40,7 @@ class Xcop::CLI
|
|
|
57
40
|
# Fix them all.
|
|
58
41
|
def fix
|
|
59
42
|
@files.each do |f|
|
|
60
|
-
Xcop::Document.new(f).fix
|
|
43
|
+
Xcop::Document.new(f).fix
|
|
61
44
|
yield(f) if block_given?
|
|
62
45
|
end
|
|
63
46
|
end
|
data/lib/xcop/document.rb
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
20
3
|
|
|
21
4
|
require 'nokogiri'
|
|
22
5
|
require 'differ'
|
|
@@ -25,7 +8,7 @@ require_relative 'version'
|
|
|
25
8
|
|
|
26
9
|
# One document.
|
|
27
10
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
28
|
-
# Copyright:: Copyright (c) 2017-
|
|
11
|
+
# Copyright:: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
29
12
|
# License:: MIT
|
|
30
13
|
class Xcop::Document
|
|
31
14
|
# Ctor.
|
|
@@ -42,24 +25,9 @@ class Xcop::Document
|
|
|
42
25
|
differ(ideal, now, nocolor: nocolor)
|
|
43
26
|
end
|
|
44
27
|
|
|
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
28
|
# Fixes the document.
|
|
55
|
-
def fix
|
|
29
|
+
def fix
|
|
56
30
|
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
31
|
ideal = xml.to_xml(indent: 2)
|
|
64
32
|
File.write(@path, ideal)
|
|
65
33
|
end
|
data/lib/xcop/rake_task.rb
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
20
3
|
|
|
21
4
|
require 'rake'
|
|
22
5
|
require 'rake/tasklib'
|
|
@@ -24,17 +7,16 @@ require_relative '../xcop/cli'
|
|
|
24
7
|
|
|
25
8
|
# Xcop rake task.
|
|
26
9
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
27
|
-
# Copyright:: Copyright (c) 2017-
|
|
10
|
+
# Copyright:: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
28
11
|
# License:: MIT
|
|
29
12
|
class Xcop::RakeTask < Rake::TaskLib
|
|
30
|
-
attr_accessor :name, :fail_on_error, :excludes, :includes, :
|
|
13
|
+
attr_accessor :name, :fail_on_error, :excludes, :includes, :quiet
|
|
31
14
|
|
|
32
15
|
def initialize(*args, &task_block)
|
|
33
16
|
super()
|
|
34
17
|
@name = args.shift || :xcop
|
|
35
18
|
@includes = %w[xml xsd xhtml xsl html].map { |e| "**/*.#{e}" }
|
|
36
19
|
@excludes = []
|
|
37
|
-
@license = nil
|
|
38
20
|
@quiet = false
|
|
39
21
|
desc 'Run Xcop' unless ::Rake.application.last_description
|
|
40
22
|
task(name, *args) do |_, task_args|
|
|
@@ -53,7 +35,7 @@ class Xcop::RakeTask < Rake::TaskLib
|
|
|
53
35
|
good = Dir.glob(@includes).reject { |f| bad.include?(f) }
|
|
54
36
|
puts "Inspecting #{pluralize(good.length, 'file')}..." unless @quiet
|
|
55
37
|
begin
|
|
56
|
-
Xcop::CLI.new(good
|
|
38
|
+
Xcop::CLI.new(good).run do
|
|
57
39
|
print Rainbow('.').green unless @quiet
|
|
58
40
|
end
|
|
59
41
|
rescue StandardError => e
|
data/lib/xcop/version.rb
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
20
3
|
|
|
21
4
|
# Xcop main module.
|
|
22
5
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
23
|
-
# Copyright:: Copyright (c) 2017-
|
|
6
|
+
# Copyright:: Copyright (c) 2017-2026 Yegor Bugayenko
|
|
24
7
|
# License:: MIT
|
|
25
8
|
module Xcop
|
|
26
|
-
VERSION = '0.
|
|
9
|
+
VERSION = '0.9.0'.freeze
|
|
27
10
|
end
|
data/logo.svg
CHANGED
data/xcop.gemspec
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
# Copyright (c) 2017-
|
|
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
|
require 'English'
|
|
22
5
|
|
|
@@ -35,13 +18,13 @@ Gem::Specification.new do |s|
|
|
|
35
18
|
s.description = 'Validates XML-like documents for proper formatting'
|
|
36
19
|
s.authors = ['Yegor Bugayenko']
|
|
37
20
|
s.email = 'yegor256@gmail.com'
|
|
38
|
-
s.homepage = '
|
|
39
|
-
s.files = `git ls-files`.split($RS)
|
|
21
|
+
s.homepage = 'https://github.com/yegor256/xcop'
|
|
22
|
+
s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
|
|
40
23
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
41
24
|
s.rdoc_options = ['--charset=UTF-8']
|
|
42
25
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
|
43
26
|
s.add_dependency 'differ', '~>0.1.2'
|
|
44
|
-
s.add_dependency 'nokogiri', '~>1.
|
|
27
|
+
s.add_dependency 'nokogiri', '~>1.8'
|
|
45
28
|
s.add_dependency 'rainbow', '~>3.0'
|
|
46
29
|
s.add_dependency 'slop', '~>4.4'
|
|
47
30
|
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.9.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: 2026-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: differ
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '1.
|
|
33
|
+
version: '1.8'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1.
|
|
40
|
+
version: '1.8'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rainbow
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -75,22 +75,12 @@ extra_rdoc_files:
|
|
|
75
75
|
- README.md
|
|
76
76
|
- LICENSE.txt
|
|
77
77
|
files:
|
|
78
|
-
- ".0pdd.yml"
|
|
79
|
-
- ".gitattributes"
|
|
80
|
-
- ".github/workflows/actionlint.yml"
|
|
81
|
-
- ".github/workflows/copyrights.yml"
|
|
82
|
-
- ".github/workflows/pdd.yml"
|
|
83
|
-
- ".github/workflows/rake.yml"
|
|
84
|
-
- ".github/workflows/xcop.yml"
|
|
85
|
-
- ".github/workflows/yamllint.yml"
|
|
86
|
-
- ".gitignore"
|
|
87
|
-
- ".pdd"
|
|
88
|
-
- ".rubocop.yml"
|
|
89
|
-
- ".rultor.yml"
|
|
90
|
-
- ".simplecov"
|
|
91
78
|
- Gemfile
|
|
79
|
+
- Gemfile.lock
|
|
92
80
|
- LICENSE.txt
|
|
81
|
+
- LICENSES/MIT.txt
|
|
93
82
|
- README.md
|
|
83
|
+
- REUSE.toml
|
|
94
84
|
- Rakefile
|
|
95
85
|
- bin/xcop
|
|
96
86
|
- cucumber.yml
|
|
@@ -104,12 +94,8 @@ files:
|
|
|
104
94
|
- lib/xcop/rake_task.rb
|
|
105
95
|
- lib/xcop/version.rb
|
|
106
96
|
- logo.svg
|
|
107
|
-
- renovate.json
|
|
108
|
-
- test/test__helper.rb
|
|
109
|
-
- test/test_document.rb
|
|
110
|
-
- test/test_rake_task.rb
|
|
111
97
|
- xcop.gemspec
|
|
112
|
-
homepage:
|
|
98
|
+
homepage: https://github.com/yegor256/xcop
|
|
113
99
|
licenses:
|
|
114
100
|
- MIT
|
|
115
101
|
metadata:
|
data/.0pdd.yml
DELETED
|
@@ -1,31 +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
|
-
errors:
|
|
24
|
-
- yegor256@gmail.com
|
|
25
|
-
# alerts:
|
|
26
|
-
# github:
|
|
27
|
-
# - yegor256
|
|
28
|
-
|
|
29
|
-
tags:
|
|
30
|
-
- pdd
|
|
31
|
-
- bug
|
data/.gitattributes
DELETED
|
@@ -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
|
-
name: actionlint
|
|
24
|
-
'on':
|
|
25
|
-
push:
|
|
26
|
-
branches:
|
|
27
|
-
- master
|
|
28
|
-
pull_request:
|
|
29
|
-
branches:
|
|
30
|
-
- master
|
|
31
|
-
jobs:
|
|
32
|
-
actionlint:
|
|
33
|
-
timeout-minutes: 15
|
|
34
|
-
runs-on: ubuntu-24.04
|
|
35
|
-
steps:
|
|
36
|
-
- uses: actions/checkout@v4
|
|
37
|
-
- name: Download actionlint
|
|
38
|
-
id: get_actionlint
|
|
39
|
-
# yamllint disable-line rule:line-length
|
|
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,37 +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
|
-
name: copyrights
|
|
24
|
-
'on':
|
|
25
|
-
push:
|
|
26
|
-
branches:
|
|
27
|
-
- master
|
|
28
|
-
pull_request:
|
|
29
|
-
branches:
|
|
30
|
-
- master
|
|
31
|
-
jobs:
|
|
32
|
-
copyrights:
|
|
33
|
-
timeout-minutes: 15
|
|
34
|
-
runs-on: ubuntu-24.04
|
|
35
|
-
steps:
|
|
36
|
-
- uses: actions/checkout@v4
|
|
37
|
-
- uses: yegor256/copyrights-action@0.0.8
|
data/.github/workflows/pdd.yml
DELETED
|
@@ -1,33 +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
|
-
name: pdd
|
|
24
|
-
on:
|
|
25
|
-
push:
|
|
26
|
-
pull_request:
|
|
27
|
-
jobs:
|
|
28
|
-
pdd:
|
|
29
|
-
timeout-minutes: 15
|
|
30
|
-
runs-on: ubuntu-24.04
|
|
31
|
-
steps:
|
|
32
|
-
- uses: actions/checkout@v4
|
|
33
|
-
- uses: g4s8/pdd-action@master
|