csvlint 1.0.0 → 1.2.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +4 -0
  3. data/.github/workflows/push.yml +14 -2
  4. data/.pre-commit-hooks.yaml +5 -0
  5. data/.ruby-version +1 -1
  6. data/.standard_todo.yml +43 -0
  7. data/CHANGELOG.md +84 -32
  8. data/Dockerfile +16 -0
  9. data/Gemfile +2 -2
  10. data/README.md +30 -9
  11. data/Rakefile +7 -7
  12. data/csvlint.gemspec +14 -16
  13. data/docker_notes_for_windows.txt +20 -0
  14. data/features/step_definitions/cli_steps.rb +11 -11
  15. data/features/step_definitions/information_steps.rb +4 -4
  16. data/features/step_definitions/parse_csv_steps.rb +11 -11
  17. data/features/step_definitions/schema_validation_steps.rb +10 -10
  18. data/features/step_definitions/sources_steps.rb +1 -1
  19. data/features/step_definitions/validation_errors_steps.rb +19 -19
  20. data/features/step_definitions/validation_info_steps.rb +9 -9
  21. data/features/step_definitions/validation_warnings_steps.rb +11 -11
  22. data/features/support/aruba.rb +6 -6
  23. data/features/support/earl_formatter.rb +39 -39
  24. data/features/support/env.rb +10 -11
  25. data/features/support/load_tests.rb +107 -103
  26. data/features/support/webmock.rb +2 -2
  27. data/lib/csvlint/cli.rb +133 -130
  28. data/lib/csvlint/csvw/column.rb +279 -280
  29. data/lib/csvlint/csvw/date_format.rb +90 -92
  30. data/lib/csvlint/csvw/metadata_error.rb +1 -3
  31. data/lib/csvlint/csvw/number_format.rb +40 -32
  32. data/lib/csvlint/csvw/property_checker.rb +714 -717
  33. data/lib/csvlint/csvw/table.rb +49 -52
  34. data/lib/csvlint/csvw/table_group.rb +24 -23
  35. data/lib/csvlint/error_collector.rb +2 -0
  36. data/lib/csvlint/error_message.rb +0 -1
  37. data/lib/csvlint/field.rb +153 -141
  38. data/lib/csvlint/schema.rb +34 -42
  39. data/lib/csvlint/validate.rb +161 -143
  40. data/lib/csvlint/version.rb +1 -1
  41. data/lib/csvlint.rb +22 -23
  42. data/spec/csvw/column_spec.rb +15 -16
  43. data/spec/csvw/date_format_spec.rb +5 -7
  44. data/spec/csvw/number_format_spec.rb +2 -4
  45. data/spec/csvw/table_group_spec.rb +103 -105
  46. data/spec/csvw/table_spec.rb +71 -73
  47. data/spec/field_spec.rb +116 -121
  48. data/spec/schema_spec.rb +129 -139
  49. data/spec/spec_helper.rb +6 -6
  50. data/spec/validator_spec.rb +167 -190
  51. metadata +23 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 651e0cab26de36c97d333823f6ac72ad1377397e5e5dbf02397725fd8b42d663
4
- data.tar.gz: cf81fa72bc040e242e947c8abb7009f7dd8ec6d5c9f08c21c9177eb62ab9c648
3
+ metadata.gz: 1b539755c5a3e55301ec58027cdfe2df880109aeee0e4c130bdab1e40e1dd38f
4
+ data.tar.gz: f2d6f801c28e86b75de094302fce55054232f7b3ffd85a8278faab1a6f2fdaba
5
5
  SHA512:
6
- metadata.gz: dbe214a6737375e2e5f4b6c08c63345ce850eaaea30373fab732a8352b84e58f862af5490d39dc18415f0256b92d0625c51c8e61ade9d2ef562050239340d985
7
- data.tar.gz: 79296f466687b53a26a3e1c402a2ac7a6f2c2f999092a11567c897d71e3b78eca592cba97da211af5226e09ffd7086ed2cf0433cdeb14ad8c0635e5f6b55a7b8
6
+ metadata.gz: 66ac4e79de88c7a7aa58106ae2e4c030e63e94e5cc1609cd3ac1b5ec72c2f2dc64755f05172da23cfd306fa60c4254bd90a9fa60280ea7e15c08379a76ca489c
7
+ data.tar.gz: 42fcb514ba728eaf7c957033e08dbc9ce1e9c9bfc92c94229ac158b22dd8267cf47c911dde294325c5f51ac314d359d8dcd97932966a4ac324ae6e932e7a234c
@@ -5,3 +5,7 @@ updates:
5
5
  schedule:
6
6
  interval: daily
7
7
  open-pull-requests-limit: 10
8
+ - package-ecosystem: github-actions
9
+ directory: "/"
10
+ schedule:
11
+ interval: weekly
@@ -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']
12
+ ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
13
13
  fail-fast: false
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
16
  - uses: ruby/setup-ruby@v1
17
17
  with:
18
18
  bundler-cache: true
@@ -21,3 +21,15 @@ jobs:
21
21
  run: bundle install
22
22
  - name: Run the tests
23
23
  run: bundle exec rake
24
+ lint:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ bundler-cache: true
31
+ ruby-version: "3.2"
32
+ - name: Install dependencies
33
+ run: bundle install
34
+ - name: Run the tests
35
+ run: bundle exec standardrb
@@ -0,0 +1,5 @@
1
+ - id: csvlint
2
+ name: csvlint
3
+ entry: csvlint
4
+ language: ruby
5
+ files: \.csv$
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.2.0
@@ -0,0 +1,43 @@
1
+ # Auto generated files with errors to ignore.
2
+ # Remove from this list as you refactor files.
3
+ ---
4
+ ignore:
5
+ - features/step_definitions/validation_errors_steps.rb:
6
+ - Lint/Void
7
+ - features/support/load_tests.rb:
8
+ - Style/For
9
+ - Security/Open
10
+ - Lint/UselessAssignment
11
+ - lib/csvlint/cli.rb:
12
+ - Style/NonNilCheck
13
+ - lib/csvlint/csvw/column.rb:
14
+ - Style/TernaryParentheses
15
+ - lib/csvlint/csvw/date_format.rb:
16
+ - Lint/MixedRegexpCaptureTypes
17
+ - lib/csvlint/csvw/number_format.rb:
18
+ - Style/SlicingWithRange
19
+ - Style/IdenticalConditionalBranches
20
+ - lib/csvlint/csvw/property_checker.rb:
21
+ - Performance/InefficientHashSearch
22
+ - Lint/UselessAssignment
23
+ - Naming/VariableName
24
+ - Style/SlicingWithRange
25
+ - Security/Open
26
+ - Lint/BooleanSymbol
27
+ - lib/csvlint/csvw/table_group.rb:
28
+ - Style/OptionalArguments
29
+ - lib/csvlint/field.rb:
30
+ - Naming/VariableName
31
+ - lib/csvlint/schema.rb:
32
+ - Security/Open
33
+ - Lint/UselessAssignment
34
+ - Style/SlicingWithRange
35
+ - lib/csvlint/validate.rb:
36
+ - Lint/UselessAssignment
37
+ - Performance/Count
38
+ - Lint/BooleanSymbol
39
+ - Naming/VariableName
40
+ - Security/Open
41
+ - Lint/NonLocalExitFromIterator
42
+ - spec/validator_spec.rb:
43
+ - Lint/UselessAssignment
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
- * Don't patch CSV#init_converters for ruby 2.5 compatibility by @rbmrclo in https://github.com/Data-Liberation-Front/csvlint.rb/pull/217
10
- * correct typos in README by @erikj in https://github.com/Data-Liberation-Front/csvlint.rb/pull/216
11
- * add info about your PATH by @ftrotter in https://github.com/Data-Liberation-Front/csvlint.rb/pull/222
12
- * Remove tests on deprecated ruby versions < 2.3 by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/234
13
- * Drop mime-types gem dependency by @ohbarye in https://github.com/Data-Liberation-Front/csvlint.rb/pull/221
14
- * remove specific version of net-http-persistent in gemspec by @kotaro0522 in https://github.com/Data-Liberation-Front/csvlint.rb/pull/219
15
- * Replace colorize with rainbow to make licensing consistent. by @cobbr2 in https://github.com/Data-Liberation-Front/csvlint.rb/pull/215
16
- * Update rdf requirement from < 2.0 to < 4.0 by @dependabot-preview in https://github.com/Data-Liberation-Front/csvlint.rb/pull/231
17
- * Test on Ruby 2.5 and 2.6 by @Domon in https://github.com/Data-Liberation-Front/csvlint.rb/pull/223
18
- * Fix load_from_json deprecation warnings. by @jezhiggins in https://github.com/Data-Liberation-Front/csvlint.rb/pull/237
19
- * Fix csvw tests by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/239
20
- * Test on Ruby 2.6 and 2.7 by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/240
21
- * Create Dependabot config file by @dependabot-preview in https://github.com/Data-Liberation-Front/csvlint.rb/pull/245
22
- * 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
23
- * add CI workflow for github actions by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/255
24
- * Enable and fix tests for Ruby 2.5 by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/259
25
- * Support Ruby 2.6 by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/262
26
- * Ruby 2.7 support by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/263
27
- * Drop support for Ruby 2.4 by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/265
28
- * Ruby 3.0 by @Floppy in https://github.com/Data-Liberation-Front/csvlint.rb/pull/264
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
- * @rbmrclo made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/217
32
- * @erikj made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/216
33
- * @ftrotter made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/222
34
- * @ohbarye made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/221
35
- * @kotaro0522 made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/219
36
- * @cobbr2 made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/215
37
- * @dependabot-preview made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/231
38
- * @Domon made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/223
39
- * @mseverini made their first contribution in https://github.com/Data-Liberation-Front/csvlint.rb/pull/246
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
- - CLI doesn't handle filenames with spaces [\#182](https://github.com/theodi/csvlint.rb/issues/182)
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/Dockerfile ADDED
@@ -0,0 +1,16 @@
1
+ FROM ruby:2.5.8-buster
2
+
3
+ # throw errors if Gemfile has been modified since Gemfile.lock
4
+ RUN bundle config --global frozen 1
5
+
6
+ WORKDIR /usr/src/app
7
+
8
+ ENV LANG C.UTF-8
9
+
10
+ COPY ./lib/csvlint/version.rb ./lib/csvlint/
11
+ COPY csvlint.gemspec Gemfile Gemfile.lock ./
12
+ RUN bundle install
13
+
14
+ COPY ./ ./
15
+
16
+ CMD ["./bin/csvlint"]
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in csvlint.rb.gemspec
4
- gemspec
4
+ gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- [![Build Status](http://img.shields.io/travis/theodi/csvlint.rb.svg)](https://travis-ci.org/theodi/csvlint.rb)
2
- [![Dependency Status](http://img.shields.io/gemnasium/theodi/csvlint.rb.svg)](https://gemnasium.com/theodi/csvlint.rb)
3
- [![Coverage Status](http://img.shields.io/coveralls/theodi/csvlint.rb.svg)](https://coveralls.io/r/theodi/csvlint.rb)
1
+ [![Build Status](https://img.shields.io/github/workflow/status/Data-Liberation-Front/csvlint.rb/CI/main)](https://travis-ci.org/theodi/csvlint.rb)
2
+ [![Dependency Status](https://img.shields.io/librariesio/github/Data-Liberation-Front/csvlint.rb)](https://libraries.io/github/Data-Liberation-Front/csvlint.rb)
3
+ [![Coverage Status](http://img.shields.io/coveralls/Data-Liberation-Front/csvlint.rb.svg)](https://coveralls.io/r/Data-Liberation-Front/csvlint.rb)
4
4
  [![License](http://img.shields.io/:license-mit-blue.svg)](http://theodi.mit-license.org)
5
5
  [![Badges](http://img.shields.io/:badges-5/5-ff6799.svg)](https://github.com/pikesley/badger)
6
6
 
@@ -10,14 +10,14 @@ A ruby gem to support validating CSV files to check their syntax and contents. Y
10
10
 
11
11
  ## Summary of features
12
12
 
13
- * Validation that checks the structural formatting of a CSV file
13
+ * Validation that checks the structural formatting of a CSV file
14
14
  * Validation of a delimiter-separated values (dsv) file accesible via URL, File, or an IO-style object (e.g. StringIO)
15
- * Validation against [CSV dialects](http://dataprotocols.org/csv-dialect/)
16
- * Validation against multiple schema standards; [JSON Table Schema](https://github.com/theodi/csvlint.rb/blob/master/README.md#json-table-schema-support) and [CSV on the Web](https://github.com/theodi/csvlint.rb/blob/master/README.md#csv-on-the-web-validation-support)
15
+ * Validation against [CSV dialects](http://dataprotocols.org/csv-dialect/)
16
+ * Validation against multiple schema standards; [JSON Table Schema](https://github.com/theodi/csvlint.rb/blob/master/README.md#json-table-schema-support) and [CSV on the Web](https://github.com/theodi/csvlint.rb/blob/master/README.md#csv-on-the-web-validation-support)
17
17
 
18
18
  ## Development
19
19
 
20
- `ruby version 2.1.4`
20
+ `ruby version 3.2`
21
21
 
22
22
  ### Tests
23
23
 
@@ -71,7 +71,7 @@ After installing the gem, you can validate a CSV on the command line like so:
71
71
 
72
72
  csvlint myfile.csv
73
73
 
74
- You may need to add the gem exectuable directory to your path, by adding '/usr/local/lib/ruby/gems/2.6.0/bin'
74
+ You may need to add the gem exectuable directory to your path, by adding '/usr/local/lib/ruby/gems/2.6.0/bin'
75
75
  or whatever your version is, to your .bash_profile PATH entry. [like so](https://stackoverflow.com/questions/2392293/ruby-gems-returns-command-not-found)
76
76
 
77
77
  You will then see the validation result, together with any warnings or errors e.g.
@@ -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)
@@ -213,7 +234,7 @@ An example JSON Table Schema schema file is:
213
234
  "name": "price",
214
235
  "constraints": {
215
236
  "required": true,
216
- "minLength": 1
237
+ "minLength": 1
217
238
  }
218
239
  },
219
240
  {
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- $:.unshift File.join( File.dirname(__FILE__), "lib")
3
+ $:.unshift File.join(File.dirname(__FILE__), "lib")
4
4
 
5
- require 'rubygems'
6
- require 'cucumber'
7
- require 'cucumber/rake/task'
8
- require 'coveralls/rake/task'
9
- require 'rspec/core/rake_task'
5
+ require "rubygems"
6
+ require "cucumber"
7
+ require "cucumber/rake/task"
8
+ require "coveralls/rake/task"
9
+ require "rspec/core/rake_task"
10
10
 
11
11
  RSpec::Core::RakeTask.new(:spec)
12
12
  Coveralls::RakeTask.new
@@ -14,4 +14,4 @@ Cucumber::Rake::Task.new(:features) do |t|
14
14
  t.cucumber_opts = "features --format pretty"
15
15
  end
16
16
 
17
- task :default => [:spec, :features, 'coveralls:push']
17
+ task default: [:spec, :features, "coveralls:push"]
data/csvlint.gemspec CHANGED
@@ -1,24 +1,22 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'csvlint/version'
3
+ require "csvlint/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "csvlint"
8
- spec.version = Csvlint::VERSION
9
- spec.authors = ["pezholio"]
10
- spec.email = ["pezholio@gmail.com"]
11
- spec.description = %q{CSV Validator}
12
- spec.summary = %q{CSV Validator}
13
- spec.homepage = "https://github.com/theodi/csvlint.rb"
14
- spec.license = "MIT"
6
+ spec.name = "csvlint"
7
+ spec.version = Csvlint::VERSION
8
+ spec.authors = ["pezholio"]
9
+ spec.email = ["pezholio@gmail.com"]
10
+ spec.description = "CSV Validator"
11
+ spec.summary = "CSV Validator"
12
+ spec.homepage = "https://github.com/theodi/csvlint.rb"
13
+ spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
17
  spec.require_paths = ["lib"]
20
18
 
21
- spec.required_ruby_version = ['>= 2.5', '< 3.2']
19
+ spec.required_ruby_version = [">= 2.5", "< 3.3"]
22
20
 
23
21
  spec.add_dependency "rainbow"
24
22
  spec.add_dependency "open_uri_redirections"
@@ -48,5 +46,5 @@ Gem::Specification.new do |spec|
48
46
  spec.add_development_dependency "rdf", "< 4.0"
49
47
  spec.add_development_dependency "rdf-turtle"
50
48
  spec.add_development_dependency "henry"
51
-
49
+ spec.add_development_dependency "standardrb"
52
50
  end
@@ -0,0 +1,20 @@
1
+ # Note that these commands are specific for a docker environment on MS Windows.
2
+
3
+ # to generate Gemfile.lock file
4
+ docker run --rm -v %CD%:/usr/src/app -w /usr/src/app ruby:2.5 bundle install
5
+
6
+ # to build docker image from source (the ending dot is significant)
7
+ docker build -t csvlint .
8
+
9
+ # to run tests
10
+ docker run -it --rm csvlint rake
11
+
12
+ # to run csvlint command line with a CSV file.
13
+ # cd to the directory with the CSV file then
14
+ docker run -it --rm -v %CD%:/tmp csvlint ./bin/csvlint --dump-errors /tmp/file-to-lint.csv
15
+
16
+ # to enter the linux container
17
+ docker run -it --rm -v %CD%:/tmp csvlint bash
18
+
19
+ # to enter the ruby REPL
20
+ docker run -it --rm -v %CD%:/tmp csvlint irb
@@ -1,37 +1,37 @@
1
- Given(/^I have stubbed stdin to contain "(.*?)"$/) do |file|
2
- expect(STDIN).to receive(:read).and_return(File.read(file))
1
+ Given(/^I have stubbed $stdin to contain "(.*?)"$/) do |file|
2
+ expect($stdin).to receive(:read).and_return(File.read(file))
3
3
  end
4
4
 
5
- Given(/^I have stubbed stdin to contain nothing$/) do
6
- expect(STDIN).to receive(:read).and_return(nil)
5
+ Given(/^I have stubbed $stdin to contain nothing$/) do
6
+ expect($stdin).to receive(:read).and_return(nil)
7
7
  end
8
8
 
9
9
  Then(/^nothing should be outputted to STDERR$/) do
10
- expect(STDERR).to_not receive(:puts)
10
+ expect($stderr).to_not receive(:puts)
11
11
  end
12
12
 
13
13
  Then(/^the output should contain JSON$/) do
14
14
  @json = JSON.parse(all_stdout)
15
- expect(@json['validation']).to be_present
15
+ expect(@json["validation"]).to be_present
16
16
  end
17
17
 
18
18
  Then(/^the JSON should have a state of "(.*?)"$/) do |state|
19
- expect(@json['validation']['state']).to eq(state)
19
+ expect(@json["validation"]["state"]).to eq(state)
20
20
  end
21
21
 
22
22
  Then(/^the JSON should have (\d+) errors?$/) do |count|
23
23
  @index = count.to_i - 1
24
- expect(@json['validation']['errors'].count).to eq(count.to_i)
24
+ expect(@json["validation"]["errors"].count).to eq(count.to_i)
25
25
  end
26
26
 
27
27
  Then(/^that error should have the "(.*?)" "(.*?)"$/) do |k, v|
28
- expect(@json['validation']['errors'][@index][k].to_s).to eq(v)
28
+ expect(@json["validation"]["errors"][@index][k].to_s).to eq(v)
29
29
  end
30
30
 
31
31
  Then(/^error (\d+) should have the "(.*?)" "(.*?)"$/) do |index, k, v|
32
- expect(@json['validation']['errors'][index.to_i - 1][k].to_s).to eq(v)
32
+ expect(@json["validation"]["errors"][index.to_i - 1][k].to_s).to eq(v)
33
33
  end
34
34
 
35
35
  Then(/^error (\d+) should have the constraint "(.*?)" "(.*?)"$/) do |index, k, v|
36
- expect(@json['validation']['errors'][index.to_i - 1]['constraints'][k].to_s).to eq(v)
36
+ expect(@json["validation"]["errors"][index.to_i - 1]["constraints"][k].to_s).to eq(v)
37
37
  end
@@ -3,11 +3,11 @@ Given(/^the content type is "(.*?)"$/) do |arg1|
3
3
  end
4
4
 
5
5
  Then(/^the "(.*?)" should be "(.*?)"$/) do |type, encoding|
6
- validator = Csvlint::Validator.new( @url, default_csv_options )
7
- expect( validator.send(type.to_sym) ).to eq( encoding )
6
+ validator = Csvlint::Validator.new(@url, default_csv_options)
7
+ expect(validator.send(type.to_sym)).to eq(encoding)
8
8
  end
9
9
 
10
10
  Then(/^the metadata content type should be "(.*?)"$/) do |content_type|
11
- validator = Csvlint::Validator.new( @url, default_csv_options )
12
- expect( validator.headers['content-type'] ).to eq( content_type )
11
+ validator = Csvlint::Validator.new(@url, default_csv_options)
12
+ expect(validator.headers["content-type"]).to eq(content_type)
13
13
  end