Skip to content

Commit

Permalink
Merge pull request #273 from Data-Liberation-Front/ruby-3.2-support
Browse files Browse the repository at this point in the history
Add support for Ruby 3.2
  • Loading branch information
Floppy authored Dec 28, 2022
2 parents 14c433c + 62360aa commit 6b20cd6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1']
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "3.1"
ruby-version: "3.2"
- name: Install dependencies
run: bundle install
- name: Run the tests
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.2
3.2.0
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ A ruby gem to support validating CSV files to check their syntax and contents. Y

## Summary of features

* Validation that checks the structural formatting of a CSV file
* Validation that checks the structural formatting of a CSV file
* Validation of a delimiter-separated values (dsv) file accesible via URL, File, or an IO-style object (e.g. StringIO)
* Validation against [CSV dialects](http://dataprotocols.org/csv-dialect/)
* 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)
* Validation against [CSV dialects](http://dataprotocols.org/csv-dialect/)
* 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)

## Development

`ruby version 3.1.2`
`ruby version 3.2`

### Tests

Expand Down Expand Up @@ -71,7 +71,7 @@ After installing the gem, you can validate a CSV on the command line like so:

csvlint myfile.csv

You may need to add the gem exectuable directory to your path, by adding '/usr/local/lib/ruby/gems/2.6.0/bin'
You may need to add the gem exectuable directory to your path, by adding '/usr/local/lib/ruby/gems/2.6.0/bin'
or whatever your version is, to your .bash_profile PATH entry. [like so](https://stackoverflow.com/questions/2392293/ruby-gems-returns-command-not-found)

You will then see the validation result, together with any warnings or errors e.g.
Expand Down Expand Up @@ -213,7 +213,7 @@ An example JSON Table Schema schema file is:
"name": "price",
"constraints": {
"required": true,
"minLength": 1
"minLength": 1
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion csvlint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = [">= 2.5", "< 3.2"]
spec.required_ruby_version = [">= 2.5", "< 3.3"]

spec.add_dependency "rainbow"
spec.add_dependency "open_uri_redirections"
Expand Down
1 change: 0 additions & 1 deletion lib/csvlint.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "csv"
require "date"
require "open-uri"
require "set"
require "tempfile"
require "typhoeus"

Expand Down
4 changes: 2 additions & 2 deletions lib/csvlint/csvw/property_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def check_common_property_value(value, base_url, lang)
when "@type"
if value["@value"] && BUILT_IN_DATATYPES.include?(v)
elsif !value["@value"] && BUILT_IN_TYPES.include?(v)
elsif v =~ /^([a-z]+):/ && NAMESPACES.include?(v.split(":")[0])
elsif ((v.is_a? String) && (v =~ /^([a-z]+):/)) && NAMESPACES.include?(v.split(":")[0])
else
# must be an absolute URI
begin
Expand All @@ -60,7 +60,7 @@ def check_common_property_value(value, base_url, lang)
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?
when "@language"
raise Csvlint::Csvw::MetadataError.new, "common property with @language lacks a @value" unless value["@value"]
raise Csvlint::Csvw::MetadataError.new, "common property has invalid @language (#{v})" unless v =~ BCP47_LANGUAGE_REGEXP || v.nil?
raise Csvlint::Csvw::MetadataError.new, "common property has invalid @language (#{v})" unless ((v.is_a? String) && (v =~ BCP47_LANGUAGE_REGEXP)) || v.nil?
else
if p[0] == "@"
raise Csvlint::Csvw::MetadataError.new, "common property has property other than @id, @type, @value or @language beginning with @ (#{p})"
Expand Down

0 comments on commit 6b20cd6

Please sign in to comment.