Skip to content

Commit

Permalink
Merge pull request #303 from D-system/standardrb-new-safe-operator
Browse files Browse the repository at this point in the history
Syntax: use safe operator
  • Loading branch information
Floppy authored Nov 27, 2024
2 parents 4d8a9b6 + d2739cf commit f01abb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/csvlint/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def print_error(index, error, dump, color)
location = "#{error.row ? "Row" : "Column"}: #{location}"
end
output_string = "#{index + 1}. "
if error.column && @schema && @schema.instance_of?(Csvlint::Schema)
if error.column && @schema&.instance_of?(Csvlint::Schema)
unless @schema.fields[error.column - 1].nil?
output_string += "#{@schema.fields[error.column - 1].name}: "
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&.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 f01abb1

Please sign in to comment.