Annotation for Suppressing Errors Reported from RedPen, a Linting tool for Markup text

RedPen version 1.6 supports error suppression with text annotations. This feature gives us a good balance between the quality and the productivity for document writing.

Sometimes we do not want to fix errors from RedPen, a text linting tool. Most of reasons are that the cost to remove the error is high. Or the writer breaks the writing standard at particular points on purpose. For such cases, the error suppression by annotation is useful. The annotations are added just before the sections containing the errors.

Currently error suppression is supported for four types of formats (AsciiDoc, Markdown, Re:VIEW, LaTeX). In the following section, I will show a sample text containing the error suppression annotation for error suppression.

As the sample of the annotation for error suppression, an AsciiDoc text is applied. AsciiDoc is a popular format, which is adopted by GitBook.

Sample: error suppression in AsciiDoc text

For AsciiDoc text, writers add the suppress annotation in attribute block. The annotation is [suppress]. For example, the following AsciiDoc text suppresses the all the errors in the section.

[suppress]
= Instances
Some software tools work in more than one machine, and such distributed (cluster)systems can handle huge data or tasks, because such software tools make use of large amount of computer resources, such as CPU, Disk, and Memory.

When we apply RedPen to the AsciiDoc file, we got the following messages.

$ redpen sample.asciidoc
redpen redpen-suppress.asciidoc
[2016-06-14 16:10:43.850][INFO ] cc.redpen.Main - Configuration file: /usr/local/Cellar/redpen/1.6.1/libexec/conf/redpen-conf-en.xml
[2016-06-14 16:10:43.856][INFO ] cc.redpen.config.ConfigurationLoader - Loading config from specified config file: "/usr/local/Cellar/redpen/1.6.1/libexec/conf/redpen-conf-en.xml"
[2016-06-14 16:10:43.867][INFO ] cc.redpen.config.ConfigurationLoader - Succeeded to load configuration file
[2016-06-14 16:10:43.867][INFO ] cc.redpen.config.ConfigurationLoader - Language is set to "en"
[2016-06-14 16:10:43.867][WARN ] cc.redpen.config.ConfigurationLoader - No variant configuration...
[2016-06-14 16:10:43.868][INFO ] cc.redpen.config.ConfigurationLoader - No "symbols" block found in the configuration
[2016-06-14 16:10:43.872][INFO ] cc.redpen.config.SymbolTable - Default symbol settings are loaded
[2016-06-14 16:10:43.923][INFO ] cc.redpen.parser.SentenceExtractor - "[., ?, !]" are added as a end of sentence characters
[2016-06-14 16:10:43.924][INFO ] cc.redpen.parser.SentenceExtractor - "[', "]" are added as a right quotation characters
[2016-06-14 16:10:44.064][INFO ] org.reflections.Reflections - Reflections took 71 ms to scan 1 urls, producing 4 keys and 46 values
[2016-06-14 16:10:44.231][INFO ] cc.redpen.util.DictionaryLoader - Succeeded to load UnexpandedAcronymValidator default dictionary.
[2016-06-14 16:10:44.237][INFO ] cc.redpen.util.DictionaryLoader - Succeeded to load weak expressions.
[2016-06-14 16:10:44.243][INFO ] cc.redpen.util.DictionaryLoader - Succeeded to load word frequencies.
[2016-06-14 16:10:44.245][INFO ] cc.redpen.validator.JavaScriptValidator - JavaScript validators directory: js

We can see that there is no errors in the output. 

When the we want to suppress only the specified errors, add Validator names after suppress. The following example suppresses only two types of errors (Contraction WeakExpression) in the section.

[suppress='Contraction WeakExpression']
= Instances
Some software tools work in more than one machine, and such distributed (cluster)systems can handle huge data or tasks, because such software tools make use of large amount of computer resources, such as CPU, Disk, and Memory.

When we apply RedPen to the AsciiDoc file, we got the following messages.

redpen sample2.asciidoc
[2016-06-14 16:13:38.005][INFO ] cc.redpen.Main - Configuration file: /usr/local/Cellar/redpen/1.6.1/libexec/conf/redpen-conf-en.xml
[2016-06-14 16:13:38.010][INFO ] cc.redpen.config.ConfigurationLoader - Loading config from specified config file: "/usr/local/Cellar/redpen/1.6.1/libexec/conf/redpen-conf-en.xml"
[2016-06-14 16:13:38.019][INFO ] cc.redpen.config.ConfigurationLoader - Succeeded to load configuration file
[2016-06-14 16:13:38.019][INFO ] cc.redpen.config.ConfigurationLoader - Language is set to "en"
[2016-06-14 16:13:38.019][WARN ] cc.redpen.config.ConfigurationLoader - No variant configuration...
[2016-06-14 16:13:38.020][INFO ] cc.redpen.config.ConfigurationLoader - No "symbols" block found in the configuration
[2016-06-14 16:13:38.023][INFO ] cc.redpen.config.SymbolTable - Default symbol settings are loaded
[2016-06-14 16:13:38.082][INFO ] cc.redpen.parser.SentenceExtractor - "[., ?, !]" are added as a end of sentence characters
[2016-06-14 16:13:38.083][INFO ] cc.redpen.parser.SentenceExtractor - "[', "]" are added as a right quotation characters
[2016-06-14 16:13:38.200][INFO ] org.reflections.Reflections - Reflections took 63 ms to scan 1 urls, producing 4 keys and 46 values
[2016-06-14 16:13:38.349][INFO ] cc.redpen.util.DictionaryLoader - Succeeded to load UnexpandedAcronymValidator default dictionary.
[2016-06-14 16:13:38.353][INFO ] cc.redpen.util.DictionaryLoader - Succeeded to load weak expressions.
[2016-06-14 16:13:38.361][INFO ] cc.redpen.util.DictionaryLoader - Succeeded to load word frequencies.
[2016-06-14 16:13:38.363][INFO ] cc.redpen.validator.JavaScriptValidator - JavaScript validators directory: js
redpen-suppress-2.asciidoc:3: ValidationError[SentenceLength], The length of the sentence (226) exceeds the maximum of 120. at line: Some software tools work in more than one machi\
ne, and such distributed (cluster)systems can handle huge data or tasks, because such software tools make use of large amount of computer resources, such as CPU, Disk, and Memory.
redpen-suppress-2.asciidoc:3: ValidationError[CommaNumber], The number of commas (6) exceeds the maximum of 3. at line: Some software tools work in more than one machine, and such \
distributed (cluster)systems can handle huge data or tasks, because such software tools make use of large amount of computer resources, such as CPU, Disk, and Memory.
redpen-suppress-2.asciidoc:3: ValidationError[SymbolWithSpace], Need whitespace after symbol ")". at line: Some software tools work in more than one machine, and such distributed (\
cluster)systems can handle huge data or tasks, because such software tools make use of large amount of computer resources, such as CPU, Disk, and Memory.
[2016-06-14 16:13:38.411][ERROR] cc.redpen.Main - The number of errors "3" is larger than specified (limit is "1").

We can see that we got the only the errors not specified in the annotation block are flush.

Summary and Future work

This article demonstrates the error suppression by text annotation. The next release of RedPen IntelliJ plugin is going to support the quick fix of errors by inserting the suppress annotation.

Annotation for Suppressing Errors Reported from RedPen, a Linting tool for Markup text

Leave a comment