@@ -163,35 +163,33 @@ const generateReport = async (options) => {
163163
164164 const issueLink = options . linkIssues
165165 ? ( data , issue ) => ( c ) =>
166- `<a href="${ data . sonarBaseURL } /project/issues?${
167- data . branch ? "branch=" + encodeURIComponent ( data . branch ) + "&" : ""
168- } id=${ encodeURIComponent (
169- data . sonarComponent
170- ) } &issues=${ encodeURIComponent ( issue . key ) } &open=${ encodeURIComponent (
171- issue . key
172- ) } ">${ c } </a>`
166+ `<a href="${ data . sonarBaseURL } /project/issues?${ data . branch ? "branch=" + encodeURIComponent ( data . branch ) + "&" : ""
167+ } id=${ encodeURIComponent (
168+ data . sonarComponent
169+ ) } &issues=${ encodeURIComponent ( issue . key ) } &open=${ encodeURIComponent (
170+ issue . key
171+ ) } ">${ c } </a>`
173172 : ( data , issue ) => ( c ) => c ;
174173
175174 const hotspotLink = options . linkIssues
176175 ? ( data , hotspot ) => ( c ) =>
177- `<a href="${ data . sonarBaseURL } /security_hotspots?${
178- data . branch ? "branch=" + encodeURIComponent ( data . branch ) + "&" : ""
179- } id=${ encodeURIComponent (
180- data . sonarComponent
181- ) } &hotspots=${ encodeURIComponent ( hotspot . key ) } ">${ c } </a>`
176+ `<a href="${ data . sonarBaseURL } /security_hotspots?${ data . branch ? "branch=" + encodeURIComponent ( data . branch ) + "&" : ""
177+ } id=${ encodeURIComponent (
178+ data . sonarComponent
179+ ) } &hotspots=${ encodeURIComponent ( hotspot . key ) } ">${ c } </a>`
182180 : ( ) => ( c ) => c ;
183181
184182 let severity = new Map ( ) ;
185183 severity . set ( "MINOR" , 0 ) ;
186184 severity . set ( "MAJOR" , 1 ) ;
187185 severity . set ( "CRITICAL" , 2 ) ;
188186 severity . set ( "BLOCKER" , 3 ) ;
189- let hotspotSeverities = { HIGH : "CRITICAL " , MEDIUM : "MAJOR " , LOW : "MINOR " } ;
187+ let hotspotSeverities = { HIGH : "HIGH " , MEDIUM : "MEDIUM " , LOW : "LOW " } ;
190188
191189 let properties = [ ] ;
192190 try {
193191 properties = getProperties ( readFileSync ( options . sonarPropertiesFile ) ) ;
194- } catch ( e ) { }
192+ } catch ( e ) { }
195193
196194 const data = {
197195 date : new Date ( ) . toLocaleDateString ( "en-us" , {
@@ -513,6 +511,7 @@ const generateReport = async (options) => {
513511 } ;
514512 } )
515513 ) ;
514+
516515 } catch ( error ) {
517516 logError ( "getting issues" , error ) ;
518517 return null ;
@@ -558,13 +557,15 @@ const generateReport = async (options) => {
558557 ) ;
559558 const hotspot = JSON . parse ( response . body ) ;
560559 hSeverity = hotspotSeverities [ hotspot . rule . vulnerabilityProbability ] ;
560+
561561 if ( hSeverity === undefined ) {
562- hSeverity = "MAJOR " ;
562+ hSeverity = "MEDIUM " ;
563563 console . error (
564564 "Unknown hotspot severity: %s" ,
565565 hotspot . vulnerabilityProbability
566566 ) ;
567567 }
568+
568569 data . issues . push ( {
569570 rule : hotspot . rule . key ,
570571 severity : hSeverity ,
@@ -589,12 +590,10 @@ const generateReport = async (options) => {
589590 } ) ;
590591
591592 data . summary = {
592- blocker : data . issues . filter ( ( issue ) => issue . severity === "BLOCKER" )
593- . length ,
594- critical : data . issues . filter ( ( issue ) => issue . severity === "CRITICAL" )
593+ high : data . issues . filter ( ( issue ) => ( issue . severity === "HIGH" || issue . severity === "BLOCKER" ) )
595594 . length ,
596- major : data . issues . filter ( ( issue ) => issue . severity === "MAJOR " ) . length ,
597- minor : data . issues . filter ( ( issue ) => issue . severity === "MINOR " ) . length ,
595+ medium : data . issues . filter ( ( issue ) => issue . severity === "MEDIUM " ) . length ,
596+ low : data . issues . filter ( ( issue ) => issue . severity === "LOW " ) . length ,
598597 } ;
599598 }
600599
@@ -615,9 +614,9 @@ const generateReport = async (options) => {
615614 // https://stackoverflow.com/questions/29085197/how-do-you-json-stringify-an-es6-map
616615 if ( key === "rules" ) {
617616 return Array . from ( value ) . reduce ( ( obj , [ key , value ] ) => {
618- obj [ key ] = value ;
619- return obj ;
620- } , { } ) ;
617+ obj [ key ] = value ;
618+ return obj ;
619+ } , { } ) ;
621620 } else {
622621 return value
623622 }
0 commit comments