Update tags, make CLI reference page
This commit is contained in:
@ -31,12 +31,12 @@ entries:
|
||||
- title: User Documentation
|
||||
output: web, pdf
|
||||
folderitems:
|
||||
- title: Getting started
|
||||
url: /pmd_userdocs_getting_started.html
|
||||
output: web, pdf
|
||||
- title: Installation and basic CLI usage
|
||||
url: /pmd_userdocs_installation.html
|
||||
output: web, pdf
|
||||
- title: Full CLI reference
|
||||
url: /pmd_userdocs_cli_reference.html
|
||||
output: web, pdf
|
||||
- title: Understanding rulesets
|
||||
url: /pmd_userdocs_understanding_rulesets.html
|
||||
output: web, pdf
|
||||
|
@ -1,15 +1,10 @@
|
||||
allowed-tags:
|
||||
- getting_started
|
||||
- essentials # Essential references for any user
|
||||
- rule_references # For the rule indices
|
||||
- release_notes
|
||||
- content_types
|
||||
- navigation
|
||||
- formatting
|
||||
- publishing
|
||||
- single_sourcing
|
||||
- special_layouts
|
||||
- collaboration
|
||||
- news
|
||||
- troubleshooting
|
||||
- mobile
|
||||
- customizing
|
||||
- customizing # For pages about configuration
|
||||
- userdocs # Pages about usage, making rulesets, configuring rules,
|
||||
- extending # Pages about writing rules, metrics, properties, etc
|
||||
- languages
|
@ -90,8 +90,9 @@ First time user? Then you may be interested in our [quickstart page](TODO).
|
||||
|
||||
|
||||
{% include custom/shuffle_panel.html
|
||||
tag="getting_started"
|
||||
title="Getting started" %}
|
||||
tag="essentials"
|
||||
description="These pages summarize the Gist of PMD usage to get you started quickly:"
|
||||
title="Essential resources" %}
|
||||
|
||||
|
||||
{% include custom/shuffle_panel.html
|
||||
|
@ -1,98 +1,11 @@
|
||||
---
|
||||
title: Getting Started
|
||||
permalink: pmd_userdocs_getting_started.html
|
||||
title: Full CLI reference
|
||||
summary: "Full reference for the command-line interface, including options, output formats and supported languages"
|
||||
tags: [essentials, userdocs]
|
||||
permalink: pmd_userdocs_cli_reference.html
|
||||
author: Tom Copeland <tom@infoether.com>, Xavier Le Vourch <xlv@users.sourceforge.net>, Juan Martín Sotuyo Dodero <juansotuyo@gmail.com>
|
||||
---
|
||||
|
||||
## How to install PMD and CPD
|
||||
|
||||
### Windows
|
||||
|
||||
Requirements:
|
||||
|
||||
* [Java JRE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) 1.7 or higher
|
||||
* [Winzip](http://winzip.com) or the free [7-zip](http://www.7-zip.org/)
|
||||
|
||||
Download the latest binary distribution from [the github releases page](https://github.com/pmd/pmd/releases).
|
||||
|
||||
Unzip it into any directory, i.e., c:\pmd\
|
||||
|
||||
### Linux / Unix
|
||||
|
||||
Requirements:
|
||||
|
||||
* [Java JRE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) 1.7 or higher
|
||||
* The Unix "zip" utility [InfoZip](http://www.info-zip.org/pub/infozip/)
|
||||
|
||||
Download the latest binary distribution from [the github releases page](https://github.com/pmd/pmd/releases).
|
||||
|
||||
Unzip it into any directory:
|
||||
|
||||
[tom@hal tmp]$ unzip -q pmd-bin-{{site.pmd.version}}.zip
|
||||
[tom@hal tmp]$ ls -l
|
||||
total 4640
|
||||
drwxrwxr-x 5 tom tom 4096 Apr 17 16:38 pmd-bin-{{site.pmd.version}}
|
||||
-rw-rw-r-- 1 tom tom 4733312 Jun 9 15:44 pmd-bin-{{site.pmd.version}}.zip
|
||||
[tom@hal tmp]$
|
||||
|
||||
|
||||
Note that the PMD binary distribution file contains both [PMD](#running-pmd-via-command-line) and [CPD](pmd_userdocs_cpd.html).
|
||||
|
||||
|
||||
## Running PMD via command line
|
||||
|
||||
### On Linux and other UNIX based operating system...
|
||||
|
||||
PMD comes with several command line utilities. Previously, each of them had its own start up script, but this has been
|
||||
greatly simplified since PMD 5.0. ... at least for Unix systems. There is now only one script, called "run.sh", inside
|
||||
the `bin/` directory of PMD distribution.
|
||||
|
||||
The first argument is the name of the utility you want to execute ('pmd', 'designer', ...) and the other arguments are
|
||||
specific to the utility used.
|
||||
|
||||
$ ./bin/run.sh pmd -d ../../../src/main/java/ -f text -R rulesets/java/basic.xml -version 1.7 -language java
|
||||
.../src/main/java/net/sourceforge/pmd/RuleSet.java:123 These nested if statements could be combined
|
||||
.../src/main/java/net/sourceforge/pmd/RuleSet.java:231 Useless parentheses.
|
||||
.../src/main/java/net/sourceforge/pmd/RuleSet.java:232 Useless parentheses.
|
||||
.../src/main/java/net/sourceforge/pmd/RuleSet.java:357 These nested if statements could be combined
|
||||
.../src/main/java/net/sourceforge/pmd/RuleSetWriter.java:66 Avoid empty catch blocks
|
||||
.../src/main/java/net/sourceforge/pmd/RuleSetWriter.java:269 Useless parentheses.
|
||||
|
||||
Type "./run.sh pmd -d \[filename\|jar or zip file containing source code\|directory] -f \[report format] -R \[ruleset file]", i.e:
|
||||
|
||||
/home/user/tmp/pmd-bin-{{site.pmd.version}}/pmd/bin>./run.sh pmd -d /home/user/data/pmd/pmd/test-data/Unused1.java -f xml -R rulesets/java/unusedcode.xml
|
||||
<?xml version="1.0"?><pmd>
|
||||
<file name="/home/user/data/pmd/pmd/test-data/Unused1.java">
|
||||
<violation line="5" rule="UnusedLocalVariable">
|
||||
Avoid unused local variables such as 'fr'
|
||||
</violation>
|
||||
</file></pmd>
|
||||
|
||||
/home/user/tmp/pmd-bin-{{site.pmd.version}}/pmd/bin>
|
||||
|
||||
|
||||
### Basic usage for Windows
|
||||
|
||||
You can find PMD's starter batch file `pmd.bat` in the `bin` subdirectory.
|
||||
|
||||
Type "pmd -d \[filename\|jar or zip file containing source code\|directory] -f \[report format] -R \[ruleset file]", i.e:
|
||||
|
||||
C:\tmp\pmd-bin-{{site.pmd.version}}<\pmd\bin>pmd -d c:\data\pmd\pmd\test-data\Unused1.java -f xml -R rulesets/java/unusedcode.xml
|
||||
<?xml version="1.0"?><pmd>
|
||||
<file name="c:\data\pmd\pmd\test-data\Unused1.java">
|
||||
<violation line="5" rule="UnusedLocalVariable">
|
||||
Avoid unused local variables such as 'fr'
|
||||
</violation>
|
||||
</file></pmd>
|
||||
|
||||
C:\tmp\pmd-bin-{{site.pmd.version}}\pmd\bin>
|
||||
|
||||
You can pass a file name, a directory name, or a jar or zip file name containing Java source code to PMD.
|
||||
|
||||
Also, the PMD binary distribution includes the ruleset files
|
||||
inside the jar file - even though the "rulesets/java/unusedcode.xml" parameter
|
||||
above looks like a filesystem reference, it's really being used by a getResourceAsStream() call
|
||||
to load it out of the PMD jar file.
|
||||
|
||||
### Options
|
||||
|
@ -1,5 +1,7 @@
|
||||
---
|
||||
title: Installation and basic CLI usage
|
||||
tags: [essentials, userdocs]
|
||||
summary: "Sums up the first steps to set up a CLI installation and get started using PMD"
|
||||
permalink: pmd_userdocs_installation.html
|
||||
sidebar: pmd_sidebar
|
||||
---
|
||||
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Collaboration pages"
|
||||
tagName: collaboration
|
||||
search: exclude
|
||||
permalink: tag_collaboration.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Content types pages"
|
||||
tagName: content_types
|
||||
search: exclude
|
||||
permalink: tag_content_types.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
8
docs/pages/tags/tag_essentials.md
Normal file
8
docs/pages/tags/tag_essentials.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
title: "Essential pages"
|
||||
tagName: essentials
|
||||
search: exclude
|
||||
permalink: tag_essentials.html
|
||||
sidebar: pmd_sidebar
|
||||
---
|
||||
{% include taglogic.html %}
|
8
docs/pages/tags/tag_extending.md
Normal file
8
docs/pages/tags/tag_extending.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
title: "Extending PMD"
|
||||
tagName: extending
|
||||
search: exclude
|
||||
permalink: tag_extending.html
|
||||
sidebar: pmd_essentials
|
||||
---
|
||||
{% include taglogic.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Formatting pages"
|
||||
tagName: formatting
|
||||
search: exclude
|
||||
permalink: tag_formatting.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Mobile Pages"
|
||||
search: exclude
|
||||
tagName: mobile
|
||||
permalink: tag_mobile.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Navigation pages"
|
||||
tagName: navigation
|
||||
search: exclude
|
||||
permalink: tag_navigation.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "News"
|
||||
tagName: news
|
||||
search: exclude
|
||||
permalink: tag_news.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Publishing pages"
|
||||
tagName: publishing
|
||||
search: exclude
|
||||
permalink: tag_publishing.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
11
docs/pages/tags/tag_rule_references.md
Normal file
11
docs/pages/tags/tag_rule_references.md
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
title: "Rule references"
|
||||
tagName: rule_references
|
||||
search: exclude
|
||||
permalink: tag_rule_references.html
|
||||
sidebar: pmd_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,11 +0,0 @@
|
||||
---
|
||||
title: "Single sourcing pages"
|
||||
tagName: single_sourcing
|
||||
search: exclude
|
||||
permalink: tag_single_sourcing.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
@ -1,12 +0,0 @@
|
||||
---
|
||||
title: "Special layout pages"
|
||||
tagName: special_layouts
|
||||
search: exclude
|
||||
permalink: tag_special_layouts.html
|
||||
sidebar: mydoc_sidebar
|
||||
folder: tags
|
||||
---
|
||||
|
||||
{% include taglogic.html %}
|
||||
|
||||
{% include links.html %}
|
8
docs/pages/tags/tag_userdocs.md
Normal file
8
docs/pages/tags/tag_userdocs.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
title: "User documentation"
|
||||
tagName: userdocs
|
||||
search: exclude
|
||||
permalink: tag_userdocs.html
|
||||
sidebar: pmd_sidebar
|
||||
---
|
||||
{% include taglogic.html %}
|
@ -185,6 +185,7 @@ public class RuleDocGenerator {
|
||||
lines.add("---");
|
||||
lines.add("title: " + entry.getKey().getName() + " Rules");
|
||||
lines.add("tags: [rule_references, " + languageTersename + "]");
|
||||
lines.add("summary: Index of all built-in rules available for " + entry.getKey().getName());
|
||||
lines.add("language_name: " + entry.getKey().getName());
|
||||
lines.add("permalink: " + LANGUAGE_INDEX_PERMALINK_PATTERN.replace("${language.tersename}", languageTersename));
|
||||
lines.add("folder: pmd/rules");
|
||||
|
Reference in New Issue
Block a user