Skip to content

Commit 7451f79

Browse files
Merge pull request #579 from protofire/develop
v5.0.0 merge develop into master
2 parents 8ea89a4 + 82944cf commit 7451f79

File tree

8 files changed

+487
-318
lines changed

8 files changed

+487
-318
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## [5.0.0] - 2024-05-11
2+
### BREAKING CHANGES
3+
4+
#### Solhint EXIT codes
5+
Solhint changed how the exit codes are implemented:
6+
7+
`Exit with 0 code` When execution was ok and there were no errors when evaluating the code according to the rules<br>
8+
`Exit with 1 code` When execution was ok and there are errors reported<br>
9+
`Exit with 1 code` When execution was ok and max warnings is lower than the reported warnings<br>
10+
`Exit with 255 code` When there's an error in the execution (bad config, writing not allowed, wrong parameter, file not found, etc)<br>
11+
12+
#### Solhint QUIET mode
13+
QUIET mode (-c quiet) option now works with the warnings and may exit with 1 if there are more than defined by user
14+
15+
Thanks to [@juanpcapurro](https://github.com/juanpcapurro) for providing the code
16+
17+
<br><br>
118
## [4.5.4] - 2024-04-10
219
### Fixed
320
- `gas-custom-errors` improved logic to ranged pragma versions [#573](https://github.com/protofire/solhint/pull/573)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Options:
6161
6262
-V, --version output the version number
6363
-f, --formatter [name] report formatter name (stylish, table, tap, unix, json, compact, sarif)
64-
-w, --max-warnings [maxWarningsNumber] number of allowed warnings
64+
-w, --max-warnings [maxWarningsNumber] number of allowed warnings, works in quiet mode as well
6565
-c, --config [file_name] file to use as your .solhint.json
6666
-q, --quiet report errors only - default: false
6767
--ignore-path [file_name] file to use as your .solhintignore

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM node:20-alpine
22
LABEL maintainer="diego.bale@protofire.io"
3-
ENV VERSION=4.5.4
3+
ENV VERSION=5.0.0
44

55
RUN npm install -g solhint@"$VERSION"

e2e/autofix-test.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const shell = require('shelljs')
77
const spawnSync = require('spawn-sync')
88

99
const E2E = true
10+
const EXIT_CODES = { BAD_OPTIONS: 255, OK: 0, REPORTED_ERRORS: 1 }
1011

1112
let params
1213
let currentConfig
@@ -103,7 +104,7 @@ describe('e2e', function () {
103104
}
104105
)
105106

106-
expect(solhintProcess.status).to.equal(0)
107+
expect(solhintProcess.status).to.equal(EXIT_CODES.REPORTED_ERRORS)
107108
expect(solhintProcess.stdout.toString().includes('5 problems (5 errors, 0 warnings)'))
108109
})
109110
})
@@ -129,7 +130,7 @@ describe('e2e', function () {
129130
`${params.command} ${params.param1} -c ${currentConfig} ${currentFile} --fix --disc --noPrompt`
130131
)
131132

132-
expect(code).to.equal(0)
133+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
133134

134135
const reportLines = stdout.split('\n')
135136
const finalLine = '5 problems (5 errors, 0 warnings)'
@@ -175,8 +176,8 @@ describe('e2e', function () {
175176
expect(result).to.be.true
176177
})
177178

178-
it('should execute and exit with code 0 (2)', () => {
179-
expect(code).to.equal(0)
179+
it('should execute and exit with code 1 (2)', () => {
180+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
180181
})
181182

182183
it('should get the right report (2)', () => {
@@ -221,8 +222,8 @@ describe('e2e', function () {
221222
expect(result).to.be.true
222223
})
223224

224-
it('should execute and exit with code 1 (3)', () => {
225-
expect(code).to.equal(0)
225+
it('should execute and exit with code 0 (3)', () => {
226+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
226227
})
227228

228229
it('should get the right report (3)', () => {
@@ -268,7 +269,7 @@ describe('e2e', function () {
268269
})
269270

270271
it('should execute and exit with code 1 (4)', () => {
271-
expect(code).to.equal(0)
272+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
272273
})
273274

274275
it('should get the right report (4)', () => {
@@ -314,7 +315,7 @@ describe('e2e', function () {
314315
})
315316

316317
it('should execute and exit with code 1 (5)', () => {
317-
expect(code).to.equal(0)
318+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
318319
})
319320

320321
it('should get the right report (5)', () => {
@@ -361,7 +362,7 @@ describe('e2e', function () {
361362
})
362363

363364
it('should execute and exit with code 1 (6)', () => {
364-
expect(code).to.equal(0)
365+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
365366
})
366367

367368
it('should get the right report (6)', () => {
@@ -401,7 +402,7 @@ describe('e2e', function () {
401402
})
402403

403404
it('should execute and exit with code 1 (6)', () => {
404-
expect(code).to.equal(0)
405+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
405406
})
406407

407408
it('should get the right report (6)', () => {
@@ -448,7 +449,7 @@ describe('e2e', function () {
448449
})
449450

450451
it('should execute and exit with code 1 (7)', () => {
451-
expect(code).to.equal(0)
452+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
452453
})
453454

454455
it('should get the right report (7)', () => {
@@ -494,7 +495,7 @@ describe('e2e', function () {
494495
})
495496

496497
it('should execute and exit with code 1 (8)', () => {
497-
expect(code).to.equal(0)
498+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
498499
})
499500

500501
it('should get the right report (8)', () => {
@@ -540,7 +541,7 @@ describe('e2e', function () {
540541
})
541542

542543
it('should execute and exit with code 1 (8)', () => {
543-
expect(code).to.equal(0)
544+
expect(code).to.equal(EXIT_CODES.REPORTED_ERRORS)
544545
})
545546

546547
it('should get the right report (8)', () => {

0 commit comments

Comments
 (0)