Skip to content

Commit

Permalink
Fix parsing bug (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgb-io authored Jun 29, 2022
1 parent b330ae9 commit 8e7de8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 83 deletions.
8 changes: 4 additions & 4 deletions generated/avg-maintainability.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 3 additions & 78 deletions samples/sweetalert/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -1037,70 +1037,14 @@
"filename": "docs",
"shouldAnalyze": true,
"type": "dir",
"files": [
{
"fullPath": "/samples/sweetalert/docs/CNAME",
"filename": "CNAME",
"shouldAnalyze": false,
"path": "/samples/sweetalert/docs",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
},
{
"fullPath": "/samples/sweetalert/docs/index.html",
"filename": "index.html",
"shouldAnalyze": false,
"path": "/samples/sweetalert/docs",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
}
]
"files": []
},
{
"fullPath": "/samples/sweetalert/docs-src",
"filename": "docs-src",
"shouldAnalyze": true,
"type": "dir",
"files": [
{
"fullPath": "/samples/sweetalert/docs-src/index.hbs",
"filename": "index.hbs",
"shouldAnalyze": false,
"path": "/samples/sweetalert/docs-src",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
},
{
"fullPath": "/samples/sweetalert/docs-src/layout-docs.hbs",
"filename": "layout-docs.hbs",
"shouldAnalyze": false,
"path": "/samples/sweetalert/docs-src",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
},
{
"fullPath": "/samples/sweetalert/docs-src/layout-guides.hbs",
"filename": "layout-guides.hbs",
"shouldAnalyze": false,
"path": "/samples/sweetalert/docs-src",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
},
{
"fullPath": "/samples/sweetalert/docs-src/layout.hbs",
"filename": "layout.hbs",
"shouldAnalyze": false,
"path": "/samples/sweetalert/docs-src",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
}
]
"files": []
},
{
"fullPath": "/samples/sweetalert/src",
Expand Down Expand Up @@ -2211,26 +2155,7 @@
"filename": "typings",
"shouldAnalyze": true,
"type": "dir",
"files": [
{
"fullPath": "/samples/sweetalert/typings/core.d.ts",
"filename": "core.d.ts",
"shouldAnalyze": false,
"path": "/samples/sweetalert/typings",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
},
{
"fullPath": "/samples/sweetalert/typings/sweetalert.d.ts",
"filename": "sweetalert.d.ts",
"shouldAnalyze": false,
"path": "/samples/sweetalert/typings",
"type": "file",
"complexityReport": null,
"timesDependedOn": 0
}
]
"files": []
},
{
"fullPath": "/samples/sweetalert/expected.json",
Expand Down
10 changes: 9 additions & 1 deletion src/utils/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const shouldSkipDir = (
skipDirectories: string[]
): boolean => {
for (let i = 0; i < skipDirectories.length; i += 1) {
if (relativeDir.startsWith(skipDirectories[i])) {
if (
relativeDir.startsWith(skipDirectories[i]) ||
`${relativeDir}/`.startsWith(skipDirectories[i])
) {
return true
}
}
Expand Down Expand Up @@ -74,6 +77,11 @@ export const shouldSeeEntity = ({
return false
}

// Is it a file in a directory that should be skipped?
if (shouldSkipDir(relativeDir, options.skipDirectories)) {
return false
}

return true
}

Expand Down

0 comments on commit 8e7de8d

Please sign in to comment.