Skip to content

Commit

Permalink
wip DirectoryAndPackageName
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jan 9, 2024
1 parent 32e43b3 commit 2b4d4e8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rules/src/main/scala/fix/DirectoryAndPackageName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class DirectoryAndPackageName(config: DirectoryAndPackageNameConfig) extends Syn
dirOpt = config.baseDirectory.find { dir =>
path.contains(dir)
}.map { dir =>
path.split(dir).last.split('/').init.mkString("/")
path.split(dir).last.split('/').init.toList
}
dir <- dirOpt
if packages.nonEmpty // TODO check if empty package
Expand All @@ -166,10 +166,9 @@ class DirectoryAndPackageName(config: DirectoryAndPackageNameConfig) extends Syn
if (keywords(p)) { p.replace("`", "") }
else p
)
.mkString("/")
packageObjectOpt match {
case Some(value) =>
x + "/" + value.name.value
x :+ value.name.value
case None =>
x
}
Expand All @@ -179,7 +178,7 @@ class DirectoryAndPackageName(config: DirectoryAndPackageNameConfig) extends Syn
Patch.lint(
Diagnostic(
id = "",
message = s"inconsistent package and directory\n${path}\n${packageName}",
message = s"inconsistent package and directory\n${path}\n${packageName.mkString("/")}",
position = packages.last.pos,
severity = config.severity
)
Expand Down

0 comments on commit 2b4d4e8

Please sign in to comment.