mbeckerle commented on code in PR #1422:
URL: https://github.com/apache/daffodil/pull/1422#discussion_r1945200241
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/Implicits.scala:
##########
@@ -28,7 +28,7 @@ import org.apache.daffodil.lib.xml.NS
object Implicits {
object ImplicitsSuppressUnusedImportWarning {
- def apply() = if (scala.math.random.isNaN()) Assert.impossible()
+ def apply() = if (scala.math.random().isNaN) Assert.impossible()
Review Comment:
Put the code coverage suppression comments around these.
##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/validation/XercesValidator.scala:
##########
@@ -57,7 +57,7 @@ object XercesValidatorFactory {
if (config.hasPath(XercesValidator.name))
config.getStringList(XercesValidator.name).asScala
else Seq.empty
- XercesValidator.fromFiles(schemaFiles)
+ XercesValidator.fromFiles(schemaFiles.toSeq)
Review Comment:
Ok, so what exactly are the rules about when you must have the "()" and when
not?
##########
daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/TunableGenerator.scala:
##########
@@ -352,12 +352,12 @@ class TunableEnumDefinition(
""".trim.stripMargin
private val scalaEnums = {
- val scalaEnumValues = allEnumerationValues.map { e => e.head.toUpper +
e.tail }
+ val scalaEnumValues = allEnumerationValues.map { e =>
s"${e.head.toUpper}${e.tail}" }
scalaEnumValues.map { e => s""" case object ${e} extends ${scalaType}""" }
}
private val values = {
- val scalaEnumValues = allEnumerationValues.map { e => e.head.toUpper +
e.tail }
+ val scalaEnumValues = allEnumerationValues.map { e =>
s"${e.head.toUpper}${e.tail}" }
Review Comment:
I'd prefer string concat not be done by string interpolations.
##########
daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/TunableGenerator.scala:
##########
@@ -352,12 +352,12 @@ class TunableEnumDefinition(
""".trim.stripMargin
private val scalaEnums = {
- val scalaEnumValues = allEnumerationValues.map { e => e.head.toUpper +
e.tail }
+ val scalaEnumValues = allEnumerationValues.map { e =>
s"${e.head.toUpper}${e.tail}" }
Review Comment:
If you are just concatenating strings then using "+" is clearer than the
string interpolation which I must read very carefully to see if a whitespace is
in there, or some other small characters.
##########
daffodil-propgen/src/main/scala/org/apache/daffodil/propGen/TunableGenerator.scala:
##########
@@ -316,7 +316,7 @@ class TunableEnumDefinition(
simpleTypeNode: scala.xml.Node
) {
private val nodeName = (simpleTypeNode \@ "name").stripPrefix("Tunable")
- private val scalaType = nodeName.head.toUpper + nodeName.tail
+ private val scalaType = s"${nodeName.head.toUpper}${nodeName.tail}"
Review Comment:
The string concat with + was clearer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]