Improve performance of docs snippet length checkstyle rule (#53636)
The multiline regex rule used to detect docs code snippets greater than 76 characters in length has considerable cost to. For the high level rest client project alone, this was taking upwards of 3 minutes. This commit updates the rule regex pattern to use non-greedy matching when appropriate which results in a lot fewer backtracks and about a 70% reduction in execution time on the high level rest client module.
This commit is contained in:
parent
347b7594b7
commit
497250ba9c
|
@ -26,7 +26,7 @@
|
|||
-->
|
||||
<module name="RegexpMultiline">
|
||||
<property name="id" value="SnippetLength"/>
|
||||
<property name="format" value="^( *)\/\/\s*tag(.+)\s*\n(.*\n)*\1.{77,}\n(.*\n)*\1\/\/\s*end\2\s*$"/>
|
||||
<property name="format" value="^( *?)//\s*?tag(.+?)\s*?\n(.*?\n)*?\1.{77,}?\n(.*?\n)*?\1//\s*?end\2\s*$"/>
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="message" value="Code snippets longer than 76 characters get cut off when rendered in the docs"/>
|
||||
</module>
|
||||
|
|
Loading…
Reference in New Issue