Skip to content

Commit a0d2ece

Browse files
authored
Update several dependencies, improve safety, add test script (#119)
* Update several dependencies * Update badges * Various safety and lint improvements These are required to satisfy some new dependencies which exposed some safety and linting issues that were previously being overlooked * Update test expectations, add script to automate that
1 parent 836db04 commit a0d2ece

25 files changed

+4997
-3365
lines changed

CONTRIBUTING.md

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ Note: the badges for codehawk-cli are tracked in git because
6262
- There is currently no 3rd party API that can fetch codehawk results remotely
6363
- There are no plans to expose codehawk results outside of a project
6464

65+
# Updating tests when changes result in materially different outputs
66+
67+
There is now a script to update all the static `expected.json` files: `yarn run test:updateexpectations`.
68+
69+
Note that this script runs "blind", i.e. assumes that the output is correct, and writes it to file, discarding whatever was there before. It's up to you to ensure that the changes are correct / valid.
70+
6571
## Releasing new versions
6672

6773
Note: currently, only the project owner (sgb-io) has access to publish new versions to npm.

generated/avg-maintainability.svg

+4-4
Loading

generated/worst-maintainability.svg

+4-4
Loading

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"test:coverage": "jest --coverage",
1818
"test:watch": "jest --watch",
1919
"test": "jest --testTimeout 15000",
20-
"verify": "yarn build && yarn test && yarn lint && yarn prettier && yarn reflect && yarn isclean"
20+
"verify": "yarn build && yarn test && yarn lint && yarn prettier && yarn reflect && yarn isclean",
21+
"test:updateexpectations": "ts-node --files src/updateExpectedOutputs.ts"
2122
},
2223
"author": "Sam Brown (https://github.com/sgb-io)",
2324
"repository": {
@@ -30,8 +31,8 @@
3031
},
3132
"license": "MIT",
3233
"dependencies": {
33-
"@babel/core": "^7.18.6",
34-
"@babel/plugin-transform-typescript": "^7.18.6",
34+
"@babel/core": "^7.20.12",
35+
"@babel/plugin-transform-typescript": "^7.20.7",
3536
"badgen": "^3.2.2",
3637
"flow-remove-types": "^2.111.3",
3738
"is-dotdir": "^1.0.1",
@@ -57,10 +58,11 @@
5758
"eslint-plugin-prettier": "^3.1.4",
5859
"eslint-plugin-promise": "4",
5960
"eslint-plugin-standard": "4",
60-
"jest": "^28.1.2",
61+
"jest": "^28.1.3",
6162
"np": "^7.6.2",
6263
"prettier": "^2.7.1",
63-
"ts-jest": "^28.0.5",
64+
"ts-jest": "^28.0.8",
65+
"ts-node": "^10.9.1",
6466
"typescript": "^4.7.4"
6567
},
6668
"files": [
+142-97
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,142 @@
1-
{
2-
"summary": {
3-
"average": 58.93321508519464,
4-
"median": 58.93321508519464,
5-
"worst": 58.93321508519464
6-
},
7-
"resultsList": [
8-
{
9-
"fullPath": "/samples/contains-some-bad-code/good-code.ts",
10-
"filename": "good-code.ts",
11-
"shouldAnalyze": true,
12-
"path": "/samples/contains-some-bad-code",
13-
"type": "file",
14-
"complexityReport": {
15-
"aggregate": {
16-
"cyclomatic": 11,
17-
"cyclomaticDensity": 37.931,
18-
"halstead": {
19-
"bugs": 0.217,
20-
"difficulty": 35.889,
21-
"effort": 23378.702,
22-
"length": 127,
23-
"time": 1298.817,
24-
"vocabulary": 35,
25-
"volume": 651.419,
26-
"operands": { "distinct": 18, "total": 76 },
27-
"operators": { "distinct": 17, "total": 51 }
28-
},
29-
"paramCount": 9,
30-
"sloc": { "logical": 29, "physical": 50 }
31-
},
32-
"dependencies": [],
33-
"errors": [],
34-
"lineEnd": 50,
35-
"lineStart": 1,
36-
"maintainability": 108.234,
37-
"codehawkScore": 58.93321508519464,
38-
"coverage": "0"
39-
},
40-
"timesDependedOn": 0
41-
}
42-
],
43-
"fullResultsTree": [
44-
{
45-
"fullPath": "/samples/contains-some-bad-code/bad-code.ts",
46-
"filename": "bad-code.ts",
47-
"shouldAnalyze": true,
48-
"path": "/samples/contains-some-bad-code",
49-
"type": "file",
50-
"complexityReport": null,
51-
"timesDependedOn": 0
52-
},
53-
{
54-
"fullPath": "/samples/contains-some-bad-code/expected.json",
55-
"filename": "expected.json",
56-
"shouldAnalyze": false,
57-
"path": "/samples/contains-some-bad-code",
58-
"type": "file",
59-
"complexityReport": null,
60-
"timesDependedOn": 0
61-
},
62-
{
63-
"fullPath": "/samples/contains-some-bad-code/good-code.ts",
64-
"filename": "good-code.ts",
65-
"shouldAnalyze": true,
66-
"path": "/samples/contains-some-bad-code",
67-
"type": "file",
68-
"complexityReport": {
69-
"aggregate": {
70-
"cyclomatic": 11,
71-
"cyclomaticDensity": 37.931,
72-
"halstead": {
73-
"bugs": 0.217,
74-
"difficulty": 35.889,
75-
"effort": 23378.702,
76-
"length": 127,
77-
"time": 1298.817,
78-
"vocabulary": 35,
79-
"volume": 651.419,
80-
"operands": { "distinct": 18, "total": 76 },
81-
"operators": { "distinct": 17, "total": 51 }
82-
},
83-
"paramCount": 9,
84-
"sloc": { "logical": 29, "physical": 50 }
85-
},
86-
"dependencies": [],
87-
"errors": [],
88-
"lineEnd": 50,
89-
"lineStart": 1,
90-
"maintainability": 108.234,
91-
"codehawkScore": 58.93321508519464,
92-
"coverage": "0"
93-
},
94-
"timesDependedOn": 0
95-
}
96-
]
97-
}
1+
{
2+
"options": {
3+
"badgesDirectory": [
4+
"/generated"
5+
],
6+
"extensions": [
7+
".js",
8+
".jsx",
9+
".ts",
10+
".tsx"
11+
],
12+
"excludeDirectories": [
13+
"/dist",
14+
"/bin",
15+
"/build"
16+
],
17+
"excludeExact": [],
18+
"excludeFilenames": [
19+
".d.ts",
20+
".min.js",
21+
".bundle.js"
22+
],
23+
"skipDirectories": [
24+
"/node_modules",
25+
"/flow-typed",
26+
"/coverage"
27+
],
28+
"minimumThreshold": 10,
29+
"cliOutputLimit": 25
30+
},
31+
"summary": {
32+
"average": 60.8132766099468,
33+
"median": 60.8132766099468,
34+
"worst": 60.8132766099468
35+
},
36+
"resultsList": [
37+
{
38+
"fullPath": "/samples/contains-some-bad-code/good-code.ts",
39+
"filename": "good-code.ts",
40+
"shouldAnalyze": true,
41+
"path": "/samples/contains-some-bad-code",
42+
"type": "file",
43+
"complexityReport": {
44+
"aggregate": {
45+
"cyclomatic": 11,
46+
"cyclomaticDensity": 37.931,
47+
"halstead": {
48+
"bugs": 0.217,
49+
"difficulty": 35.889,
50+
"effort": 23378.702,
51+
"length": 127,
52+
"time": 1298.817,
53+
"vocabulary": 35,
54+
"volume": 651.419,
55+
"operands": {
56+
"distinct": 18,
57+
"total": 76
58+
},
59+
"operators": {
60+
"distinct": 17,
61+
"total": 51
62+
}
63+
},
64+
"paramCount": 9,
65+
"sloc": {
66+
"logical": 29,
67+
"physical": 41
68+
}
69+
},
70+
"dependencies": [],
71+
"errors": [],
72+
"lineEnd": 41,
73+
"lineStart": 1,
74+
"maintainability": 108.234,
75+
"codehawkScore": 60.8132766099468,
76+
"coverage": "0"
77+
},
78+
"timesDependedOn": 0
79+
}
80+
],
81+
"fullResultsTree": [
82+
{
83+
"fullPath": "/samples/contains-some-bad-code/bad-code.ts",
84+
"filename": "bad-code.ts",
85+
"shouldAnalyze": true,
86+
"path": "/samples/contains-some-bad-code",
87+
"type": "file",
88+
"timesDependedOn": 0
89+
},
90+
{
91+
"fullPath": "/samples/contains-some-bad-code/expected.json",
92+
"filename": "expected.json",
93+
"shouldAnalyze": false,
94+
"path": "/samples/contains-some-bad-code",
95+
"type": "file",
96+
"timesDependedOn": 0
97+
},
98+
{
99+
"fullPath": "/samples/contains-some-bad-code/good-code.ts",
100+
"filename": "good-code.ts",
101+
"shouldAnalyze": true,
102+
"path": "/samples/contains-some-bad-code",
103+
"type": "file",
104+
"complexityReport": {
105+
"aggregate": {
106+
"cyclomatic": 11,
107+
"cyclomaticDensity": 37.931,
108+
"halstead": {
109+
"bugs": 0.217,
110+
"difficulty": 35.889,
111+
"effort": 23378.702,
112+
"length": 127,
113+
"time": 1298.817,
114+
"vocabulary": 35,
115+
"volume": 651.419,
116+
"operands": {
117+
"distinct": 18,
118+
"total": 76
119+
},
120+
"operators": {
121+
"distinct": 17,
122+
"total": 51
123+
}
124+
},
125+
"paramCount": 9,
126+
"sloc": {
127+
"logical": 29,
128+
"physical": 41
129+
}
130+
},
131+
"dependencies": [],
132+
"errors": [],
133+
"lineEnd": 41,
134+
"lineStart": 1,
135+
"maintainability": 108.234,
136+
"codehawkScore": 60.8132766099468,
137+
"coverage": "0"
138+
},
139+
"timesDependedOn": 0
140+
}
141+
]
142+
}

0 commit comments

Comments
 (0)