File tree 5 files changed +26
-6
lines changed
5 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 8
8
"homepage" : " https://github.com/codeleague/codecoach" ,
9
9
"license" : " MIT" ,
10
10
"scripts" : {
11
- "lint" : " eslint ' src/**/*.{js,ts}' --quiet --fix" ,
12
- "lint-ci" : " eslint ' src/**/*.{js,ts}' " ,
13
- "format" : " prettier --write ' src/**/*.{js,ts}' " ,
11
+ "lint" : " eslint \" src/**/*.{js,ts}\" --quiet --fix" ,
12
+ "lint-ci" : " eslint \" src/**/*.{js,ts}\" " ,
13
+ "format" : " prettier --write \" src/**/*.{js,ts}\" " ,
14
14
"test" : " jest" ,
15
15
"build" : " tsc --project tsconfig.build.json" ,
16
16
"dev" : " nodemon --inspect=5858 --config ./nodemon.json -- --config=\" config-test.json\" " ,
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ describe('groupComments', () => {
97
97
text :
98
98
':rotating_light: msg1' +
99
99
' \n' +
100
- ':warning: (SUPPRESSED) additional warning' +
100
+ ':warning: (SUPPRESSED) additional warning (rule: UNIMPORTANT_RULE2) ' +
101
101
' \n' ,
102
102
} ,
103
103
{
@@ -138,7 +138,7 @@ describe('groupComments', () => {
138
138
text :
139
139
':rotating_light: msg1' +
140
140
' \n' +
141
- ':warning: (SUPPRESSED) additional warning' +
141
+ ':warning: (SUPPRESSED) additional warning (rule: UNIMPORTANT_RULE/RULE2) ' +
142
142
' \n' ,
143
143
} ,
144
144
{
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ function buildText(
46
46
const { severity, msg } = item ;
47
47
const { text : currentText } = currentComment ;
48
48
const msgWithSuppression = isSuppressed ? `(SUPPRESSED) ${ msg } ` : msg ;
49
- const text = MessageUtil . createMessageWithEmoji ( msgWithSuppression , severity ) ;
49
+ const msgWithRuleId = MessageUtil . addRuleIdToMessage ( msgWithSuppression , item . ruleId ) ;
50
+ const text = MessageUtil . createMessageWithEmoji ( msgWithRuleId , severity ) ;
50
51
return `${ currentText } ${ text } \n` ;
51
52
}
52
53
Original file line number Diff line number Diff line change @@ -26,3 +26,18 @@ describe('generateCommitDescription', () => {
26
26
expect ( MessageUtil . generateCommitDescription ( 99 ) ) . toBe ( 'CodeCoach report 99 errors' ) ;
27
27
} ) ;
28
28
} ) ;
29
+
30
+ describe ( 'addRuleIdToMessage' , ( ) => {
31
+ it ( 'should add ruleId to message' , ( ) => {
32
+ const msg = 'test' ;
33
+ const ruleId = 'id' ;
34
+
35
+ expect ( MessageUtil . addRuleIdToMessage ( msg , ruleId ) ) . toBe ( `${ msg } (rule: ${ ruleId } )` ) ;
36
+ } ) ;
37
+ it ( 'should not add ruleId to message if ruleId is empty' , ( ) => {
38
+ const msg = 'test' ;
39
+ const ruleId = '' ;
40
+
41
+ expect ( MessageUtil . addRuleIdToMessage ( msg , ruleId ) ) . toBe ( msg ) ;
42
+ } ) ;
43
+ } ) ;
Original file line number Diff line number Diff line change @@ -46,4 +46,8 @@ ${warningMsg}`;
46
46
? `CodeCoach report ${ nOfErrors } errors`
47
47
: 'CodeCoach report no critical issue, good job!' ;
48
48
}
49
+
50
+ static addRuleIdToMessage ( msg : string , ruleId : string ) : string {
51
+ return `${ msg } ` + ( ruleId ? ` (rule: ${ ruleId } )` : '' ) ;
52
+ }
49
53
}
You can’t perform that action at this time.
0 commit comments