Skip to content

Commit

Permalink
Merge pull request Data-Liberation-Front#293 from D-system/standardrb
Browse files Browse the repository at this point in the history
Update syntax for StandardRb (part 1)
  • Loading branch information
Floppy authored Mar 1, 2024
2 parents c311a74 + 45bf5e6 commit ecf60e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions .standard_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@
# Remove from this list as you refactor files.
---
ignore:
- features/step_definitions/validation_errors_steps.rb:
- Lint/Void
- features/support/load_tests.rb:
- Style/For
- Security/Open
- Lint/UselessAssignment
- lib/csvlint/cli.rb:
- Style/NonNilCheck
- lib/csvlint/csvw/column.rb:
- Style/TernaryParentheses
- lib/csvlint/csvw/date_format.rb:
Expand Down
8 changes: 4 additions & 4 deletions features/support/load_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def cache_file(filename)
unless File.exist?(file)
if filename.include? "/"
levels = filename.split("/")[0..-2]
for i in 0..levels.length
(0..levels.length).each do |i|
dir = File.join(BASE_PATH, levels[0..i].join("/"))
Dir.mkdir(dir) unless Dir.exist?(dir)
end
Expand All @@ -26,7 +26,7 @@ def cache_file(filename)
f.puts URI.open(uri, "rb").read
end
end
[uri, file]
uri
end

unless File.exist? SCRIPT_FILE_PATH
Expand Down Expand Up @@ -66,7 +66,7 @@ def cache_file(filename)
file.puts ""

manifest["entries"].each do |entry|
action_uri, action_file = cache_file(entry["action"])
action_uri = cache_file(entry["action"])
metadata = nil
provided_files = []
missing_files = []
Expand Down Expand Up @@ -98,7 +98,7 @@ def cache_file(filename)
missing_files << URI.join(action_uri, "csv-metadata.json").to_s
end
entry["implicit"]&.each do |implicit|
implicit_uri, implicit_file = cache_file(implicit)
implicit_uri = cache_file(implicit)
provided_files << implicit_uri.to_s
unless implicit_uri == metadata
file.puts "\t\tAnd I have a file called \"csvw/#{implicit}\" at the url \"#{implicit_uri}\""
Expand Down
4 changes: 2 additions & 2 deletions lib/csvlint/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def print_error(index, error, dump, color)
end
output_string = "#{index + 1}. "
if error.column && @schema && @schema.instance_of?(Csvlint::Schema)
if @schema.fields[error.column - 1] != nil
unless @schema.fields[error.column - 1].nil?
output_string += "#{@schema.fields[error.column - 1].name}: "
end
end
Expand Down Expand Up @@ -176,7 +176,7 @@ def hashify(error)
col: error.column
}

if error.column && @schema && @schema.instance_of?(Csvlint::Schema) && @schema.fields[error.column - 1] != nil
if error.column && @schema && @schema.instance_of?(Csvlint::Schema) && !@schema.fields[error.column - 1].nil?
field = @schema.fields[error.column - 1]
h[:header] = field.name
h[:constraints] = field.constraints.map { |k, v| [k.underscore, v] }.to_h
Expand Down

0 comments on commit ecf60e3

Please sign in to comment.