Skip to content

Commit 210086c

Browse files
committed
chore: refactor lint file results
1 parent be93675 commit 210086c

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Diff for: lib/commands/git/pre-commit.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ export default class extends Command {
6666
// skip large files, >200Kb
6767
// https://stackoverflow.com/questions/23429499/stdout-buffer-issue-using-node-child-process
6868
if ( !content.ok && content.statusText === "stdout maxBuffer length exceeded" ) {
69-
res = result( 202 );
69+
res = result( 201 );
7070
}
7171

7272
// XXX skip LFS files
7373
// need to use `git show :path | git lfs smudge` to extract file content
7474
else if ( /^version https:\/\/git-lfs\.github\.com\/spec\/v1\noid .+?\nsize \d+$/m.test( content.data ) ) {
75-
res = result( 202 );
75+
res = result( 201 );
7676
}
7777

7878
// lint file
@@ -94,15 +94,15 @@ export default class extends Command {
9494
report.total++;
9595

9696
// file was ignored
97-
if ( res.status === 202 ) {
97+
if ( res.status === 201 ) {
9898
report.ignored++;
9999

100100
continue;
101101
}
102102

103103
report.processed++;
104104

105-
if ( res.status !== 202 ) {
105+
if ( res.status !== 201 ) {
106106
if ( res.status === 200 ) {
107107
report.ok++;
108108
}

Diff for: lib/lint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class LintPatterns {
7474

7575
report.total++;
7676

77-
if ( res.status === 202 ) {
77+
if ( res.status === 201 ) {
7878
report.ignored++;
7979
}
8080
else {
@@ -98,7 +98,7 @@ export class LintPatterns {
9898
}
9999

100100
// skip ignored files
101-
else if ( !this.#reportIgnored && res.status === 202 ) {
101+
else if ( !this.#reportIgnored && res.status === 201 ) {
102102
continue;
103103
}
104104

Diff for: lib/lint/file.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import uuid from "#core/uuid";
1717

1818
// Status codes:
1919
// 200 - OK
20-
// 201 - Warnings
21-
// 202 - File Ignored
20+
// 201 - File Ignored
21+
// 210 - Warnings
2222
// 400 - Errors
2323
// 500 - Fatal error
2424

@@ -307,7 +307,7 @@ export class LintFile {
307307
if ( type ) this.#type = TYPES[ type ];
308308
}
309309

310-
if ( !this.#type && !this.#processUnsupportedTypes ) return result( [ 202, "File ignored" ] );
310+
if ( !this.#type && !this.#processUnsupportedTypes ) return result( [ 201, "File ignored" ] );
311311

312312
// add default extension
313313
if ( this.#type ) {
@@ -704,7 +704,7 @@ export class LintFile {
704704

705705
// warnings
706706
else if ( hasWarnings ) {
707-
return result( [ 201, "Warnings" ] );
707+
return result( [ 210, "Warnings" ] );
708708
}
709709

710710
// ok

Diff for: lib/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function getLintReportTable ( options = {} ) {
1616
"align": "center",
1717
format ( res ) {
1818
if ( res.status === 200 ) return "OK";
19-
else if ( res.status === 202 ) return ansi.dim( "IGNORED" );
19+
else if ( res.status === 201 ) return ansi.dim( "IGNORED" );
2020
else if ( res.ok ) return ansi.warn( " WARNING " );
2121
else return ansi.error( " ERROR " );
2222
},

0 commit comments

Comments
 (0)