Skip to content

Commit

Permalink
small adjustments for excluding directories with less than 5 single f…
Browse files Browse the repository at this point in the history
…iles #3653
  • Loading branch information
Nadine Schatz committed Jul 8, 2024
1 parent cc1f55d commit 81ce1b9
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,14 @@ export class StreetLayoutGenerator {
const children: BoundingBox[] = []
const areaMetric = state.dynamicSettings.areaMetric
for (let child of node.children) {
if (isPathBlacklisted(child.path, state.fileSettings.blacklist, "exclude")) {
continue
}
if (isLeaf(child)) {
children.push(new House(child))
continue
}
if (child.type === NodeType.FOLDER && child.children && child.children.length < 5) {
for (const file of child.children) {
if (file.type === NodeType.FILE) {
file.isExcluded = true
}
}
if (this.hasFewerThanFiveNonDirectoryFiles(child)) {
continue
}
if (this.areAllChildrenNodesExcluded(child)) {
if (isPathBlacklisted(child.path, state.fileSettings.blacklist, "exclude")) {
continue
}

Expand All @@ -88,13 +81,17 @@ export class StreetLayoutGenerator {
return children
}

private static areAllChildrenNodesExcluded(child: CodeMapNode): boolean {
for (let index = 0; index < child.children.length; index++) {
if (!child.children[index].isExcluded) {
return false
private static hasFewerThanFiveNonDirectoryFiles(node: CodeMapNode): boolean {
let nonDirectoryFileCount = 0
for (const child of node.children) {
if (child.type === NodeType.FOLDER) {
return false // Skip node if it contains files
}
if (child.type === NodeType.FILE) {
nonDirectoryFileCount++
}
}
return true
return nonDirectoryFileCount < 5
}

private static createStreet(node: CodeMapNode, orientation: StreetOrientation, children: BoundingBox[], depth: number) {
Expand Down

0 comments on commit 81ce1b9

Please sign in to comment.