From fdd80ad9ff4d7355afb11a6a215b40ff6046eeb4 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Wed, 17 Jan 2024 07:51:19 +0900 Subject: [PATCH] detect enum in FileNameConsistent --- input/src/main/scala-3/fix/FileNameConsistentTest2.scala | 9 +++++++++ rules/src/main/scala/fix/FileNameConsistent.scala | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 input/src/main/scala-3/fix/FileNameConsistentTest2.scala diff --git a/input/src/main/scala-3/fix/FileNameConsistentTest2.scala b/input/src/main/scala-3/fix/FileNameConsistentTest2.scala new file mode 100644 index 0000000..23333f7 --- /dev/null +++ b/input/src/main/scala-3/fix/FileNameConsistentTest2.scala @@ -0,0 +1,9 @@ +/* +rule = FileNameConsistent + */ +package fix + +enum MyTopLevelEnum { // assert: FileNameConsistent + case X1(x: Int) + case X2(x: String) +} diff --git a/rules/src/main/scala/fix/FileNameConsistent.scala b/rules/src/main/scala/fix/FileNameConsistent.scala index 2ab1eb6..e66551e 100644 --- a/rules/src/main/scala/fix/FileNameConsistent.scala +++ b/rules/src/main/scala/fix/FileNameConsistent.scala @@ -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)