Skip to content

Commit

Permalink
Simplify package.json filtering logic.
Browse files Browse the repository at this point in the history
Removed redundant filtering of hidden parent directories in ISPPanelPopulator and moved it to the FileManager helper. This centralizes the logic, reduces duplication, and ensures consistent file filtering throughout the codebase.
  • Loading branch information
thelooter committed Dec 20, 2024
1 parent 01862bf commit baae18e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ class FileManager(private val project: Project) {
)
}
}).filter { file ->
!file.path.contains("/node_modules/") && !file.path.contains("/.git/")
!file.path.contains("/node_modules/")
&& !file.path.contains("/.git/")
&& !file.parent.name.startsWith('.')
}.sortedBy { file ->
name.toRegex().find(file.path)?.range?.first ?: Int.MAX_VALUE
}.also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class ISPPanelPopulator(private val project: Project) {
CoroutineScope(SupervisorJob() + Dispatchers.Default).async {
return@async Pair(
SourceScanner.findShadcnImplementation(project),
FileManager.getInstance(project).getVirtualFilesByName("package.json")
.filter { !it.parent.name.startsWith('.') }.size
FileManager.getInstance(project).getVirtualFilesByName("package.json").size
)
}.asCompletableFuture().thenApplyAsync { (source, packageJsonCount) ->
log.info("Shadcn implementation detected: $source, package.json count: $packageJsonCount")
Expand Down

0 comments on commit baae18e

Please sign in to comment.