diff --git a/.standard_todo.yml b/.standard_todo.yml index 79f2be0..559a4fc 100644 --- a/.standard_todo.yml +++ b/.standard_todo.yml @@ -39,5 +39,3 @@ ignore: - Lint/UselessRescue - lib/csvlint/validate.rb: - Lint/UselessRescue -- lib/csvlint/cli.rb: - - Style/SafeNavigation diff --git a/lib/csvlint/cli.rb b/lib/csvlint/cli.rb index 03694db..7d4edef 100644 --- a/lib/csvlint/cli.rb +++ b/lib/csvlint/cli.rb @@ -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 @@ -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