xcop 0.10.2 → 0.11.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.lock +6 -6
- data/README.md +8 -0
- data/bin/xcop +3 -1
- data/features/cli.feature +18 -0
- data/lib/xcop/document.rb +11 -1
- data/lib/xcop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a0ba2b99c4feae8645eadd69e10c5c0f7c8de8d4340156e0da8a4d6d8786149
|
|
4
|
+
data.tar.gz: bc7fec4a7cdf91bcdf90347b971f02c909cf0ff29b9fe1e2199855b27ab58cc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 817b6d81d029e5206a86ec914be5c1023bae23b1b31a7f6f4c3712e75ee45ca1220f35e10f91f85af3310b51fb00013d79e9846f41f45f2b0b45d1018f755cf3
|
|
7
|
+
data.tar.gz: 0d78d15db07ec2cdb7009e45408721ff3fc66d2bd8ade2ed566689ebc7bedbdf26ea428b0adef6256f1e71d5c74c74d0b301487eac189a68386c21699f9e36b3
|
data/Gemfile.lock
CHANGED
|
@@ -45,7 +45,7 @@ GEM
|
|
|
45
45
|
docile (1.4.1)
|
|
46
46
|
drb (2.2.3)
|
|
47
47
|
ellipsized (0.3.0)
|
|
48
|
-
erb (6.0.
|
|
48
|
+
erb (6.0.6)
|
|
49
49
|
ffi (1.17.4-aarch64-linux-gnu)
|
|
50
50
|
ffi (1.17.4-aarch64-linux-musl)
|
|
51
51
|
ffi (1.17.4-arm-linux-gnu)
|
|
@@ -55,7 +55,7 @@ GEM
|
|
|
55
55
|
ffi (1.17.4-x86_64-darwin)
|
|
56
56
|
ffi (1.17.4-x86_64-linux-gnu)
|
|
57
57
|
ffi (1.17.4-x86_64-linux-musl)
|
|
58
|
-
json (2.
|
|
58
|
+
json (2.21.1)
|
|
59
59
|
language_server-protocol (3.17.0.6)
|
|
60
60
|
lint_roller (1.1.0)
|
|
61
61
|
logger (1.7.0)
|
|
@@ -92,7 +92,7 @@ GEM
|
|
|
92
92
|
nokogiri (1.19.3-x86_64-linux-musl)
|
|
93
93
|
racc (~> 1.4)
|
|
94
94
|
parallel (1.28.0)
|
|
95
|
-
parser (3.3.
|
|
95
|
+
parser (3.3.12.0)
|
|
96
96
|
ast (~> 2.4.1)
|
|
97
97
|
racc
|
|
98
98
|
prism (1.9.0)
|
|
@@ -112,13 +112,13 @@ GEM
|
|
|
112
112
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
113
113
|
ruby-progressbar (~> 1.7)
|
|
114
114
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
115
|
-
rubocop-ast (1.
|
|
115
|
+
rubocop-ast (1.50.0)
|
|
116
116
|
parser (>= 3.3.7.2)
|
|
117
117
|
prism (~> 1.7)
|
|
118
118
|
rubocop-elegant (0.7.1)
|
|
119
119
|
lint_roller (~> 1.1)
|
|
120
120
|
rubocop (~> 1.75)
|
|
121
|
-
rubocop-minitest (0.
|
|
121
|
+
rubocop-minitest (0.40.0)
|
|
122
122
|
lint_roller (~> 1.1)
|
|
123
123
|
rubocop (>= 1.75.0, < 2.0)
|
|
124
124
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
@@ -151,7 +151,7 @@ GEM
|
|
|
151
151
|
unicode-emoji (~> 4.1)
|
|
152
152
|
unicode-emoji (4.2.0)
|
|
153
153
|
win32ole (1.9.3)
|
|
154
|
-
yard (0.9.
|
|
154
|
+
yard (0.9.45)
|
|
155
155
|
|
|
156
156
|
PLATFORMS
|
|
157
157
|
aarch64-linux-gnu
|
data/README.md
CHANGED
|
@@ -55,6 +55,14 @@ xcop .
|
|
|
55
55
|
xcop --fix src/resources
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
When you run `xcop` without any files, directories, or `--include`
|
|
59
|
+
globs, it checks the current directory, exactly as if you called
|
|
60
|
+
`xcop .`:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
xcop
|
|
64
|
+
```
|
|
65
|
+
|
|
58
66
|
## Defaults
|
|
59
67
|
|
|
60
68
|
You can put command line options into a `.xcop` file in the directory
|
data/bin/xcop
CHANGED
|
@@ -56,7 +56,9 @@ if opts[:include]
|
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
targets = opts.arguments
|
|
60
|
+
targets = ['.'] if targets.empty? && Array(opts[:include]).empty?
|
|
61
|
+
files += targets.map { |f| File.expand_path(f) }
|
|
60
62
|
|
|
61
63
|
if opts[:exclude]
|
|
62
64
|
opts[:exclude].each do |glob|
|
data/features/cli.feature
CHANGED
|
@@ -44,6 +44,24 @@ Feature: Command Line Processing
|
|
|
44
44
|
Then I run bin/xcop with "broken.xml"
|
|
45
45
|
Then Exit code is zero
|
|
46
46
|
|
|
47
|
+
Scenario: Validating all files in the current directory by default
|
|
48
|
+
Given I have a "auto.xml" file with content:
|
|
49
|
+
"""
|
|
50
|
+
<?xml version="1.0"?>
|
|
51
|
+
<hello>Hello, world!</hello>
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
And I have a "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 ""
|
|
61
|
+
Then Stdout contains "auto.xml looks good"
|
|
62
|
+
And Stdout contains "deep.xsl looks good"
|
|
63
|
+
And Exit code is zero
|
|
64
|
+
|
|
47
65
|
Scenario: Validating a directory of XML files recursively
|
|
48
66
|
Given I have a "pkg/top.xml" file with content:
|
|
49
67
|
"""
|
data/lib/xcop/document.rb
CHANGED
|
@@ -46,6 +46,8 @@ class Xcop::Document
|
|
|
46
46
|
|
|
47
47
|
XSI_NS = 'http://www.w3.org/2001/XMLSchema-instance'.freeze
|
|
48
48
|
|
|
49
|
+
PREFIX_LISTS = %w[exclude-result-prefixes extension-element-prefixes].freeze
|
|
50
|
+
|
|
49
51
|
private
|
|
50
52
|
|
|
51
53
|
# The canonical, well-formatted version of the document.
|
|
@@ -110,7 +112,13 @@ class Xcop::Document
|
|
|
110
112
|
# prefix only inside +select+, +test+, +match+, +as+, +use+ and
|
|
111
113
|
# similar attributes (e.g. +as="xs:integer"+ or +select="eo:foo()"+),
|
|
112
114
|
# so stripping such a "declared but not QName-used" prefix would break
|
|
113
|
-
# the stylesheet. See #161.
|
|
115
|
+
# the stylesheet. See #161. A prefix is used, too, when it is named in an
|
|
116
|
+
# +exclude-result-prefixes+ or +extension-element-prefixes+ attribute;
|
|
117
|
+
# these list bare prefixes with no colon, so the +prefix:+ scan never
|
|
118
|
+
# catches them, yet XSLT requires every prefix named there to resolve to
|
|
119
|
+
# a declared namespace (dropping the declaration is the static error
|
|
120
|
+
# XTSE0808). The token +#default+ refers to the default namespace. See
|
|
121
|
+
# #165.
|
|
114
122
|
def unused(xml)
|
|
115
123
|
used = Set.new
|
|
116
124
|
declared = Set.new
|
|
@@ -120,6 +128,8 @@ class Xcop::Document
|
|
|
120
128
|
node.attribute_nodes.each do |attr|
|
|
121
129
|
used << attr.namespace.prefix if attr.namespace
|
|
122
130
|
attr.value.scan(/([A-Za-z_][\w.-]*):/) { |m| used << m.first }
|
|
131
|
+
next unless PREFIX_LISTS.include?(attr.name)
|
|
132
|
+
attr.value.split.each { |token| used << (token == '#default' ? nil : token) }
|
|
123
133
|
end
|
|
124
134
|
node.namespace_definitions.each { |ns| declared << ns.prefix }
|
|
125
135
|
end
|
data/lib/xcop/version.rb
CHANGED
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.11.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: 2026-07-
|
|
11
|
+
date: 2026-07-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: differ
|