csvlint 1.1.0 → 1.3.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/.github/workflows/push.yml +4 -4
- data/.pre-commit-hooks.yaml +5 -0
- data/.ruby-version +1 -1
- data/.standard_todo.yml +4 -0
- data/CHANGELOG.md +84 -32
- data/README.md +22 -1
- data/csvlint.gemspec +3 -2
- data/lib/csvlint/csvw/column.rb +20 -20
- data/lib/csvlint/csvw/property_checker.rb +38 -38
- data/lib/csvlint/field.rb +1 -1
- data/lib/csvlint/validate.rb +5 -5
- data/lib/csvlint/version.rb +1 -1
- metadata +22 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 193f51b0a401784dbd7b5ee452dd7fffd7d7f6ced9ce9b26adce88a3f6f3f9a8
|
|
4
|
+
data.tar.gz: a2035c66cd7dae7f02716fee65ba08ff061e18afbda28c580f43c7a0722e2745
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c33ab4a38325228df9e4e8d6f05ca7a264d4b15ddbe9ebe924062a0697695862d870170863f972699ee382c1577a759dc8fdebe64f449f43d8ca5b243dab853e
|
|
7
|
+
data.tar.gz: 0dd17429279ab82528edaabe469295df051c54a752dc2d30b17956a394a169459fb9c6808d9003c4cb1830e51e4e469f479272356862e28bbcfd86d94ebd7e71
|
data/.github/workflows/push.yml
CHANGED
|
@@ -9,10 +9,10 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
|
|
12
|
+
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
|
|
13
13
|
fail-fast: false
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
16
|
- uses: ruby/setup-ruby@v1
|
|
17
17
|
with:
|
|
18
18
|
bundler-cache: true
|
|
@@ -24,11 +24,11 @@ jobs:
|
|
|
24
24
|
lint:
|
|
25
25
|
runs-on: ubuntu-latest
|
|
26
26
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
28
|
- uses: ruby/setup-ruby@v1
|
|
29
29
|
with:
|
|
30
30
|
bundler-cache: true
|
|
31
|
-
ruby-version: "3.
|
|
31
|
+
ruby-version: "3.3"
|
|
32
32
|
- name: Install dependencies
|
|
33
33
|
run: bundle install
|
|
34
34
|
- name: Run the tests
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.3.0
|
data/.standard_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,82 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [v1.2.0](https://github.com/data-liberation-front/csvlint.rb/tree/v1.2.0) (2023-02-27)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/data-liberation-front/csvlint.rb/compare/v1.1.0...v1.2.0)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- Pre-commit integration [\#275](https://github.com/Data-Liberation-Front/csvlint.rb/issues/275)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Pre commit hook [\#276](https://github.com/Data-Liberation-Front/csvlint.rb/pull/276) ([jrottenberg](https://github.com/jrottenberg))
|
|
14
|
+
|
|
15
|
+
## [v1.1.0](https://github.com/data-liberation-front/csvlint.rb/tree/v1.1.0) (2022-12-28)
|
|
16
|
+
|
|
17
|
+
[Full Changelog](https://github.com/data-liberation-front/csvlint.rb/compare/v1.0.0...v1.1.0)
|
|
18
|
+
|
|
19
|
+
**Closed issues:**
|
|
20
|
+
|
|
21
|
+
- Requires ruby \< 3.2 [\#272](https://github.com/Data-Liberation-Front/csvlint.rb/issues/272)
|
|
22
|
+
- Release a new version [\#244](https://github.com/Data-Liberation-Front/csvlint.rb/issues/244)
|
|
23
|
+
|
|
24
|
+
**Merged pull requests:**
|
|
25
|
+
|
|
26
|
+
- bump version to 1.1.0 [\#274](https://github.com/Data-Liberation-Front/csvlint.rb/pull/274) ([Floppy](https://github.com/Floppy))
|
|
27
|
+
- Add support for Ruby 3.2 [\#273](https://github.com/Data-Liberation-Front/csvlint.rb/pull/273) ([Floppy](https://github.com/Floppy))
|
|
28
|
+
- fix lint error [\#271](https://github.com/Data-Liberation-Front/csvlint.rb/pull/271) ([youpy](https://github.com/youpy))
|
|
29
|
+
- optimize validation with regular expression [\#270](https://github.com/Data-Liberation-Front/csvlint.rb/pull/270) ([youpy](https://github.com/youpy))
|
|
30
|
+
- Bump actions/checkout from 2 to 3 [\#269](https://github.com/Data-Liberation-Front/csvlint.rb/pull/269) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
31
|
+
- Add GitHub Actions to Dependabot [\#267](https://github.com/Data-Liberation-Front/csvlint.rb/pull/267) ([petergoldstein](https://github.com/petergoldstein))
|
|
32
|
+
- Lint with standardrb [\#266](https://github.com/Data-Liberation-Front/csvlint.rb/pull/266) ([Floppy](https://github.com/Floppy))
|
|
33
|
+
- Add Dockerfile and notes for usage on MS Windows. [\#243](https://github.com/Data-Liberation-Front/csvlint.rb/pull/243) ([jespertp-systematic](https://github.com/jespertp-systematic))
|
|
34
|
+
|
|
3
35
|
## [v1.0.0](https://github.com/Data-Liberation-Front/csvlint.rb/tree/v1.0.0) (2022-07-13)
|
|
36
|
+
|
|
4
37
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.4.0...v1.0.0)
|
|
5
38
|
|
|
6
39
|
Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major version bump. That and this has been around long enough that it really shouldn't be on a zero version any more :)
|
|
7
40
|
|
|
8
41
|
## What's Changed
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
|
|
43
|
+
- Don't patch CSV#init_converters for ruby 2.5 compatibility by @rbmrclo in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/217>
|
|
44
|
+
|
|
45
|
+
- correct typos in README by @erikj in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/216>
|
|
46
|
+
- add info about your PATH by @ftrotter in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/222>
|
|
47
|
+
- Remove tests on deprecated ruby versions < 2.3 by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/234>
|
|
48
|
+
- Drop mime-types gem dependency by @ohbarye in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/221>
|
|
49
|
+
- remove specific version of net-http-persistent in gemspec by @kotaro0522 in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/219>
|
|
50
|
+
- Replace colorize with rainbow to make licensing consistent. by @cobbr2 in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/215>
|
|
51
|
+
- Update rdf requirement from < 2.0 to < 4.0 by @dependabot-preview in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/231>
|
|
52
|
+
- Test on Ruby 2.5 and 2.6 by @Domon in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/223>
|
|
53
|
+
- Fix load_from_json deprecation warnings. by @jezhiggins in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/237>
|
|
54
|
+
- Fix csvw tests by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/239>
|
|
55
|
+
- Test on Ruby 2.6 and 2.7 by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/240>
|
|
56
|
+
- Create Dependabot config file by @dependabot-preview in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/245>
|
|
57
|
+
- Include active_support/object to ensure this works in ruby 2.6 by @mseverini in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/246>
|
|
58
|
+
- add CI workflow for github actions by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/255>
|
|
59
|
+
- Enable and fix tests for Ruby 2.5 by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/259>
|
|
60
|
+
- Support Ruby 2.6 by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/262>
|
|
61
|
+
- Ruby 2.7 support by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/263>
|
|
62
|
+
- Drop support for Ruby 2.4 by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/265>
|
|
63
|
+
- Ruby 3.0 by @Floppy in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/264>
|
|
29
64
|
|
|
30
65
|
## New Contributors
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
66
|
+
|
|
67
|
+
- @rbmrclo made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/217>
|
|
68
|
+
|
|
69
|
+
- @erikj made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/216>
|
|
70
|
+
- @ftrotter made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/222>
|
|
71
|
+
- @ohbarye made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/221>
|
|
72
|
+
- @kotaro0522 made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/219>
|
|
73
|
+
- @cobbr2 made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/215>
|
|
74
|
+
- @dependabot-preview made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/231>
|
|
75
|
+
- @Domon made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/223>
|
|
76
|
+
- @mseverini made their first contribution in <https://github.com/Data-Liberation-Front/csvlint.rb/pull/246>
|
|
40
77
|
|
|
41
78
|
## [0.4.0](https://github.com/theodi/csvlint.rb/tree/0.4.0) (2017-xx-xx)
|
|
79
|
+
|
|
42
80
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.3.3...0.4.0)
|
|
43
81
|
|
|
44
82
|
- Support for Ruby 2.4
|
|
@@ -50,9 +88,10 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
50
88
|
|
|
51
89
|
**Closed issues:**
|
|
52
90
|
|
|
53
|
-
-
|
|
91
|
+
- CLI doesn't handle filenames with spaces [\#182](https://github.com/theodi/csvlint.rb/issues/182)
|
|
54
92
|
|
|
55
93
|
## [0.3.3](https://github.com/theodi/csvlint.rb/tree/0.3.3) (2016-11-10)
|
|
94
|
+
|
|
56
95
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.3.2...0.3.3)
|
|
57
96
|
|
|
58
97
|
**Closed issues:**
|
|
@@ -67,6 +106,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
67
106
|
- force UTF-8 if encoding is ASCII-8BIT [\#180](https://github.com/theodi/csvlint.rb/pull/180) ([JeniT](https://github.com/JeniT))
|
|
68
107
|
|
|
69
108
|
## [0.3.2](https://github.com/theodi/csvlint.rb/tree/0.3.2) (2016-05-24)
|
|
109
|
+
|
|
70
110
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.3.1...0.3.2)
|
|
71
111
|
|
|
72
112
|
**Merged pull requests:**
|
|
@@ -74,6 +114,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
74
114
|
- Add schema errors to cli json [\#184](https://github.com/theodi/csvlint.rb/pull/184) ([pezholio](https://github.com/pezholio))
|
|
75
115
|
|
|
76
116
|
## [0.3.1](https://github.com/theodi/csvlint.rb/tree/0.3.1) (2016-05-23)
|
|
117
|
+
|
|
77
118
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.3.0...0.3.1)
|
|
78
119
|
|
|
79
120
|
**Closed issues:**
|
|
@@ -85,6 +126,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
85
126
|
- Add CLI option to output JSON [\#183](https://github.com/theodi/csvlint.rb/pull/183) ([pezholio](https://github.com/pezholio))
|
|
86
127
|
|
|
87
128
|
## [0.3.0](https://github.com/theodi/csvlint.rb/tree/0.3.0) (2016-01-12)
|
|
129
|
+
|
|
88
130
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.6...0.3.0)
|
|
89
131
|
|
|
90
132
|
**Merged pull requests:**
|
|
@@ -93,9 +135,11 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
93
135
|
- Support for CSV on the Web transformations [\#173](https://github.com/theodi/csvlint.rb/pull/173) ([JeniT](https://github.com/JeniT))
|
|
94
136
|
|
|
95
137
|
## [0.2.6](https://github.com/theodi/csvlint.rb/tree/0.2.6) (2015-11-16)
|
|
138
|
+
|
|
96
139
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.5...0.2.6)
|
|
97
140
|
|
|
98
141
|
## [0.2.5](https://github.com/theodi/csvlint.rb/tree/0.2.5) (2015-11-16)
|
|
142
|
+
|
|
99
143
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.4...0.2.5)
|
|
100
144
|
|
|
101
145
|
**Merged pull requests:**
|
|
@@ -103,6 +147,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
103
147
|
- Use STDIN instead of ARGF [\#169](https://github.com/theodi/csvlint.rb/pull/169) ([pezholio](https://github.com/pezholio))
|
|
104
148
|
|
|
105
149
|
## [0.2.4](https://github.com/theodi/csvlint.rb/tree/0.2.4) (2015-10-20)
|
|
150
|
+
|
|
106
151
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.3...0.2.4)
|
|
107
152
|
|
|
108
153
|
**Merged pull requests:**
|
|
@@ -110,6 +155,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
110
155
|
- Fixes for CLI [\#164](https://github.com/theodi/csvlint.rb/pull/164) ([pezholio](https://github.com/pezholio))
|
|
111
156
|
|
|
112
157
|
## [0.2.3](https://github.com/theodi/csvlint.rb/tree/0.2.3) (2015-10-20)
|
|
158
|
+
|
|
113
159
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.2...0.2.3)
|
|
114
160
|
|
|
115
161
|
**Closed issues:**
|
|
@@ -123,6 +169,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
123
169
|
- Update schema file example to clarify type [\#162](https://github.com/theodi/csvlint.rb/pull/162) ([wachunga](https://github.com/wachunga))
|
|
124
170
|
|
|
125
171
|
## [0.2.2](https://github.com/theodi/csvlint.rb/tree/0.2.2) (2015-10-09)
|
|
172
|
+
|
|
126
173
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.1...0.2.2)
|
|
127
174
|
|
|
128
175
|
**Closed issues:**
|
|
@@ -138,6 +185,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
138
185
|
- Don't pass leading string to parse\_line [\#155](https://github.com/theodi/csvlint.rb/pull/155) ([pezholio](https://github.com/pezholio))
|
|
139
186
|
|
|
140
187
|
## [0.2.1](https://github.com/theodi/csvlint.rb/tree/0.2.1) (2015-10-07)
|
|
188
|
+
|
|
141
189
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.2.0...0.2.1)
|
|
142
190
|
|
|
143
191
|
**Implemented enhancements:**
|
|
@@ -154,6 +202,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
154
202
|
- Streaming validation [\#146](https://github.com/theodi/csvlint.rb/pull/146) ([pezholio](https://github.com/pezholio))
|
|
155
203
|
|
|
156
204
|
## [0.2.0](https://github.com/theodi/csvlint.rb/tree/0.2.0) (2015-10-05)
|
|
205
|
+
|
|
157
206
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.4...0.2.0)
|
|
158
207
|
|
|
159
208
|
**Closed issues:**
|
|
@@ -168,6 +217,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
168
217
|
- CSVW-based validation! [\#142](https://github.com/theodi/csvlint.rb/pull/142) ([JeniT](https://github.com/JeniT))
|
|
169
218
|
|
|
170
219
|
## [0.1.4](https://github.com/theodi/csvlint.rb/tree/0.1.4) (2015-08-06)
|
|
220
|
+
|
|
171
221
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.3...0.1.4)
|
|
172
222
|
|
|
173
223
|
**Merged pull requests:**
|
|
@@ -175,6 +225,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
175
225
|
- change made to the constraint parameter in order that it is more cons… [\#140](https://github.com/theodi/csvlint.rb/pull/140) ([quadrophobiac](https://github.com/quadrophobiac))
|
|
176
226
|
|
|
177
227
|
## [0.1.3](https://github.com/theodi/csvlint.rb/tree/0.1.3) (2015-07-24)
|
|
228
|
+
|
|
178
229
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.2...0.1.3)
|
|
179
230
|
|
|
180
231
|
**Merged pull requests:**
|
|
@@ -184,6 +235,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
184
235
|
- Invalid schema [\#132](https://github.com/theodi/csvlint.rb/pull/132) ([bcouston](https://github.com/bcouston))
|
|
185
236
|
|
|
186
237
|
## [0.1.2](https://github.com/theodi/csvlint.rb/tree/0.1.2) (2015-07-15)
|
|
238
|
+
|
|
187
239
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.1...0.1.2)
|
|
188
240
|
|
|
189
241
|
**Closed issues:**
|
|
@@ -196,6 +248,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
196
248
|
- Emit a warning when the CSV header does not match the supplied schema [\#127](https://github.com/theodi/csvlint.rb/pull/127) ([adamc00](https://github.com/adamc00))
|
|
197
249
|
|
|
198
250
|
## [0.1.1](https://github.com/theodi/csvlint.rb/tree/0.1.1) (2015-07-13)
|
|
251
|
+
|
|
199
252
|
[Full Changelog](https://github.com/theodi/csvlint.rb/compare/0.1.0...0.1.1)
|
|
200
253
|
|
|
201
254
|
**Closed issues:**
|
|
@@ -221,6 +274,7 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
221
274
|
- Limit lines [\#101](https://github.com/theodi/csvlint.rb/pull/101) ([Hoedic](https://github.com/Hoedic))
|
|
222
275
|
|
|
223
276
|
## [0.1.0](https://github.com/theodi/csvlint.rb/tree/0.1.0) (2014-11-27)
|
|
277
|
+
|
|
224
278
|
**Implemented enhancements:**
|
|
225
279
|
|
|
226
280
|
- Blank values shouldn't count as inconsistencies [\#90](https://github.com/theodi/csvlint.rb/issues/90)
|
|
@@ -325,6 +379,4 @@ Support Ruby 3.x, and DROPPED support for Ruby 2.4 - that's why the major versio
|
|
|
325
379
|
- Detect bad content type [\#3](https://github.com/theodi/csvlint.rb/pull/3) ([pezholio](https://github.com/pezholio))
|
|
326
380
|
- Return information about CSV [\#1](https://github.com/theodi/csvlint.rb/pull/1) ([pezholio](https://github.com/pezholio))
|
|
327
381
|
|
|
328
|
-
|
|
329
|
-
|
|
330
382
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ A ruby gem to support validating CSV files to check their syntax and contents. Y
|
|
|
17
17
|
|
|
18
18
|
## Development
|
|
19
19
|
|
|
20
|
-
`ruby version 3.
|
|
20
|
+
`ruby version 3.3`
|
|
21
21
|
|
|
22
22
|
### Tests
|
|
23
23
|
|
|
@@ -87,6 +87,27 @@ You can also optionally pass a schema file like so:
|
|
|
87
87
|
|
|
88
88
|
csvlint myfile.csv --schema=schema.json
|
|
89
89
|
|
|
90
|
+
## Via pre-commit
|
|
91
|
+
|
|
92
|
+
Add to your .pre-commit-config.yaml file :
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
repos: # `pre-commit autoupdate` to get latest available tags
|
|
96
|
+
|
|
97
|
+
- repo: https://github.com/Data-Liberation-Front/csvlint.rb
|
|
98
|
+
rev: v1.2.0
|
|
99
|
+
hooks:
|
|
100
|
+
- id: csvlint
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`pre-commit install` to enable it on your repository.
|
|
104
|
+
|
|
105
|
+
To force a manual run of [pre-commit](https://pre-commit.com/) use the command :
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
pre-commit run -a
|
|
109
|
+
```
|
|
110
|
+
|
|
90
111
|
## In your own Ruby code
|
|
91
112
|
|
|
92
113
|
Currently the gem supports retrieving a CSV accessible from a URL, File, or an IO-style object (e.g. StringIO)
|
data/csvlint.gemspec
CHANGED
|
@@ -16,11 +16,12 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
17
17
|
spec.require_paths = ["lib"]
|
|
18
18
|
|
|
19
|
-
spec.required_ruby_version = [">= 2.5", "< 3.
|
|
19
|
+
spec.required_ruby_version = [">= 2.5", "< 3.4"]
|
|
20
20
|
|
|
21
|
+
spec.add_dependency "csv"
|
|
21
22
|
spec.add_dependency "rainbow"
|
|
22
23
|
spec.add_dependency "open_uri_redirections"
|
|
23
|
-
spec.add_dependency "activesupport"
|
|
24
|
+
spec.add_dependency "activesupport", "< 7.1.0"
|
|
24
25
|
spec.add_dependency "addressable"
|
|
25
26
|
spec.add_dependency "typhoeus"
|
|
26
27
|
spec.add_dependency "escape_utils"
|
data/lib/csvlint/csvw/column.rb
CHANGED
|
@@ -126,14 +126,14 @@ module Csvlint
|
|
|
126
126
|
format = Csvlint::Csvw::DateFormat.new(nil, type) if format.nil?
|
|
127
127
|
v = format.parse(value)
|
|
128
128
|
return nil, warning if v.nil?
|
|
129
|
-
|
|
129
|
+
[v, nil]
|
|
130
130
|
}
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def create_regexp_based_parser(regexp, warning)
|
|
134
134
|
lambda { |value, format|
|
|
135
135
|
return nil, warning unless value&.match?(regexp)
|
|
136
|
-
|
|
136
|
+
[value, nil]
|
|
137
137
|
}
|
|
138
138
|
end
|
|
139
139
|
|
|
@@ -256,14 +256,14 @@ module Csvlint
|
|
|
256
256
|
"http://www.w3.org/2001/XMLSchema#time" => NO_ADDITIONAL_VALIDATION
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
TRIM_VALUE = lambda { |value, format|
|
|
260
|
-
ALL_VALUES_VALID = lambda { |value, format|
|
|
259
|
+
TRIM_VALUE = lambda { |value, format| [value.strip, nil] }
|
|
260
|
+
ALL_VALUES_VALID = lambda { |value, format| [value, nil] }
|
|
261
261
|
|
|
262
262
|
NUMERIC_PARSER = lambda { |value, format, integer = false|
|
|
263
263
|
format = Csvlint::Csvw::NumberFormat.new(nil, nil, ".", integer) if format.nil?
|
|
264
264
|
v = format.parse(value)
|
|
265
265
|
return nil, :invalid_number if v.nil?
|
|
266
|
-
|
|
266
|
+
[v, nil]
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
DATATYPE_PARSER = {
|
|
@@ -281,7 +281,7 @@ module Csvlint
|
|
|
281
281
|
return true, nil if value == format[0]
|
|
282
282
|
return false, nil if value == format[1]
|
|
283
283
|
end
|
|
284
|
-
|
|
284
|
+
[value, :invalid_boolean]
|
|
285
285
|
},
|
|
286
286
|
"http://www.w3.org/2001/XMLSchema#date" =>
|
|
287
287
|
create_date_parser("http://www.w3.org/2001/XMLSchema#date", :invalid_date),
|
|
@@ -291,85 +291,85 @@ module Csvlint
|
|
|
291
291
|
create_date_parser("http://www.w3.org/2001/XMLSchema#dateTimeStamp", :invalid_date_time_stamp),
|
|
292
292
|
"http://www.w3.org/2001/XMLSchema#decimal" => lambda { |value, format|
|
|
293
293
|
return nil, :invalid_decimal if /(E|e|^(NaN|INF|-INF)$)/.match?(value)
|
|
294
|
-
|
|
294
|
+
NUMERIC_PARSER.call(value, format)
|
|
295
295
|
},
|
|
296
296
|
"http://www.w3.org/2001/XMLSchema#integer" => lambda { |value, format|
|
|
297
297
|
v, w = NUMERIC_PARSER.call(value, format, true)
|
|
298
298
|
return v, :invalid_integer unless w.nil?
|
|
299
299
|
return nil, :invalid_integer unless v.is_a? Integer
|
|
300
|
-
|
|
300
|
+
[v, w]
|
|
301
301
|
},
|
|
302
302
|
"http://www.w3.org/2001/XMLSchema#long" => lambda { |value, format|
|
|
303
303
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
304
304
|
return v, :invalid_long unless w.nil?
|
|
305
305
|
return nil, :invalid_long unless v <= 9223372036854775807 && v >= -9223372036854775808
|
|
306
|
-
|
|
306
|
+
[v, w]
|
|
307
307
|
},
|
|
308
308
|
"http://www.w3.org/2001/XMLSchema#int" => lambda { |value, format|
|
|
309
309
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
310
310
|
return v, :invalid_int unless w.nil?
|
|
311
311
|
return nil, :invalid_int unless v <= 2147483647 && v >= -2147483648
|
|
312
|
-
|
|
312
|
+
[v, w]
|
|
313
313
|
},
|
|
314
314
|
"http://www.w3.org/2001/XMLSchema#short" => lambda { |value, format|
|
|
315
315
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
316
316
|
return v, :invalid_short unless w.nil?
|
|
317
317
|
return nil, :invalid_short unless v <= 32767 && v >= -32768
|
|
318
|
-
|
|
318
|
+
[v, w]
|
|
319
319
|
},
|
|
320
320
|
"http://www.w3.org/2001/XMLSchema#byte" => lambda { |value, format|
|
|
321
321
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
322
322
|
return v, :invalid_byte unless w.nil?
|
|
323
323
|
return nil, :invalid_byte unless v <= 127 && v >= -128
|
|
324
|
-
|
|
324
|
+
[v, w]
|
|
325
325
|
},
|
|
326
326
|
"http://www.w3.org/2001/XMLSchema#nonNegativeInteger" => lambda { |value, format|
|
|
327
327
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
328
328
|
return v, :invalid_nonNegativeInteger unless w.nil?
|
|
329
329
|
return nil, :invalid_nonNegativeInteger unless v >= 0
|
|
330
|
-
|
|
330
|
+
[v, w]
|
|
331
331
|
},
|
|
332
332
|
"http://www.w3.org/2001/XMLSchema#positiveInteger" => lambda { |value, format|
|
|
333
333
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
334
334
|
return v, :invalid_positiveInteger unless w.nil?
|
|
335
335
|
return nil, :invalid_positiveInteger unless v > 0
|
|
336
|
-
|
|
336
|
+
[v, w]
|
|
337
337
|
},
|
|
338
338
|
"http://www.w3.org/2001/XMLSchema#unsignedLong" => lambda { |value, format|
|
|
339
339
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#nonNegativeInteger"].call(value, format)
|
|
340
340
|
return v, :invalid_unsignedLong unless w.nil?
|
|
341
341
|
return nil, :invalid_unsignedLong unless v <= 18446744073709551615
|
|
342
|
-
|
|
342
|
+
[v, w]
|
|
343
343
|
},
|
|
344
344
|
"http://www.w3.org/2001/XMLSchema#unsignedInt" => lambda { |value, format|
|
|
345
345
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#nonNegativeInteger"].call(value, format)
|
|
346
346
|
return v, :invalid_unsignedInt unless w.nil?
|
|
347
347
|
return nil, :invalid_unsignedInt unless v <= 4294967295
|
|
348
|
-
|
|
348
|
+
[v, w]
|
|
349
349
|
},
|
|
350
350
|
"http://www.w3.org/2001/XMLSchema#unsignedShort" => lambda { |value, format|
|
|
351
351
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#nonNegativeInteger"].call(value, format)
|
|
352
352
|
return v, :invalid_unsignedShort unless w.nil?
|
|
353
353
|
return nil, :invalid_unsignedShort unless v <= 65535
|
|
354
|
-
|
|
354
|
+
[v, w]
|
|
355
355
|
},
|
|
356
356
|
"http://www.w3.org/2001/XMLSchema#unsignedByte" => lambda { |value, format|
|
|
357
357
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#nonNegativeInteger"].call(value, format)
|
|
358
358
|
return v, :invalid_unsignedByte unless w.nil?
|
|
359
359
|
return nil, :invalid_unsignedByte unless v <= 255
|
|
360
|
-
|
|
360
|
+
[v, w]
|
|
361
361
|
},
|
|
362
362
|
"http://www.w3.org/2001/XMLSchema#nonPositiveInteger" => lambda { |value, format|
|
|
363
363
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
364
364
|
return v, :invalid_nonPositiveInteger unless w.nil?
|
|
365
365
|
return nil, :invalid_nonPositiveInteger unless v <= 0
|
|
366
|
-
|
|
366
|
+
[v, w]
|
|
367
367
|
},
|
|
368
368
|
"http://www.w3.org/2001/XMLSchema#negativeInteger" => lambda { |value, format|
|
|
369
369
|
v, w = DATATYPE_PARSER["http://www.w3.org/2001/XMLSchema#integer"].call(value, format)
|
|
370
370
|
return v, :invalid_negativeInteger unless w.nil?
|
|
371
371
|
return nil, :invalid_negativeInteger unless v < 0
|
|
372
|
-
|
|
372
|
+
[v, w]
|
|
373
373
|
},
|
|
374
374
|
"http://www.w3.org/2001/XMLSchema#double" => NUMERIC_PARSER,
|
|
375
375
|
# regular expressions here taken from XML Schema datatypes spec
|
|
@@ -60,7 +60,7 @@ module Csvlint
|
|
|
60
60
|
raise Csvlint::Csvw::MetadataError.new, "common property with @value has properties other than @language or @type" unless value.except("@type").except("@language").except("@value").empty?
|
|
61
61
|
when "@language"
|
|
62
62
|
raise Csvlint::Csvw::MetadataError.new, "common property with @language lacks a @value" unless value["@value"]
|
|
63
|
-
raise Csvlint::Csvw::MetadataError.new, "common property has invalid @language (#{v})"
|
|
63
|
+
raise Csvlint::Csvw::MetadataError.new, "common property has invalid @language (#{v})" if !((v.is_a? String) && (v =~ BCP47_LANGUAGE_REGEXP)) || !v.nil?
|
|
64
64
|
else
|
|
65
65
|
if p[0] == "@"
|
|
66
66
|
raise Csvlint::Csvw::MetadataError.new, "common property has property other than @id, @type, @value or @language beginning with @ (#{p})"
|
|
@@ -99,7 +99,7 @@ module Csvlint
|
|
|
99
99
|
v = format.parse(value[property])
|
|
100
100
|
if v.nil?
|
|
101
101
|
value.delete(property)
|
|
102
|
-
return [":invalid_#{property}"
|
|
102
|
+
return [:":invalid_#{property}"]
|
|
103
103
|
else
|
|
104
104
|
value[property] = v
|
|
105
105
|
return []
|
|
@@ -116,35 +116,35 @@ module Csvlint
|
|
|
116
116
|
def array_property(type)
|
|
117
117
|
lambda { |value, base_url, lang|
|
|
118
118
|
return value, nil, type if value.instance_of? Array
|
|
119
|
-
|
|
119
|
+
[false, :invalid_value, type]
|
|
120
120
|
}
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
def boolean_property(type)
|
|
124
124
|
lambda { |value, base_url, lang|
|
|
125
125
|
return value, nil, type if value == true || value == false
|
|
126
|
-
|
|
126
|
+
[false, :invalid_value, type]
|
|
127
127
|
}
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def string_property(type)
|
|
131
131
|
lambda { |value, base_url, lang|
|
|
132
132
|
return value, nil, type if value.instance_of? String
|
|
133
|
-
|
|
133
|
+
["", :invalid_value, type]
|
|
134
134
|
}
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def uri_template_property(type)
|
|
138
138
|
lambda { |value, base_url, lang|
|
|
139
139
|
return URITemplate.new(value), nil, type if value.instance_of? String
|
|
140
|
-
|
|
140
|
+
[URITemplate.new(""), :invalid_value, type]
|
|
141
141
|
}
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
def numeric_property(type)
|
|
145
145
|
lambda { |value, base_url, lang|
|
|
146
146
|
return value, nil, type if value.is_a?(Integer) && value >= 0
|
|
147
|
-
|
|
147
|
+
[nil, :invalid_value, type]
|
|
148
148
|
}
|
|
149
149
|
end
|
|
150
150
|
|
|
@@ -152,14 +152,14 @@ module Csvlint
|
|
|
152
152
|
lambda { |value, base_url, lang|
|
|
153
153
|
raise Csvlint::Csvw::MetadataError.new, "URL #{value} starts with _:" if /^_:/.match?(value.to_s)
|
|
154
154
|
return (base_url.nil? ? URI(value) : URI.join(base_url, value)), nil, type if value.instance_of? String
|
|
155
|
-
|
|
155
|
+
[base_url, :invalid_value, type]
|
|
156
156
|
}
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
def language_property(type)
|
|
160
160
|
lambda { |value, base_url, lang|
|
|
161
161
|
return value, nil, type if BCP47_REGEXP.match?(value)
|
|
162
|
-
|
|
162
|
+
[nil, :invalid_value, type]
|
|
163
163
|
}
|
|
164
164
|
end
|
|
165
165
|
|
|
@@ -167,7 +167,7 @@ module Csvlint
|
|
|
167
167
|
lambda { |value, base_url, lang|
|
|
168
168
|
warnings = []
|
|
169
169
|
if value.instance_of? String
|
|
170
|
-
|
|
170
|
+
[{lang => [value]}, nil, type]
|
|
171
171
|
elsif value.instance_of? Array
|
|
172
172
|
valid_titles = []
|
|
173
173
|
value.each do |title|
|
|
@@ -177,7 +177,7 @@ module Csvlint
|
|
|
177
177
|
warnings << :invalid_value
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
|
-
|
|
180
|
+
[{lang => valid_titles}, warnings, type]
|
|
181
181
|
elsif value.instance_of? Hash
|
|
182
182
|
value = value.clone
|
|
183
183
|
value.each do |l, v|
|
|
@@ -197,16 +197,16 @@ module Csvlint
|
|
|
197
197
|
end
|
|
198
198
|
end
|
|
199
199
|
warnings << :invalid_value if value.empty?
|
|
200
|
-
|
|
200
|
+
[value, warnings, type]
|
|
201
201
|
else
|
|
202
|
-
|
|
202
|
+
[{}, :invalid_value, type]
|
|
203
203
|
end
|
|
204
204
|
}
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
def column_reference_property(type)
|
|
208
208
|
lambda { |value, base_url, lang|
|
|
209
|
-
|
|
209
|
+
[Array(value), nil, type]
|
|
210
210
|
}
|
|
211
211
|
end
|
|
212
212
|
end
|
|
@@ -226,7 +226,7 @@ module Csvlint
|
|
|
226
226
|
values << v
|
|
227
227
|
warnings += w
|
|
228
228
|
end
|
|
229
|
-
|
|
229
|
+
[values, warnings, :common]
|
|
230
230
|
},
|
|
231
231
|
"suppressOutput" => boolean_property(:common),
|
|
232
232
|
"dialect" => lambda { |value, base_url, lang|
|
|
@@ -249,16 +249,16 @@ module Csvlint
|
|
|
249
249
|
end
|
|
250
250
|
end
|
|
251
251
|
end
|
|
252
|
-
|
|
252
|
+
[value, warnings, :common]
|
|
253
253
|
else
|
|
254
|
-
|
|
254
|
+
[{}, :invalid_value, :common]
|
|
255
255
|
end
|
|
256
256
|
},
|
|
257
257
|
# inherited properties
|
|
258
258
|
"null" => lambda { |value, base_url, lang|
|
|
259
259
|
case value
|
|
260
260
|
when String
|
|
261
|
-
|
|
261
|
+
[[value], nil, :inherited]
|
|
262
262
|
when Array
|
|
263
263
|
values = []
|
|
264
264
|
warnings = []
|
|
@@ -269,15 +269,15 @@ module Csvlint
|
|
|
269
269
|
warnings << :invalid_value
|
|
270
270
|
end
|
|
271
271
|
end
|
|
272
|
-
|
|
272
|
+
[values, warnings, :inherited]
|
|
273
273
|
else
|
|
274
|
-
|
|
274
|
+
[[""], :invalid_value, :inherited]
|
|
275
275
|
end
|
|
276
276
|
},
|
|
277
277
|
"default" => string_property(:inherited),
|
|
278
278
|
"separator" => lambda { |value, base_url, lang|
|
|
279
279
|
return value, nil, :inherited if value.instance_of?(String) || value.nil?
|
|
280
|
-
|
|
280
|
+
[nil, :invalid_value, :inherited]
|
|
281
281
|
},
|
|
282
282
|
"lang" => language_property(:inherited),
|
|
283
283
|
"datatype" => lambda { |value, base_url, lang|
|
|
@@ -387,7 +387,7 @@ module Csvlint
|
|
|
387
387
|
end
|
|
388
388
|
end
|
|
389
389
|
end
|
|
390
|
-
|
|
390
|
+
[value, warnings, :inherited]
|
|
391
391
|
},
|
|
392
392
|
"required" => boolean_property(:inherited),
|
|
393
393
|
"ordered" => boolean_property(:inherited),
|
|
@@ -397,14 +397,14 @@ module Csvlint
|
|
|
397
397
|
"textDirection" => lambda { |value, base_url, lang|
|
|
398
398
|
value = value.to_sym
|
|
399
399
|
return value, nil, :inherited if [:ltr, :rtl, :auto, :inherit].include? value
|
|
400
|
-
|
|
400
|
+
[:inherit, :invalid_value, :inherited]
|
|
401
401
|
},
|
|
402
402
|
# column level properties
|
|
403
403
|
"virtual" => boolean_property(:column),
|
|
404
404
|
"titles" => natural_language_property(:column),
|
|
405
405
|
"name" => lambda { |value, base_url, lang|
|
|
406
406
|
return value, nil, :column if value.instance_of?(String) && value =~ NAME_REGEXP
|
|
407
|
-
|
|
407
|
+
[nil, :invalid_value, :column]
|
|
408
408
|
},
|
|
409
409
|
# table level properties
|
|
410
410
|
"transformations" => lambda { |value, base_url, lang|
|
|
@@ -423,7 +423,7 @@ module Csvlint
|
|
|
423
423
|
elsif p == "titles"
|
|
424
424
|
else
|
|
425
425
|
v, warning, type = check_property(p, v, base_url, lang)
|
|
426
|
-
|
|
426
|
+
if type != :transformation && !(warning.nil? || warning.empty?)
|
|
427
427
|
value.delete(p)
|
|
428
428
|
warnings << :invalid_property unless type == :transformation
|
|
429
429
|
warnings += Array(warning)
|
|
@@ -438,12 +438,12 @@ module Csvlint
|
|
|
438
438
|
else
|
|
439
439
|
warnings << :invalid_value
|
|
440
440
|
end
|
|
441
|
-
|
|
441
|
+
[transformations, warnings, :table]
|
|
442
442
|
},
|
|
443
443
|
"tableDirection" => lambda { |value, base_url, lang|
|
|
444
444
|
value = value.to_sym
|
|
445
445
|
return value, nil, :table if [:ltr, :rtl, :auto].include? value
|
|
446
|
-
|
|
446
|
+
[:auto, :invalid_value, :table]
|
|
447
447
|
},
|
|
448
448
|
"tableSchema" => lambda { |value, base_url, lang|
|
|
449
449
|
schema_base_url = base_url
|
|
@@ -483,7 +483,7 @@ module Csvlint
|
|
|
483
483
|
end
|
|
484
484
|
end
|
|
485
485
|
end
|
|
486
|
-
|
|
486
|
+
[schema, warnings, :table]
|
|
487
487
|
},
|
|
488
488
|
"url" => link_property(:table),
|
|
489
489
|
# dialect properties
|
|
@@ -492,7 +492,7 @@ module Csvlint
|
|
|
492
492
|
"doubleQuote" => boolean_property(:dialect),
|
|
493
493
|
"encoding" => lambda { |value, base_url, lang|
|
|
494
494
|
return value, nil, :dialect if VALID_ENCODINGS.include? value
|
|
495
|
-
|
|
495
|
+
[nil, :invalid_value, :dialect]
|
|
496
496
|
},
|
|
497
497
|
"header" => boolean_property(:dialect),
|
|
498
498
|
"headerRowCount" => numeric_property(:dialect),
|
|
@@ -508,10 +508,10 @@ module Csvlint
|
|
|
508
508
|
value = :start if value == "start"
|
|
509
509
|
value = :end if value == "end"
|
|
510
510
|
return value, nil, :dialect if [:true, :false, :start, :end].include? value
|
|
511
|
-
|
|
511
|
+
[true, :invalid_value, :dialect]
|
|
512
512
|
},
|
|
513
513
|
# schema properties
|
|
514
|
-
"columns" => lambda { |value, base_url, lang|
|
|
514
|
+
"columns" => lambda { |value, base_url, lang| [value, nil, :schema] },
|
|
515
515
|
"primaryKey" => column_reference_property(:schema),
|
|
516
516
|
"foreignKeys" => lambda { |value, base_url, lang|
|
|
517
517
|
foreign_keys = []
|
|
@@ -540,13 +540,13 @@ module Csvlint
|
|
|
540
540
|
else
|
|
541
541
|
warnings << :invalid_value
|
|
542
542
|
end
|
|
543
|
-
|
|
543
|
+
[foreign_keys, warnings, :schema]
|
|
544
544
|
},
|
|
545
545
|
"rowTitles" => column_reference_property(:schema),
|
|
546
546
|
# transformation properties
|
|
547
|
-
"targetFormat" => lambda { |value, base_url, lang|
|
|
548
|
-
"scriptFormat" => lambda { |value, base_url, lang|
|
|
549
|
-
"source" => lambda { |value, base_url, lang|
|
|
547
|
+
"targetFormat" => lambda { |value, base_url, lang| [value, nil, :transformation] },
|
|
548
|
+
"scriptFormat" => lambda { |value, base_url, lang| [value, nil, :transformation] },
|
|
549
|
+
"source" => lambda { |value, base_url, lang| [value, nil, :transformation] },
|
|
550
550
|
# foreignKey properties
|
|
551
551
|
"columnReference" => column_reference_property(:foreign_key),
|
|
552
552
|
"reference" => lambda { |value, base_url, lang|
|
|
@@ -572,15 +572,15 @@ module Csvlint
|
|
|
572
572
|
raise Csvlint::Csvw::MetadataError.new("foreignKey.reference.columnReference"), "foreignKey reference columnReference is missing" unless value["columnReference"]
|
|
573
573
|
raise Csvlint::Csvw::MetadataError.new("foreignKey.reference"), "foreignKey reference does not have either resource or schemaReference" unless value["resource"] || value["schemaReference"]
|
|
574
574
|
raise Csvlint::Csvw::MetadataError.new("foreignKey.reference"), "foreignKey reference has both resource and schemaReference" if value["resource"] && value["schemaReference"]
|
|
575
|
-
|
|
575
|
+
[value, warnings, :foreign_key]
|
|
576
576
|
else
|
|
577
577
|
raise Csvlint::Csvw::MetadataError.new("foreignKey.reference"), "foreignKey reference is not an object"
|
|
578
578
|
end
|
|
579
579
|
},
|
|
580
580
|
# foreignKey reference properties
|
|
581
|
-
"resource" => lambda { |value, base_url, lang|
|
|
581
|
+
"resource" => lambda { |value, base_url, lang| [value, nil, :foreign_key_reference] },
|
|
582
582
|
"schemaReference" => lambda { |value, base_url, lang|
|
|
583
|
-
|
|
583
|
+
[URI.join(base_url, value).to_s, nil, :foreign_key_reference]
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
|
data/lib/csvlint/field.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Csvlint
|
|
|
16
16
|
|
|
17
17
|
def validate_column(value, row = nil, column = nil, all_errors = [])
|
|
18
18
|
reset
|
|
19
|
-
unless all_errors.any? { |error| (
|
|
19
|
+
unless all_errors.any? { |error| (error.type == :invalid_regex) && (error.column == column) }
|
|
20
20
|
validate_regex(value, row, column, all_errors)
|
|
21
21
|
end
|
|
22
22
|
validate_length(value, row, column)
|
data/lib/csvlint/validate.rb
CHANGED
|
@@ -590,14 +590,14 @@ module Csvlint
|
|
|
590
590
|
numeric: /\A[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?\z/,
|
|
591
591
|
uri: /\Ahttps?:/,
|
|
592
592
|
date_db: /\A\d{4,}-\d\d-\d\d\z/, # "12345-01-01"
|
|
593
|
-
date_long: /\A(?:#{Date::MONTHNAMES.join(
|
|
594
|
-
date_rfc822: /\A[ \d]\d (?:#{Date::ABBR_MONTHNAMES.join(
|
|
595
|
-
date_short: /\A[ \d]\d (?:#{Date::ABBR_MONTHNAMES.join(
|
|
593
|
+
date_long: /\A(?:#{Date::MONTHNAMES.join("|")}) [ \d]\d, \d{4,}\z/, # "January 1, 12345"
|
|
594
|
+
date_rfc822: /\A[ \d]\d (?:#{Date::ABBR_MONTHNAMES.join("|")}) \d{4,}\z/, # " 1 Jan 12345"
|
|
595
|
+
date_short: /\A[ \d]\d (?:#{Date::ABBR_MONTHNAMES.join("|")})\z/, # "1 Jan"
|
|
596
596
|
dateTime_db: /\A\d{4,}-\d\d-\d\d \d\d:\d\d:\d\d\z/, # "12345-01-01 00:00:00"
|
|
597
597
|
dateTime_hms: /\A\d\d:\d\d:\d\d\z/, # "00:00:00"
|
|
598
598
|
dateTime_iso8601: /\A\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\dZ\z/, # "12345-01-01T00:00:00Z"
|
|
599
|
-
dateTime_long: /\A(?:#{Date::MONTHNAMES.join(
|
|
600
|
-
dateTime_short: /\A\d\d (?:#{Date::ABBR_MONTHNAMES.join(
|
|
599
|
+
dateTime_long: /\A(?:#{Date::MONTHNAMES.join("|")}) \d\d, \d{4,} \d\d:\d\d\z/, # "January 01, 12345 00:00"
|
|
600
|
+
dateTime_short: /\A\d\d (?:#{Date::ABBR_MONTHNAMES.join("|")}) \d\d:\d\d\z/, # "01 Jan 00:00"
|
|
601
601
|
dateTime_time: /\A\d\d:\d\d\z/ # "00:00"
|
|
602
602
|
}.freeze
|
|
603
603
|
|
data/lib/csvlint/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: csvlint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- pezholio
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-01-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: csv
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: rainbow
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: open_uri_redirections
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: activesupport
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "<"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 7.1.0
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "<"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 7.1.0
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: addressable
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -418,6 +432,7 @@ files:
|
|
|
418
432
|
- ".github/dependabot.yml"
|
|
419
433
|
- ".github/workflows/push.yml"
|
|
420
434
|
- ".gitignore"
|
|
435
|
+
- ".pre-commit-hooks.yaml"
|
|
421
436
|
- ".ruby-version"
|
|
422
437
|
- ".standard_todo.yml"
|
|
423
438
|
- CHANGELOG.md
|
|
@@ -512,14 +527,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
512
527
|
version: '2.5'
|
|
513
528
|
- - "<"
|
|
514
529
|
- !ruby/object:Gem::Version
|
|
515
|
-
version: '3.
|
|
530
|
+
version: '3.4'
|
|
516
531
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
517
532
|
requirements:
|
|
518
533
|
- - ">="
|
|
519
534
|
- !ruby/object:Gem::Version
|
|
520
535
|
version: '0'
|
|
521
536
|
requirements: []
|
|
522
|
-
rubygems_version: 3.
|
|
537
|
+
rubygems_version: 3.5.3
|
|
523
538
|
signing_key:
|
|
524
539
|
specification_version: 4
|
|
525
540
|
summary: CSV Validator
|