Skip to content

Commit 8e7de8d

Browse files
authored
Fix parsing bug (#106)
1 parent b330ae9 commit 8e7de8d

File tree

3 files changed

+16
-83
lines changed

3 files changed

+16
-83
lines changed

generated/avg-maintainability.svg

Lines changed: 4 additions & 4 deletions
Loading

samples/sweetalert/expected.json

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,70 +1037,14 @@
10371037
"filename": "docs",
10381038
"shouldAnalyze": true,
10391039
"type": "dir",
1040-
"files": [
1041-
{
1042-
"fullPath": "/samples/sweetalert/docs/CNAME",
1043-
"filename": "CNAME",
1044-
"shouldAnalyze": false,
1045-
"path": "/samples/sweetalert/docs",
1046-
"type": "file",
1047-
"complexityReport": null,
1048-
"timesDependedOn": 0
1049-
},
1050-
{
1051-
"fullPath": "/samples/sweetalert/docs/index.html",
1052-
"filename": "index.html",
1053-
"shouldAnalyze": false,
1054-
"path": "/samples/sweetalert/docs",
1055-
"type": "file",
1056-
"complexityReport": null,
1057-
"timesDependedOn": 0
1058-
}
1059-
]
1040+
"files": []
10601041
},
10611042
{
10621043
"fullPath": "/samples/sweetalert/docs-src",
10631044
"filename": "docs-src",
10641045
"shouldAnalyze": true,
10651046
"type": "dir",
1066-
"files": [
1067-
{
1068-
"fullPath": "/samples/sweetalert/docs-src/index.hbs",
1069-
"filename": "index.hbs",
1070-
"shouldAnalyze": false,
1071-
"path": "/samples/sweetalert/docs-src",
1072-
"type": "file",
1073-
"complexityReport": null,
1074-
"timesDependedOn": 0
1075-
},
1076-
{
1077-
"fullPath": "/samples/sweetalert/docs-src/layout-docs.hbs",
1078-
"filename": "layout-docs.hbs",
1079-
"shouldAnalyze": false,
1080-
"path": "/samples/sweetalert/docs-src",
1081-
"type": "file",
1082-
"complexityReport": null,
1083-
"timesDependedOn": 0
1084-
},
1085-
{
1086-
"fullPath": "/samples/sweetalert/docs-src/layout-guides.hbs",
1087-
"filename": "layout-guides.hbs",
1088-
"shouldAnalyze": false,
1089-
"path": "/samples/sweetalert/docs-src",
1090-
"type": "file",
1091-
"complexityReport": null,
1092-
"timesDependedOn": 0
1093-
},
1094-
{
1095-
"fullPath": "/samples/sweetalert/docs-src/layout.hbs",
1096-
"filename": "layout.hbs",
1097-
"shouldAnalyze": false,
1098-
"path": "/samples/sweetalert/docs-src",
1099-
"type": "file",
1100-
"complexityReport": null,
1101-
"timesDependedOn": 0
1102-
}
1103-
]
1047+
"files": []
11041048
},
11051049
{
11061050
"fullPath": "/samples/sweetalert/src",
@@ -2211,26 +2155,7 @@
22112155
"filename": "typings",
22122156
"shouldAnalyze": true,
22132157
"type": "dir",
2214-
"files": [
2215-
{
2216-
"fullPath": "/samples/sweetalert/typings/core.d.ts",
2217-
"filename": "core.d.ts",
2218-
"shouldAnalyze": false,
2219-
"path": "/samples/sweetalert/typings",
2220-
"type": "file",
2221-
"complexityReport": null,
2222-
"timesDependedOn": 0
2223-
},
2224-
{
2225-
"fullPath": "/samples/sweetalert/typings/sweetalert.d.ts",
2226-
"filename": "sweetalert.d.ts",
2227-
"shouldAnalyze": false,
2228-
"path": "/samples/sweetalert/typings",
2229-
"type": "file",
2230-
"complexityReport": null,
2231-
"timesDependedOn": 0
2232-
}
2233-
]
2158+
"files": []
22342159
},
22352160
{
22362161
"fullPath": "/samples/sweetalert/expected.json",

src/utils/entities.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ const shouldSkipDir = (
1111
skipDirectories: string[]
1212
): boolean => {
1313
for (let i = 0; i < skipDirectories.length; i += 1) {
14-
if (relativeDir.startsWith(skipDirectories[i])) {
14+
if (
15+
relativeDir.startsWith(skipDirectories[i]) ||
16+
`${relativeDir}/`.startsWith(skipDirectories[i])
17+
) {
1518
return true
1619
}
1720
}
@@ -74,6 +77,11 @@ export const shouldSeeEntity = ({
7477
return false
7578
}
7679

80+
// Is it a file in a directory that should be skipped?
81+
if (shouldSkipDir(relativeDir, options.skipDirectories)) {
82+
return false
83+
}
84+
7785
return true
7886
}
7987

0 commit comments

Comments
 (0)