Skip to content

Commit

Permalink
Remove id from paths to instances in style warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Sep 8, 2024
1 parent 049b464 commit 533c134
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ class StyleCheckIds(specs: ClassSpecs) extends PrecompileStep {
val existingName = sizeRefAttr.id.humanReadable
val goodName = s"len_${attr.id.humanReadable}"
if (existingName != goodName) {
// Add `id` for attributes in `seq`, do not add for instances
val path = attr match {
case _: AttrSpec => sizeRefAttr.path ++ List("id")
case _ => sizeRefAttr.path
}
Some(StyleWarningSizeLen(
goodName,
existingName,
attr.id.humanReadable,
ProblemCoords(path = Some(sizeRefAttr.path ++ List("id")))
ProblemCoords(path = Some(path))
))
} else {
None
Expand All @@ -61,11 +66,16 @@ class StyleCheckIds(specs: ClassSpecs) extends PrecompileStep {
val existingName = repeatExprRefAttr.id.humanReadable
val goodName = s"num_${attr.id.humanReadable}"
if (existingName != goodName) {
// Add `id` for attributes in `seq`, do not add for instances
val path = attr match {
case _: AttrSpec => repeatExprRefAttr.path ++ List("id")
case _ => repeatExprRefAttr.path
}
Some(StyleWarningRepeatExprNum(
goodName,
existingName,
attr.id.humanReadable,
ProblemCoords(path = Some(repeatExprRefAttr.path ++ List("id")))
ProblemCoords(path = Some(path))
))
} else {
None
Expand Down

0 comments on commit 533c134

Please sign in to comment.