Skip to content

Commit

Permalink
Fix Style/SafeNavigation
Browse files Browse the repository at this point in the history
  • Loading branch information
D-system committed Nov 23, 2024
1 parent b3e7283 commit d2739cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .standard_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ ignore:
- Lint/UselessRescue
- lib/csvlint/validate.rb:
- Lint/UselessRescue
- lib/csvlint/cli.rb:
- Style/SafeNavigation
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 d2739cf

Please sign in to comment.