Skip to content

Commit ccdfae1

Browse files
Merge branch 'develop' into fix-default-severity
2 parents f0dcce3 + 6ce9b25 commit ccdfae1

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

e2e/autofix-test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('e2e', function () {
103103
}
104104
)
105105

106-
expect(solhintProcess.status).to.equal(1)
106+
expect(solhintProcess.status).to.equal(0)
107107
expect(solhintProcess.stdout.toString().includes('5 problems (5 errors, 0 warnings)'))
108108
})
109109
})
@@ -129,7 +129,7 @@ describe('e2e', function () {
129129
`${params.command} ${params.param1} -c ${currentConfig} ${currentFile} --fix --disc --noPrompt`
130130
)
131131

132-
expect(code).to.equal(1)
132+
expect(code).to.equal(0)
133133

134134
const reportLines = stdout.split('\n')
135135
const finalLine = '5 problems (5 errors, 0 warnings)'
@@ -175,8 +175,8 @@ describe('e2e', function () {
175175
expect(result).to.be.true
176176
})
177177

178-
it('should execute and exit with code 1 (2)', () => {
179-
expect(code).to.equal(1)
178+
it('should execute and exit with code 0 (2)', () => {
179+
expect(code).to.equal(0)
180180
})
181181

182182
it('should get the right report (2)', () => {
@@ -222,7 +222,7 @@ describe('e2e', function () {
222222
})
223223

224224
it('should execute and exit with code 1 (3)', () => {
225-
expect(code).to.equal(1)
225+
expect(code).to.equal(0)
226226
})
227227

228228
it('should get the right report (3)', () => {
@@ -268,7 +268,7 @@ describe('e2e', function () {
268268
})
269269

270270
it('should execute and exit with code 1 (4)', () => {
271-
expect(code).to.equal(1)
271+
expect(code).to.equal(0)
272272
})
273273

274274
it('should get the right report (4)', () => {
@@ -314,7 +314,7 @@ describe('e2e', function () {
314314
})
315315

316316
it('should execute and exit with code 1 (5)', () => {
317-
expect(code).to.equal(1)
317+
expect(code).to.equal(0)
318318
})
319319

320320
it('should get the right report (5)', () => {
@@ -361,7 +361,7 @@ describe('e2e', function () {
361361
})
362362

363363
it('should execute and exit with code 1 (6)', () => {
364-
expect(code).to.equal(1)
364+
expect(code).to.equal(0)
365365
})
366366

367367
it('should get the right report (6)', () => {
@@ -401,7 +401,7 @@ describe('e2e', function () {
401401
})
402402

403403
it('should execute and exit with code 1 (6)', () => {
404-
expect(code).to.equal(1)
404+
expect(code).to.equal(0)
405405
})
406406

407407
it('should get the right report (6)', () => {
@@ -448,7 +448,7 @@ describe('e2e', function () {
448448
})
449449

450450
it('should execute and exit with code 1 (7)', () => {
451-
expect(code).to.equal(1)
451+
expect(code).to.equal(0)
452452
})
453453

454454
it('should get the right report (7)', () => {
@@ -494,7 +494,7 @@ describe('e2e', function () {
494494
})
495495

496496
it('should execute and exit with code 1 (8)', () => {
497-
expect(code).to.equal(1)
497+
expect(code).to.equal(0)
498498
})
499499

500500
it('should get the right report (8)', () => {
@@ -540,7 +540,7 @@ describe('e2e', function () {
540540
})
541541

542542
it('should execute and exit with code 1 (8)', () => {
543-
expect(code).to.equal(1)
543+
expect(code).to.equal(0)
544544
})
545545

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

e2e/formatters-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('e2e', function () {
8181
expect(reportLines[i]).to.equal(expectedLine)
8282
}
8383
// because there's an error
84-
expect(code).to.equal(1)
84+
expect(code).to.equal(0)
8585

8686
const finalLine = '10 problem/s (1 error/s, 9 warning/s)'
8787
expect(reportLines[reportLines.length - 2]).to.contain(finalLine)
@@ -128,7 +128,7 @@ describe('e2e', function () {
128128
const strExpected = JSON.stringify(expectedFinalOutput)
129129
expect(strExpected).to.equal(strOutput)
130130
// There's an error, that is why exit code is 1
131-
expect(code).to.equal(1)
131+
expect(code).to.equal(0)
132132
})
133133
})
134134

@@ -175,7 +175,7 @@ describe('e2e', function () {
175175
expect(reportLines[i]).to.equal(expectedLine)
176176
}
177177
// because there's an error
178-
expect(code).to.equal(1)
178+
expect(code).to.equal(0)
179179

180180
const finalLine = '10 problem/s (1 error/s, 9 warning/s)'
181181
expect(reportLines[reportLines.length - 2]).to.contain(finalLine)
@@ -240,7 +240,7 @@ describe('e2e', function () {
240240

241241
expect(reportLines[i].replace(/\s/g, '')).to.equal(expectedLine.replace(/\s/g, ''))
242242
}
243-
expect(code).to.equal(1)
243+
expect(code).to.equal(0)
244244

245245
const finalLine = '\u2716 10 problems (1 error, 9 warnings)'
246246
expect(reportLines[reportLines.length - 3]).to.equal(finalLine)
@@ -342,7 +342,7 @@ describe('e2e', function () {
342342
expect(reportLines[3]).to.eq(tableHeader1)
343343
expect(reportLines[4]).to.eq(tableHeader2)
344344

345-
expect(code).to.equal(1)
345+
expect(code).to.equal(0)
346346
})
347347
})
348348

@@ -670,7 +670,7 @@ describe('e2e', function () {
670670
]
671671

672672
// There's an error, that is why exit code is 1
673-
expect(code).to.equal(1)
673+
expect(code).to.equal(0)
674674
expect(sarifOutput.runs[0].artifacts[0].location.uri).to.eq(expectedUriPathFoo)
675675
expect(sarifOutput.runs[0].artifacts[1].location.uri).to.eq(expectedUriPathFoo2)
676676
expect(sarifOutput.runs[0].artifacts[2].location.uri).to.eq(expectedUriPathFoo3)

e2e/test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ describe('e2e', function () {
7373
describe('no-empty-blocks', function () {
7474
useFixture('03-no-empty-blocks')
7575

76-
it('should exit with 1', function () {
76+
it('should end correctly (exit w/0), found 1 error', function () {
7777
const { code, stdout } = shell.exec('solhint Foo.sol')
7878

79-
expect(code).to.equal(1)
79+
expect(code).to.equal(0)
8080
expect(stdout.trim()).to.contain('Code contains empty blocks')
8181
})
8282

83-
it('should work with stdin', async function () {
83+
it('should work with stdin, exit 0, found 1 error', async function () {
8484
const child = cp.exec('solhint stdin')
8585

8686
const stdoutPromise = getStream(child.stdout)
@@ -96,7 +96,7 @@ describe('e2e', function () {
9696

9797
const code = await codePromise
9898

99-
expect(code).to.equal(1)
99+
expect(code).to.equal(0)
100100

101101
const stdout = await stdoutPromise
102102

@@ -127,7 +127,7 @@ describe('e2e', function () {
127127
expect(stdout.trim()).to.not.contain(warningExceededMsg)
128128
})
129129

130-
it('should display [warnings exceeded] for max 3 warnings and exit error 1', function () {
130+
it('should display [warnings exceeded] for max 3 warnings and exit with 0', function () {
131131
const { code, stdout } = shell.exec('solhint contracts/Foo.sol --max-warnings 3')
132132

133133
expect(code).to.equal(1)
@@ -137,13 +137,13 @@ describe('e2e', function () {
137137
it('should return error for Compiler version rule, ignoring 3 --max-warnings', function () {
138138
const { code, stdout } = shell.exec('solhint contracts/Foo2.sol --max-warnings 3')
139139

140-
expect(code).to.equal(1)
140+
expect(code).to.equal(0)
141141
expect(stdout.trim()).to.contain(errorFound)
142142
})
143143

144144
it('should return error for Compiler version rule. No message for max-warnings', function () {
145145
const { code, stdout } = shell.exec('solhint contracts/Foo2.sol --max-warnings 27')
146-
expect(code).to.equal(1)
146+
expect(code).to.equal(0)
147147
expect(stdout.trim()).to.not.contain(errorFound)
148148
})
149149
})
@@ -163,7 +163,7 @@ describe('e2e', function () {
163163
it(`should raise error for wrongFunctionDefinitionName() only`, () => {
164164
const { code, stdout } = shell.exec('solhint -c test/.solhint.json test/FooTest.sol')
165165

166-
expect(code).to.equal(1)
166+
expect(code).to.equal(0)
167167
expect(stdout.trim()).to.contain(
168168
'Function wrongFunctionDefinitionName() must match Foundry test naming convention'
169169
)

solhint.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function init() {
2828
.option('-q, --quiet', 'report errors only - default: false')
2929
.option('--ignore-path [file_name]', 'file to use as your .solhintignore')
3030
.option('--fix', 'automatically fix problems. Skips fixes in report')
31-
// .option('--fixShow', 'automatically fix problems. Show fixes in report')
3231
.option('--noPrompt', 'do not suggest to backup files when any `fix` option is selected')
3332
.option('--init', 'create configuration file for solhint')
3433
.option('--disc', 'do not check for solhint updates')
@@ -81,7 +80,6 @@ function askUserToContinue(callback) {
8180
}
8281

8382
function execMainAction() {
84-
// if ((program.opts().fix || program.opts().fixShow) && !program.opts().noPrompt) {
8583
if (program.opts().fix && !program.opts().noPrompt) {
8684
askUserToContinue((userAnswer) => {
8785
if (userAnswer !== 'y') {
@@ -162,7 +160,8 @@ function executeMainActionLogic() {
162160

163161
printReports(reports, formatterFn)
164162

165-
exitWithCode(reports)
163+
// exitWithCode(reports)
164+
process.exit(0)
166165
}
167166

168167
function processStdin(options) {
@@ -183,8 +182,8 @@ function processStdin(options) {
183182
const reports = [report]
184183

185184
printReports(reports, formatterFn)
186-
187-
exitWithCode(reports)
185+
process.exit(0)
186+
// exitWithCode(reports)
188187
}
189188

190189
function writeSampleConfigFile() {
@@ -364,10 +363,10 @@ function listRules() {
364363
}
365364
}
366365

367-
function exitWithCode(reports) {
368-
const errorsCount = reports.reduce((acc, i) => acc + i.errorCount, 0)
369-
process.exit(errorsCount > 0 ? 1 : 0)
370-
}
366+
// function exitWithCode(reports) {
367+
// const errorsCount = reports.reduce((acc, i) => acc + i.errorCount, 0)
368+
// process.exit(errorsCount > 0 ? 1 : 0)
369+
// }
371370

372371
function checkForUpdate() {
373372
// eslint-disable-next-line import/no-extraneous-dependencies

0 commit comments

Comments
 (0)