Skip to content

Commit

Permalink
Replace 'line' with 'row' when referring to the CSV file
Browse files Browse the repository at this point in the history
  • Loading branch information
techncl committed Feb 7, 2025
1 parent 30dedd3 commit fc9d8cd
Show file tree
Hide file tree
Showing 33 changed files with 212 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class RowIterator(parser: CsvParser, progress: Option[ProgressFor], maxCharsPerC
case Failure(ex: TextParsingException) if(ex.toString.contains("exceeds the maximum number of characters")) =>
val cellLocationMsg =
potentialHeaderRow match {
case Some(headerRow) => s"in the cell located at line: ${ex.getLineIndex}, column: ${headerRow.cells(ex.getColumnIndex).value},"
case Some(headerRow) => s"in the cell located at row: ${ex.getLineIndex}, column: ${headerRow.cells(ex.getColumnIndex).value},"
case None => s"in column ${ex.getColumnIndex + 1} of the header row"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ abstract class Rule(name: String, val argProviders: ArgProvider*) extends Positi

def fail(columnIndex: Int, row: Row, schema: Schema): RuleValidation[Any] = {
val columnDefinition = schema.columnDefinitions(columnIndex)
s"$toError fails for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
s"$toError fails for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
}

def cellValue(columnIndex: Int, row: Row, schema: Schema): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ case class UniqueRule() extends Rule("unique") {
originalValue match {
case None => distinctValues.put(cellValueCorrectCase, row.lineNumber); true.validNel
case Some(o) => {
s"$toError fails for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)} (original at line: ${distinctValues(o)})".invalidNel[Any]
s"$toError fails for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)} (original at row: ${distinctValues(o)})".invalidNel[Any]
}
}
}
Expand All @@ -304,7 +304,7 @@ case class UniqueMultiRule(columns: List[ColumnReference]) extends Rule("unique(
originalValue match {
case None => distinctValues.put(cellValueCorrectCase, row.lineNumber); true.validNel
case Some(o) => {
s"$toError ${columns.map(_.toError).mkString(", ")} ) fails for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)} (original at line: ${distinctValues(o)})".invalidNel[Any]
s"$toError ${columns.map(_.toError).mkString(", ")} ) fails for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)} (original at row: ${distinctValues(o)})".invalidNel[Any]
}
}
}
Expand All @@ -322,8 +322,8 @@ case class ChecksumRule(rootPath: ArgProvider, file: ArgProvider, algorithm: Str
} else {
search(filename(columnIndex, row, schema)) match {
case Validated.Valid(hexValue: String) if hexValue == cellValue(columnIndex, row, schema) => true.validNel[String]
case Validated.Valid(hexValue: String) => s"""$toError file "${TypedPath(filename(columnIndex, row, schema)._1 + filename(columnIndex, row, schema)._2).toPlatform}" checksum match fails for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row, columnIndex)}. Computed checksum value:"${hexValue}"""".invalidNel[Any]
case Validated.Invalid(errMsg) => s"$toError ${errMsg.head} for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row, columnIndex)}".invalidNel[Any]
case Validated.Valid(hexValue: String) => s"""$toError file "${TypedPath(filename(columnIndex, row, schema)._1 + filename(columnIndex, row, schema)._2).toPlatform}" checksum match fails for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row, columnIndex)}. Computed checksum value:"${hexValue}"""".invalidNel[Any]
case Validated.Invalid(errMsg) => s"$toError ${errMsg.head} for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row, columnIndex)}".invalidNel[Any]
}
}
}
Expand Down Expand Up @@ -458,11 +458,11 @@ case class FileCountRule(rootPath: ArgProvider, file: ArgProvider, pathSubstitut
case scala.util.Success(cellCount) =>
search(filename(columnIndex, row, schema)) match {
case Validated.Valid(count: Int) if count == cellCount => true.validNel[String]
case Validated.Valid(count: Int) => s"$toError found $count file(s) for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
case Validated.Invalid(errMsg) => s"$toError ${errMsg.head} for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
case Validated.Valid(count: Int) => s"$toError found $count file(s) for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
case Validated.Invalid(errMsg) => s"$toError ${errMsg.head} for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
}

case scala.util.Failure(_) => s"$toError '${cellValue(columnIndex,row,schema)}' is not a number for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
case scala.util.Failure(_) => s"$toError '${cellValue(columnIndex,row,schema)}' is not a number for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${toValueError(row,columnIndex)}".invalidNel[Any]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ case class IntegrityCheckRule(pathSubstitutions: List[(String,String)], enforceC
catch {
case ex: FileNotFoundException =>
val columnDefinition = schema.columnDefinitions(columnIndex)
s"$toError fails for line: ${row.lineNumber}, column: ${columnDefinition.id}, ${ex.getMessage} with substitution paths ${pathSubstitutions.mkString(", ")}".invalidNel[Any]
s"$toError fails for row: ${row.lineNumber}, column: ${columnDefinition.id}, ${ex.getMessage} with substitution paths ${pathSubstitutions.mkString(", ")}".invalidNel[Any]
}
}

Expand Down
Loading

0 comments on commit fc9d8cd

Please sign in to comment.