From 5da6525276e84cd442cc85b1a0941f53877f7f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 23 May 2018 04:03:31 +0200 Subject: [PATCH] Corrections for PR --- docs/_data/tags.yml | 2 +- docs/_includes/custom/knowledge_base_topic.html | 2 +- docs/_includes/custom/shuffle_panel.html | 2 +- docs/_includes/head.html | 2 +- docs/_plugins/custom_filters.rb | 3 ++- docs/_plugins/eval_tag.rb | 6 +++--- docs/css/pmd-customstyles.css | 2 +- docs/pages/pmd/userdocs/installation.md | 2 +- docs/pages/pmd/userdocs/suppressing_warnings.md | 14 ++++++++------ 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/_data/tags.yml b/docs/_data/tags.yml index dcbc4c849b..0fe60c394a 100644 --- a/docs/_data/tags.yml +++ b/docs/_data/tags.yml @@ -9,4 +9,4 @@ allowed-tags: - metrics # About using metrics, and metrics indices - tools # About tools and integrations, Maven, gradle, etc. - devdocs # About PMD internals, contributing, building, projects - - languages \ No newline at end of file + - languages diff --git a/docs/_includes/custom/knowledge_base_topic.html b/docs/_includes/custom/knowledge_base_topic.html index b24f69a7fa..030d14e8f3 100644 --- a/docs/_includes/custom/knowledge_base_topic.html +++ b/docs/_includes/custom/knowledge_base_topic.html @@ -19,4 +19,4 @@ - \ No newline at end of file + diff --git a/docs/_includes/custom/shuffle_panel.html b/docs/_includes/custom/shuffle_panel.html index 46a0852917..68c7024fd8 100644 --- a/docs/_includes/custom/shuffle_panel.html +++ b/docs/_includes/custom/shuffle_panel.html @@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/docs/_includes/head.html b/docs/_includes/head.html index f547ed12cd..8e115b3fa0 100644 --- a/docs/_includes/head.html +++ b/docs/_includes/head.html @@ -13,7 +13,7 @@ - + diff --git a/docs/_plugins/custom_filters.rb b/docs/_plugins/custom_filters.rb index eaa6375f02..2d0ff09d68 100644 --- a/docs/_plugins/custom_filters.rb +++ b/docs/_plugins/custom_filters.rb @@ -59,6 +59,7 @@ module CustomFilters rank_lookup = rank_lookup_from_sidebar(sidebar) xs.sort {|x, y| + # The default rank is very high so that pages that don't appear in the sidebar are put at the end rx = rank_lookup[x.url] || 10000 ry = rank_lookup[y.url] || 10000 @@ -69,4 +70,4 @@ module CustomFilters end -Liquid::Template.register_filter(CustomFilters) \ No newline at end of file +Liquid::Template.register_filter(CustomFilters) diff --git a/docs/_plugins/eval_tag.rb b/docs/_plugins/eval_tag.rb index 466caeaa63..6c2318329a 100644 --- a/docs/_plugins/eval_tag.rb +++ b/docs/_plugins/eval_tag.rb @@ -14,16 +14,16 @@ class EvalTag < Liquid::Tag # Lookup allows access to the page/post variables through the tag context def lookup(context, name) lookup = context - name.split(".").each {|value| + name.strip.split(".").each {|value| lookup = lookup[value] } lookup end def render(context) - lookup(context, lookup(context, @name_expression).strip) + lookup(context, lookup(context, @name_expression)) end end -Liquid::Template.register_tag('eval', EvalTag) \ No newline at end of file +Liquid::Template.register_tag('eval', EvalTag) diff --git a/docs/css/pmd-customstyles.css b/docs/css/pmd-customstyles.css index 4b8d9da34c..8921f0de80 100644 --- a/docs/css/pmd-customstyles.css +++ b/docs/css/pmd-customstyles.css @@ -10,4 +10,4 @@ .landing-page.cat-description { margin-top: .4cm; -} \ No newline at end of file +} diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md index d110fa2d1e..66dee4c962 100644 --- a/docs/pages/pmd/userdocs/installation.md +++ b/docs/pages/pmd/userdocs/installation.md @@ -105,4 +105,4 @@ Like for PMD, CPD is started on Unix by `run.sh cpd` and on Windows by `cpd.bat` There are two required parameters: * `--files `: path to the sources to analyse. This can be a file name, a directory or a jar or zip file containing the sources. -* `--minimum-tokens `: the minimum token length which should be reported as a duplicate. \ No newline at end of file +* `--minimum-tokens `: the minimum token length which should be reported as a duplicate. diff --git a/docs/pages/pmd/userdocs/suppressing_warnings.md b/docs/pages/pmd/userdocs/suppressing_warnings.md index 0cc71a6fba..a7bdd721d5 100644 --- a/docs/pages/pmd/userdocs/suppressing_warnings.md +++ b/docs/pages/pmd/userdocs/suppressing_warnings.md @@ -140,7 +140,7 @@ A message placed after the NOPMD marker will get placed in the report, e.g.: ## XPath and Regex message suppression -If a particular rule fails consistently in a particular context, you can fall +If a particular rule consistently reports a warning in a particular context, you can fall back to disabling the rule for all these contexts using one of two rule properties that are defined on every rule. Depending on what you're after, you can suppress violations for **specific messages** using regular expressions, or **specific nodes** @@ -168,10 +168,14 @@ a regular expression that matches the message of violations you wish to suppress. Regular expressions are explained in the JavaDoc for standard Java class java.util.regex.Pattern. +This technique of course relies on how the rule's message is implemented. +Some rules always report the same message, in which case this property is +of no use. + ### The property `violationSuppressXPath` -This property defines an XPath query to be executed using the -violation node as the starting point. If the XPath query matches anything, +This property defines an XPath query to be executed *using the +violation node as the starting point*. If the XPath query matches anything, then the violation will be suppressed. For example, to suppress reporting specifically typed parameters which are unused: @@ -185,6 +189,4 @@ For example, to suppress reporting specifically typed parameters which are unuse Note for XPath based suppression to work, you must know how to write an XPath query that matches the AST structure of the nodes of the violations you wish to suppress. XPath queries are explained in -[XPath Rule tutorial](pmd_userdocs_extending_writing_xpath_rules.html). - -Suggestions? Comments? Post them [here](https://github.com/pmd/pmd/issues). Thanks! +[XPath Rule tutorial](pmd_userdocs_extending_writing_xpath_rules.html). \ No newline at end of file