csvlint 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -12,31 +12,31 @@ Given(/^it is stored at the url "(.*?)"$/) do |url|
12
12
  charset = @encoding || "UTF-8"
13
13
  headers = {"Content-Type" => "#{content_type}; charset=#{charset}"}
14
14
  headers["Link"] = @link if @link
15
- stub_request(:get, url).to_return(:status => 200, :body => @csv, :headers => headers)
16
- stub_request(:get, URI.join(url, '/.well-known/csvm')).to_return(:status => 404)
17
- stub_request(:get, url + '-metadata.json').to_return(:status => 404)
18
- stub_request(:get, URI.join(url, 'csv-metadata.json')).to_return(:status => 404)
15
+ stub_request(:get, url).to_return(status: 200, body: @csv, headers: headers)
16
+ stub_request(:get, URI.join(url, "/.well-known/csvm")).to_return(status: 404)
17
+ stub_request(:get, url + "-metadata.json").to_return(status: 404)
18
+ stub_request(:get, URI.join(url, "csv-metadata.json")).to_return(status: 404)
19
19
  end
20
20
 
21
21
  Given(/^it is stored at the url "(.*?)" with no character set$/) do |url|
22
22
  @url = url
23
23
  content_type = @content_type || "text/csv"
24
- stub_request(:get, url).to_return(:status => 200, :body => @csv, :headers => {"Content-Type" => "#{content_type}"})
25
- stub_request(:get, URI.join(url, '/.well-known/csvm')).to_return(:status => 404)
26
- stub_request(:get, url + '-metadata.json').to_return(:status => 404)
27
- stub_request(:get, URI.join(url, 'csv-metadata.json')).to_return(:status => 404)
24
+ stub_request(:get, url).to_return(status: 200, body: @csv, headers: {"Content-Type" => content_type.to_s})
25
+ stub_request(:get, URI.join(url, "/.well-known/csvm")).to_return(status: 404)
26
+ stub_request(:get, url + "-metadata.json").to_return(status: 404)
27
+ stub_request(:get, URI.join(url, "csv-metadata.json")).to_return(status: 404)
28
28
  end
29
29
 
30
30
  When(/^I ask if the CSV is valid$/) do
31
31
  @csv_options ||= default_csv_options
32
- @validator = Csvlint::Validator.new( @url, @csv_options )
32
+ @validator = Csvlint::Validator.new(@url, @csv_options)
33
33
  @valid = @validator.valid?
34
34
  end
35
35
 
36
36
  Then(/^I should get the value of true$/) do
37
- expect( @valid ).to be(true)
37
+ expect(@valid).to be(true)
38
38
  end
39
39
 
40
40
  Then(/^I should get the value of false$/) do
41
- expect( @valid ).to be(false)
41
+ expect(@valid).to be(false)
42
42
  end
@@ -10,24 +10,24 @@ end
10
10
 
11
11
  Given(/^I have a metadata file called "([^"]*)"$/) do |filename|
12
12
  @schema_type = :csvw_metadata
13
- @schema_json = File.read( File.join( File.dirname(__FILE__), "..", "fixtures", filename ) )
13
+ @schema_json = File.read(File.join(File.dirname(__FILE__), "..", "fixtures", filename))
14
14
  end
15
15
 
16
- Given(/^the (schema|metadata) is stored at the url "(.*?)"$/) do |schema_type,schema_url|
16
+ Given(/^the (schema|metadata) is stored at the url "(.*?)"$/) do |schema_type, schema_url|
17
17
  @schema_url = schema_url
18
- stub_request(:get, @schema_url).to_return(:status => 200, :body => @schema_json.to_str)
18
+ stub_request(:get, @schema_url).to_return(status: 200, body: @schema_json.to_str)
19
19
  end
20
20
 
21
21
  Given(/^there is a file at "(.*?)" with the content:$/) do |url, content|
22
- stub_request(:get, url).to_return(:status => 200, :body => content.to_str)
22
+ stub_request(:get, url).to_return(status: 200, body: content.to_str)
23
23
  end
24
24
 
25
- Given(/^I have a file called "(.*?)" at the url "(.*?)"$/) do |filename,url|
26
- content = File.read( File.join( File.dirname(__FILE__), "..", "fixtures", filename ) )
27
- content_type = filename =~ /.csv$/ ? "text/csv" : "application/csvm+json"
28
- stub_request(:get, url).to_return(:status => 200, :body => content, :headers => {"Content-Type" => "#{content_type}; charset=UTF-8"})
25
+ Given(/^I have a file called "(.*?)" at the url "(.*?)"$/) do |filename, url|
26
+ content = File.read(File.join(File.dirname(__FILE__), "..", "fixtures", filename))
27
+ content_type = /.csv$/.match?(filename) ? "text/csv" : "application/csvm+json"
28
+ stub_request(:get, url).to_return(status: 200, body: content, headers: {"Content-Type" => "#{content_type}; charset=UTF-8"})
29
29
  end
30
30
 
31
31
  Given(/^there is no file at the url "(.*?)"$/) do |url|
32
- stub_request(:get, url).to_return(:status => 404)
33
- end
32
+ stub_request(:get, url).to_return(status: 404)
33
+ end
@@ -3,5 +3,5 @@ Given(/^it is parsed as a StringIO$/) do
3
3
  end
4
4
 
5
5
  Given(/^I parse a file called "(.*?)"$/) do |filename|
6
- @url = File.new( File.join( File.dirname(__FILE__), "..", "fixtures", filename ) )
6
+ @url = File.new(File.join(File.dirname(__FILE__), "..", "fixtures", filename))
7
7
  end
@@ -2,14 +2,14 @@ When(/^I ask if there are errors$/) do
2
2
  @csv_options ||= default_csv_options
3
3
 
4
4
  if @schema_json
5
- if @schema_type == :json_table
6
- @schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
5
+ @schema = if @schema_type == :json_table
6
+ Csvlint::Schema.from_json_table(@schema_url || "http://example.org ", JSON.parse(@schema_json))
7
7
  else
8
- @schema = Csvlint::Schema.from_csvw_metadata( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
8
+ Csvlint::Schema.from_csvw_metadata(@schema_url || "http://example.org ", JSON.parse(@schema_json))
9
9
  end
10
10
  end
11
11
 
12
- @validator = Csvlint::Validator.new( @url, @csv_options, @schema )
12
+ @validator = Csvlint::Validator.new(@url, @csv_options, @schema)
13
13
  @errors = @validator.errors
14
14
  end
15
15
 
@@ -19,10 +19,10 @@ When(/^I carry out CSVW validation$/) do
19
19
  begin
20
20
  if @schema_json
21
21
  json = JSON.parse(@schema_json)
22
- if @schema_type == :json_table
23
- @schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", json )
22
+ @schema = if @schema_type == :json_table
23
+ Csvlint::Schema.from_json_table(@schema_url || "http://example.org ", json)
24
24
  else
25
- @schema = Csvlint::Schema.from_csvw_metadata( @schema_url || "http://example.org ", json )
25
+ Csvlint::Schema.from_csvw_metadata(@schema_url || "http://example.org ", json)
26
26
  end
27
27
  end
28
28
 
@@ -30,12 +30,12 @@ When(/^I carry out CSVW validation$/) do
30
30
  @errors = []
31
31
  @warnings = []
32
32
  @schema.tables.keys.each do |table_url|
33
- validator = Csvlint::Validator.new( table_url, @csv_options, @schema )
33
+ validator = Csvlint::Validator.new(table_url, @csv_options, @schema)
34
34
  @errors += validator.errors
35
35
  @warnings += validator.warnings
36
36
  end
37
37
  else
38
- validator = Csvlint::Validator.new( @url, @csv_options, @schema )
38
+ validator = Csvlint::Validator.new(@url, @csv_options, @schema)
39
39
  @errors = validator.errors
40
40
  @warnings = validator.warnings
41
41
  end
@@ -49,42 +49,42 @@ end
49
49
  Then(/^there should be errors$/) do
50
50
  # this test is only used for CSVW testing; :invalid_encoding & :line_breaks mask lack of real errors
51
51
  @errors.delete_if { |e| e.instance_of?(Csvlint::ErrorMessage) && [:invalid_encoding, :line_breaks].include?(e.type) }
52
- expect( @errors.count ).to be > 0
52
+ expect(@errors.count).to be > 0
53
53
  end
54
54
 
55
55
  Then(/^there should not be errors$/) do
56
- expect( @errors.count ).to eq(0)
56
+ expect(@errors.count).to eq(0)
57
57
  end
58
58
 
59
59
  Then(/^there should be (\d+) error$/) do |count|
60
- expect( @errors.count ).to eq( count.to_i )
60
+ expect(@errors.count).to eq(count.to_i)
61
61
  end
62
62
 
63
63
  Then(/^that error should have the type "(.*?)"$/) do |type|
64
- expect( @errors.first.type ).to eq( type.to_sym )
64
+ expect(@errors.first.type).to eq(type.to_sym)
65
65
  end
66
66
 
67
67
  Then(/^that error should have the row "(.*?)"$/) do |row|
68
- expect( @errors.first.row ).to eq( row.to_i )
68
+ expect(@errors.first.row).to eq(row.to_i)
69
69
  end
70
70
 
71
71
  Then(/^that error should have the column "(.*?)"$/) do |column|
72
- expect( @errors.first.column ).to eq( column.to_i )
72
+ expect(@errors.first.column).to eq(column.to_i)
73
73
  end
74
74
 
75
75
  Then(/^that error should have the content "(.*)"$/) do |content|
76
- expect( @errors.first.content.chomp ).to eq( content.chomp )
76
+ expect(@errors.first.content.chomp).to eq(content.chomp)
77
77
  end
78
78
 
79
79
  Then(/^that error should have no content$/) do
80
- expect( @errors.first.content ).to eq( nil )
80
+ expect(@errors.first.content).to eq(nil)
81
81
  end
82
82
 
83
83
  Given(/^I have a CSV that doesn't exist$/) do
84
84
  @url = "http//www.example.com/fake-csv.csv"
85
- stub_request(:get, @url).to_return(:status => 404)
85
+ stub_request(:get, @url).to_return(status: 404)
86
86
  end
87
87
 
88
88
  Then(/^there should be no "(.*?)" errors$/) do |type|
89
- @errors.each do |error| error.type.should_not == type.to_sym end
89
+ @errors.each { |error| error.type.should_not == type.to_sym }
90
90
  end
@@ -1,22 +1,22 @@
1
1
  Given(/^I ask if there are info messages$/) do
2
2
  @csv_options ||= default_csv_options
3
-
3
+
4
4
  if @schema_json
5
- if @schema_type == :json_table
6
- @schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
5
+ @schema = if @schema_type == :json_table
6
+ Csvlint::Schema.from_json_table(@schema_url || "http://example.org ", JSON.parse(@schema_json))
7
7
  else
8
- @schema = Csvlint::Schema.from_csvw_metadata( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
8
+ Csvlint::Schema.from_csvw_metadata(@schema_url || "http://example.org ", JSON.parse(@schema_json))
9
9
  end
10
10
  end
11
-
12
- @validator = Csvlint::Validator.new( @url, @csv_options, @schema )
11
+
12
+ @validator = Csvlint::Validator.new(@url, @csv_options, @schema)
13
13
  @info_messages = @validator.info_messages
14
14
  end
15
15
 
16
16
  Then(/^there should be (\d+) info messages?$/) do |num|
17
- expect( @info_messages.count ).to eq( num.to_i )
17
+ expect(@info_messages.count).to eq(num.to_i)
18
18
  end
19
19
 
20
20
  Then(/^one of the messages should have the type "(.*?)"$/) do |msg_type|
21
- expect( @info_messages.find{|x| x.type == msg_type.to_sym} ).to be_present
22
- end
21
+ expect(@info_messages.find { |x| x.type == msg_type.to_sym }).to be_present
22
+ end
@@ -12,35 +12,35 @@ Given(/^I do not set an encoding header$/) do
12
12
  end
13
13
 
14
14
  Given(/^I have a CSV file called "(.*?)"$/) do |filename|
15
- @csv = File.read( File.join( File.dirname(__FILE__), "..", "fixtures", filename ) )
15
+ @csv = File.read(File.join(File.dirname(__FILE__), "..", "fixtures", filename))
16
16
  end
17
17
 
18
18
  When(/^I ask if there are warnings$/) do
19
19
  @csv_options ||= default_csv_options
20
20
  if @schema_json
21
- if @schema_type == :json_table
22
- @schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
21
+ @schema = if @schema_type == :json_table
22
+ Csvlint::Schema.from_json_table(@schema_url || "http://example.org ", JSON.parse(@schema_json))
23
23
  else
24
- @schema = Csvlint::Schema.from_csvw_metadata( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
24
+ Csvlint::Schema.from_csvw_metadata(@schema_url || "http://example.org ", JSON.parse(@schema_json))
25
25
  end
26
26
  end
27
27
 
28
- @validator = Csvlint::Validator.new( @url, @csv_options, @schema )
28
+ @validator = Csvlint::Validator.new(@url, @csv_options, @schema)
29
29
  @warnings = @validator.warnings
30
30
  end
31
31
 
32
32
  Then(/^there should be warnings$/) do
33
- expect( @warnings.count ).to be > 0
33
+ expect(@warnings.count).to be > 0
34
34
  end
35
35
 
36
36
  Then(/^there should not be warnings$/) do
37
37
  # this test is only used for CSVW testing, and :inconsistent_values warnings don't count in CSVW
38
38
  @warnings.delete_if { |w| [:inconsistent_values, :check_options].include?(w.type) }
39
- expect( @warnings.count ).to eq(0)
39
+ expect(@warnings.count).to eq(0)
40
40
  end
41
41
 
42
42
  Then(/^there should be (\d+) warnings$/) do |count|
43
- expect( @warnings.count ).to eq( count.to_i )
43
+ expect(@warnings.count).to eq(count.to_i)
44
44
  end
45
45
 
46
46
  Given(/^the content type is set to "(.*?)"$/) do |type|
@@ -48,13 +48,13 @@ Given(/^the content type is set to "(.*?)"$/) do |type|
48
48
  end
49
49
 
50
50
  Then(/^that warning should have the row "(.*?)"$/) do |row|
51
- expect( @warnings.first.row ).to eq( row.to_i )
51
+ expect(@warnings.first.row).to eq(row.to_i)
52
52
  end
53
53
 
54
54
  Then(/^that warning should have the column "(.*?)"$/) do |column|
55
- expect( @warnings.first.column ).to eq( column.to_i )
55
+ expect(@warnings.first.column).to eq(column.to_i)
56
56
  end
57
57
 
58
58
  Then(/^that warning should have the type "(.*?)"$/) do |type|
59
- expect( @warnings.first.type ).to eq( type.to_sym )
59
+ expect(@warnings.first.type).to eq(type.to_sym)
60
60
  end
@@ -1,12 +1,12 @@
1
- require 'aruba'
2
- require 'aruba/cucumber'
1
+ require "aruba"
2
+ require "aruba/cucumber"
3
3
 
4
- require 'csvlint/cli'
4
+ require "csvlint/cli"
5
5
 
6
6
  module Csvlint
7
7
  class CliRunner
8
8
  # Allow everything fun to be injected from the outside while defaulting to normal implementations.
9
- def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
9
+ def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel)
10
10
  @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
11
11
  end
12
12
 
@@ -22,11 +22,11 @@ module Csvlint
22
22
 
23
23
  # Thor::Base#start does not have a return value, assume success if no exception is raised.
24
24
  0
25
- rescue StandardError => e
25
+ rescue => e
26
26
  # The ruby interpreter would pipe this to STDERR and exit 1 in the case of an unhandled exception
27
27
  b = e.backtrace
28
28
  @stderr.puts("#{b.shift}: #{e.message} (#{e.class})")
29
- @stderr.puts(b.map{|s| "\tfrom #{s}"}.join("\n"))
29
+ @stderr.puts(b.map { |s| "\tfrom #{s}" }.join("\n"))
30
30
  1
31
31
  rescue SystemExit => e
32
32
  e.status
@@ -1,33 +1,33 @@
1
- require 'rdf'
2
- require 'rdf/turtle'
1
+ require "rdf"
2
+ require "rdf/turtle"
3
3
 
4
4
  class EarlFormatter
5
5
  def initialize(step_mother, io, options)
6
6
  output = RDF::Resource.new("")
7
7
  @graph = RDF::Graph.new
8
- @graph << [ CSVLINT, RDF.type, RDF::DOAP.Project ]
9
- @graph << [ CSVLINT, RDF.type, EARL.TestSubject ]
10
- @graph << [ CSVLINT, RDF.type, EARL.Software ]
11
- @graph << [ CSVLINT, RDF::DOAP.name, "csvlint" ]
12
- @graph << [ CSVLINT, RDF::DC.title, "csvlint" ]
13
- @graph << [ CSVLINT, RDF::DOAP.description, "CSV validator" ]
14
- @graph << [ CSVLINT, RDF::DOAP.homepage, RDF::Resource.new("https://github.com/theodi/csvlint.rb") ]
15
- @graph << [ CSVLINT, RDF::DOAP.license, RDF::Resource.new("https://raw.githubusercontent.com/theodi/csvlint.rb/master/LICENSE.md") ]
16
- @graph << [ CSVLINT, RDF::DOAP["programming-language"], "Ruby" ]
17
- @graph << [ CSVLINT, RDF::DOAP.implements, RDF::Resource.new("http://www.w3.org/TR/tabular-data-model/") ]
18
- @graph << [ CSVLINT, RDF::DOAP.implements, RDF::Resource.new("http://www.w3.org/TR/tabular-metadata/") ]
19
- @graph << [ CSVLINT, RDF::DOAP.developer, ODI ]
20
- @graph << [ CSVLINT, RDF::DOAP.maintainer, ODI ]
21
- @graph << [ CSVLINT, RDF::DOAP.documenter, ODI ]
22
- @graph << [ CSVLINT, RDF::FOAF.maker, ODI ]
23
- @graph << [ CSVLINT, RDF::DC.creator, ODI ]
24
- @graph << [ output, RDF::FOAF["primaryTopic"], CSVLINT ]
25
- @graph << [ output, RDF::DC.issued, DateTime.now ]
26
- @graph << [ output, RDF::FOAF.maker, ODI ]
27
- @graph << [ ODI, RDF.type, RDF::FOAF.Organization ]
28
- @graph << [ ODI, RDF.type, EARL.Assertor ]
29
- @graph << [ ODI, RDF::FOAF.name, "Open Data Institute" ]
30
- @graph << [ ODI, RDF::FOAF.homepage, "https://theodi.org/" ]
8
+ @graph << [CSVLINT, RDF.type, RDF::DOAP.Project]
9
+ @graph << [CSVLINT, RDF.type, EARL.TestSubject]
10
+ @graph << [CSVLINT, RDF.type, EARL.Software]
11
+ @graph << [CSVLINT, RDF::DOAP.name, "csvlint"]
12
+ @graph << [CSVLINT, RDF::DC.title, "csvlint"]
13
+ @graph << [CSVLINT, RDF::DOAP.description, "CSV validator"]
14
+ @graph << [CSVLINT, RDF::DOAP.homepage, RDF::Resource.new("https://github.com/theodi/csvlint.rb")]
15
+ @graph << [CSVLINT, RDF::DOAP.license, RDF::Resource.new("https://raw.githubusercontent.com/theodi/csvlint.rb/master/LICENSE.md")]
16
+ @graph << [CSVLINT, RDF::DOAP["programming-language"], "Ruby"]
17
+ @graph << [CSVLINT, RDF::DOAP.implements, RDF::Resource.new("http://www.w3.org/TR/tabular-data-model/")]
18
+ @graph << [CSVLINT, RDF::DOAP.implements, RDF::Resource.new("http://www.w3.org/TR/tabular-metadata/")]
19
+ @graph << [CSVLINT, RDF::DOAP.developer, ODI]
20
+ @graph << [CSVLINT, RDF::DOAP.maintainer, ODI]
21
+ @graph << [CSVLINT, RDF::DOAP.documenter, ODI]
22
+ @graph << [CSVLINT, RDF::FOAF.maker, ODI]
23
+ @graph << [CSVLINT, RDF::DC.creator, ODI]
24
+ @graph << [output, RDF::FOAF["primaryTopic"], CSVLINT]
25
+ @graph << [output, RDF::DC.issued, DateTime.now]
26
+ @graph << [output, RDF::FOAF.maker, ODI]
27
+ @graph << [ODI, RDF.type, RDF::FOAF.Organization]
28
+ @graph << [ODI, RDF.type, EARL.Assertor]
29
+ @graph << [ODI, RDF::FOAF.name, "Open Data Institute"]
30
+ @graph << [ODI, RDF::FOAF.homepage, "https://theodi.org/"]
31
31
  end
32
32
 
33
33
  def scenario_name(keyword, name, file_colon_line, source_indent)
@@ -40,27 +40,27 @@ class EarlFormatter
40
40
  passed = false unless s.status == :passed
41
41
  end
42
42
  a = RDF::Node.new
43
- @graph << [ a, RDF.type, EARL.Assertion ]
44
- @graph << [ a, EARL.assertedBy, ODI ]
45
- @graph << [ a, EARL.subject, CSVLINT ]
46
- @graph << [ a, EARL.test, @test ]
47
- @graph << [ a, EARL.mode, EARL.automatic ]
43
+ @graph << [a, RDF.type, EARL.Assertion]
44
+ @graph << [a, EARL.assertedBy, ODI]
45
+ @graph << [a, EARL.subject, CSVLINT]
46
+ @graph << [a, EARL.test, @test]
47
+ @graph << [a, EARL.mode, EARL.automatic]
48
48
  r = RDF::Node.new
49
- @graph << [ a, EARL.result, r ]
50
- @graph << [ r, RDF.type, EARL.TestResult ]
51
- @graph << [ r, EARL.outcome, passed ? EARL.passed : EARL.failed ]
52
- @graph << [ r, RDF::DC.date, DateTime.now ]
49
+ @graph << [a, EARL.result, r]
50
+ @graph << [r, RDF.type, EARL.TestResult]
51
+ @graph << [r, EARL.outcome, passed ? EARL.passed : EARL.failed]
52
+ @graph << [r, RDF::DC.date, DateTime.now]
53
53
  end
54
54
 
55
55
  def after_features(features)
56
- RDF::Writer.for(:ttl).open("csvlint-earl.ttl", { :prefixes => { "earl" => EARL }, :standard_prefixes => true, :canonicalize => true, :literal_shorthand => true }) do |writer|
56
+ RDF::Writer.for(:ttl).open("csvlint-earl.ttl", {prefixes: {"earl" => EARL}, standard_prefixes: true, canonicalize: true, literal_shorthand: true}) do |writer|
57
57
  writer << @graph
58
- end
58
+ end
59
59
  end
60
60
 
61
61
  private
62
- EARL = RDF::Vocabulary.new("http://www.w3.org/ns/earl#")
63
- ODI = RDF::Resource.new("https://theodi.org/")
64
- CSVLINT = RDF::Resource.new("https://github.com/theodi/csvlint.rb")
65
62
 
63
+ EARL = RDF::Vocabulary.new("http://www.w3.org/ns/earl#")
64
+ ODI = RDF::Resource.new("https://theodi.org/")
65
+ CSVLINT = RDF::Resource.new("https://github.com/theodi/csvlint.rb")
66
66
  end
@@ -1,23 +1,22 @@
1
- require 'coveralls'
2
- Coveralls.wear_merged!('test_frameworks')
1
+ require "coveralls"
2
+ Coveralls.wear_merged!("test_frameworks")
3
3
 
4
- $:.unshift File.join( File.dirname(__FILE__), "..", "..", "lib")
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
5
5
 
6
- require 'rspec/expectations'
7
- require 'cucumber/rspec/doubles'
8
- require 'csvlint'
9
- require 'byebug'
6
+ require "rspec/expectations"
7
+ require "cucumber/rspec/doubles"
8
+ require "csvlint"
9
+ require "byebug"
10
10
 
11
- require 'spork'
11
+ require "spork"
12
12
 
13
13
  Spork.each_run do
14
- require 'csvlint'
14
+ require "csvlint"
15
15
  end
16
16
 
17
17
  class CustomWorld
18
18
  def default_csv_options
19
- return {
20
- }
19
+ {}
21
20
  end
22
21
  end
23
22