@@ -420,11 +420,11 @@ void HtmlWriter::Private::writeNewDefWarning(const Defect &def) {
420
420
}
421
421
422
422
void linkifyShellCheckMsg (std::string *pMgs) {
423
- static boost::regex reShellCheckMsg (" \\ [SC([0-9]+)\\ ]$" );
423
+ static boost::regex reShellCheckMsg (" ( \\ [)? SC([0-9]+)( \\ ])? $" );
424
424
*pMgs = boost::regex_replace (*pMgs, reShellCheckMsg,
425
- " <a href=\" https://github.com/koalaman/shellcheck/wiki/SC\\ 1 \" "
426
- " title=\" description of ShellCheck's checker SC\\ 1 \" >"
427
- " [SC \\ 1] </a>" );
425
+ " <a href=\" https://github.com/koalaman/shellcheck/wiki/SC\\ 2 \" "
426
+ " title=\" description of ShellCheck's checker SC\\ 2 \" >"
427
+ " \\ 1SC \\ 2 \\ 3 </a>" );
428
428
}
429
429
430
430
void HtmlWriter::handleDef (const Defect &def) {
@@ -487,11 +487,15 @@ void HtmlWriter::handleDef(const Defect &def) {
487
487
488
488
boost::smatch sm;
489
489
const std::string &evtName = evt.event ;
490
- if (boost::regex_match (evtName, sm, d->reEvent ))
490
+ if (boost::regex_match (evtName, sm, d->reEvent )) {
491
+ std::string msgId = HtmlLib::escapeTextInline (sm[/* id */ 2 ]);
492
+ if (def.checker == " SHELLCHECK_WARNING" )
493
+ linkifyShellCheckMsg (&msgId);
491
494
d->str
492
- << HtmlLib::escapeTextInline (sm[1 ]) << " <b> "
493
- << HtmlLib::escapeTextInline (sm[ 2 ]) << " </b>"
495
+ << HtmlLib::escapeTextInline (sm[1 ])
496
+ << " <b> " << msgId << " </b>"
494
497
<< HtmlLib::escapeTextInline (sm[3 ]);
498
+ }
495
499
else
496
500
d->str << " <b>" << HtmlLib::escapeTextInline (evtName) << " </b>" ;
497
501
0 commit comments