Created
March 29, 2016 20:16
-
-
Save morria/0ab719e58da7bc72e4fcd804d5e8911e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Phan/CLI.php b/src/Phan/CLI.php | |
index 2437e82..66ddd81 100644 | |
--- a/src/Phan/CLI.php | |
+++ b/src/Phan/CLI.php | |
@@ -70,6 +70,7 @@ class CLI | |
'state-file:', | |
'processes:', | |
'signature-compatibility', | |
+ 'markdown-issue-messages', | |
] | |
); | |
@@ -214,6 +215,9 @@ class CLI | |
case 'dead-code-detection': | |
Config::get()->dead_code_detection = true; | |
break; | |
+ case 'markdown-issue-messages': | |
+ Config::get()->markdown_issue_messages = true; | |
+ break; | |
default: | |
$this->usage("Unknown option '-$key'"); | |
break; | |
diff --git a/src/Phan/Config.php b/src/Phan/Config.php | |
index 8101bf2..37ac40e 100644 | |
--- a/src/Phan/Config.php | |
+++ b/src/Phan/Config.php | |
@@ -168,6 +168,9 @@ class Config | |
'suppress_issue_types' => [ | |
// 'PhanUndeclaredMethod', | |
], | |
+ | |
+ // Emit issue messages with markdown formatting | |
+ 'markdown_issue_messages' => false, | |
]; | |
/** | |
diff --git a/src/Phan/IssueInstance.php b/src/Phan/IssueInstance.php | |
index 0526bc9..b6cc21a 100644 | |
--- a/src/Phan/IssueInstance.php | |
+++ b/src/Phan/IssueInstance.php | |
@@ -30,8 +30,18 @@ class IssueInstance | |
$this->issue = $issue; | |
$this->file = $file; | |
$this->line = $line; | |
+ | |
+ $template = $issue->getTemplate(); | |
+ | |
+ if (Config::get()->markdown_issue_messages) { | |
+ $template = preg_replace( | |
+ '/([^ ]*%s[^ ]*)/', '`\1`', | |
+ $template | |
+ ); | |
+ } | |
+ | |
$this->message = vsprintf( | |
- $issue->getTemplate(), | |
+ $template, | |
$template_parameters | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment