Skip to content

Commit

Permalink
detect enum in FileNameConsistent
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jan 16, 2024
1 parent 91d4234 commit 950221d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions input/src/main/scala-3/fix/FileNameConsistentTest2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
rule = FileNameConsistent
*/
package fix

enum MyTopLevelEnum { // assert: FileNameConsistent
case X1(x: Int)
case X2(x: String)
}
2 changes: 2 additions & 0 deletions rules/src/main/scala/fix/FileNameConsistent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class FileNameConsistent extends SyntacticRule("FileNameConsistent") {
TemplateDef(x, x.name.value)
case x: Defn.Object if x.isTopLevel =>
TemplateDef(x, x.name.value)
case x: Defn.Enum if x.isTopLevel =>
TemplateDef(x, x.name.value)
}
val packageObjects = doc.tree.collect { case x: Pkg.Object =>
TemplateDef(x, x.name.value)
Expand Down

0 comments on commit 950221d

Please sign in to comment.