forked from phoedos/pmd
Update documentation
TRAVIS_JOB_NUMBER=4201.2 TRAVIS_COMMIT_RANGE=e536ca19476b...b0e458d8130e
This commit is contained in:
@@ -173,7 +173,7 @@
|
||||
|
||||
|
||||
<ul id="mysidebar" class="nav">
|
||||
<li class="sidebarTitle">PMD 6.18.0</li>
|
||||
<li class="sidebarTitle">PMD 6.19.0</li>
|
||||
|
||||
|
||||
|
||||
@@ -1284,203 +1284,20 @@ $('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3
|
||||
|
||||
|
||||
|
||||
<h2 id="-august-2019---6180">??-August-2019 - 6.18.0</h2>
|
||||
<h2 id="-october-2019---6190">??-October-2019 - 6.19.0</h2>
|
||||
|
||||
<p>The PMD team is pleased to announce PMD 6.18.0.</p>
|
||||
<p>The PMD team is pleased to announce PMD 6.19.0.</p>
|
||||
|
||||
<p>This is a minor release.</p>
|
||||
|
||||
<h3 id="new-and-noteworthy">New and noteworthy</h3>
|
||||
|
||||
<h4 id="java-13-support">Java 13 Support</h4>
|
||||
|
||||
<p>This release of PMD brings support for Java 13. PMD can parse <a href="http://openjdk.java.net/jeps/354">Switch Expressions</a>
|
||||
with the new <code class="highlighter-rouge">yield</code> statement and resolve the type of such an expression.</p>
|
||||
|
||||
<p>PMD also parses <a href="http://openjdk.java.net/jeps/355">Text Blocks</a> as String literals.</p>
|
||||
|
||||
<p>Note: The Switch Expressions and Text Blocks are a preview language feature of OpenJDK 13
|
||||
and are not enabled by default. In order to
|
||||
analyze a project with PMD that uses these language features, you’ll need to enable it via the environment
|
||||
variable <code class="highlighter-rouge">PMD_JAVA_OPTS</code> and select the new language version <code class="highlighter-rouge">13-preview</code>:</p>
|
||||
|
||||
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export PMD_JAVA_OPTS=--enable-preview
|
||||
./run.sh pmd -language java -version 13-preview ...
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Note: Support for the extended break statement introduced in Java 12 as a preview language feature
|
||||
will be removed with the next PMD version 6.19.0.</p>
|
||||
|
||||
<h4 id="full-support-for-scala">Full support for Scala</h4>
|
||||
|
||||
<p>Thanks to <a href="https://github.com/tophersmith">Chris Smith</a> PMD now fully supports Scala. Now rules for analyzing Scala
|
||||
code can be developed in addition to the Copy-Paste-Detection (CPD) functionality. There are no rules yet, so
|
||||
contributions are welcome.</p>
|
||||
|
||||
<p>Additionally Scala support has been upgraded from 2.12.4 to 2.13.</p>
|
||||
|
||||
<h4 id="new-rule-designer-documentation">New rule designer documentation</h4>
|
||||
|
||||
<p>The documentation for the rule designer is now available on the main PMD documentation page:
|
||||
<a href="pmd_userdocs_extending_designer_reference.html">Rule Designer Reference</a>. Check it out to learn
|
||||
about the usage and features of the rule designer.</p>
|
||||
|
||||
<h4 id="new-rules">New rules</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The Java rule <a href="pmd_rules_java_bestpractices.html#avoidmessagedigestfield"><code class="highlighter-rouge">AvoidMessageDigestField</code></a> (<code class="highlighter-rouge">java-bestpractices</code>) detects fields
|
||||
of the type <code class="highlighter-rouge">java.security.MessageDigest</code>. Using a message digest instance as a field would need to be
|
||||
synchronized, as it can easily be used by multiple threads. Without synchronization the calculated hash could
|
||||
be entirely wrong. Instead of declaring this as a field and synchronize access to use it from multiple threads,
|
||||
a new instance should be created when needed. This rule is also active when using java’s quickstart ruleset.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The Apex rule <a href="pmd_rules_apex_bestpractices.html#debugsshoulduselogginglevel"><code class="highlighter-rouge">DebugsShouldUseLoggingLevel</code></a> (<code class="highlighter-rouge">apex-bestpractices</code>) detects
|
||||
usages of <code class="highlighter-rouge">System.debug()</code> method calls that are used without specifying the log level. Having the log
|
||||
level specified provides a cleaner log, and improves readability of it.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4 id="modified-rules">Modified Rules</h4>
|
||||
|
||||
<ul>
|
||||
<li>The Java rule <a href="pmd_rules_java_errorprone.html#closeresource"><code class="highlighter-rouge">CloseResource</code></a> (<code class="highlighter-rouge">java-errorprone</code>) now ignores by default instances
|
||||
of <code class="highlighter-rouge">java.util.stream.Stream</code>. These streams are <code class="highlighter-rouge">AutoCloseable</code>, but most streams are backed by collections,
|
||||
arrays, or generating functions, which require no special resource management. However, there are some exceptions:
|
||||
The stream returned by <code class="highlighter-rouge">Files::lines(Path)</code> is backed by a actual file and needs to be closed. These instances
|
||||
won’t be found by default by the rule anymore.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="fixed-issues">Fixed Issues</h3>
|
||||
|
||||
<ul>
|
||||
<li>all
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1465">#1465</a>: [core] Stylesheet pmd-report.xslt fails to display filepath if ‘java’ in path</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1923">#1923</a>: [core] Incremental analysis does not work with shortnames</li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1983">#1983</a>: [core] Avoid crashes with analysis cache when classpath references non-existing directories</li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1990">#1990</a>: [core] Incremental analysis mixes XPath rule violations</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>apex
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1901">#1901</a>: [apex] Expose super type name of UserClass</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1942">#1942</a>: [apex] Add best practice rule for debug statements in Apex</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>java
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1930">#1930</a>: [java] Add Java 13 support</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>java-bestpractices
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1227">#1227</a>: [java] UnusedFormalParameter should explain checkAll better</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1862">#1862</a>: [java] New rule for MessageDigest.getInstance</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1952">#1952</a>: [java] UnusedPrivateField not triggering if @Value annotation present</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>java-codestyle
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1951">#1951</a>: [java] UnnecessaryFullyQualifiedName rule triggered when variable name clashes with package name</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>java-errorprone
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1922">#1922</a>: [java] CloseResource possible false positive with Streams</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1966">#1966</a>: [java] CloseResource false positive if Stream is passed as method parameter</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1967">#1967</a>: [java] CloseResource false positive with late assignment of variable</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>plsql
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1933">#1933</a>: [plsql] ParseException with cursor declared in anonymous block</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1935">#1935</a>: [plsql] ParseException with SELECT INTO record defined as global variable</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1936">#1936</a>: [plslq] ParseException with cursor inside procedure declaration</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1946">#1946</a>: [plsql] ParseException with using TRIM inside IF statements condition</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1947">#1947</a>: [plsql] ParseError - SELECT with FOR UPDATE OF</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1948">#1948</a>: [plsql] ParseException with INSERT INTO using package global variables</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1950">#1950</a>: [plsql] ParseException with UPDATE and package record variable</li>
|
||||
<li><a href="https://github.com/pmd/pmd/issues/1953">#1953</a>: [plsql] ParseException with WITH in CURSOR</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="api-changes">API Changes</h3>
|
||||
|
||||
<h4 id="changes-to-renderer">Changes to Renderer</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Each renderer has now a new method <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/renderers/Renderer.html#setUseShortNames(List)"><code class="highlighter-rouge">Renderer#setUseShortNames</code></a> which
|
||||
is used for implementing the “shortnames” CLI option. The method is automatically called by PMD, if this
|
||||
CLI option is in use. When rendering filenames to the report, the new helper method
|
||||
<a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/renderers/AbstractRenderer.html#determineFileName(String)"><code class="highlighter-rouge">AbstractRenderer#determineFileName</code></a> should be used. This will change
|
||||
the filename to a short name, if the CLI option “shortnames” is used.</p>
|
||||
|
||||
<p>Not adjusting custom renderers will make them render always the full file names and not honoring the
|
||||
CLI option “shortnames”.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4 id="deprecated-apis">Deprecated APIs</h4>
|
||||
|
||||
<h5 id="for-removal">For removal</h5>
|
||||
|
||||
<ul>
|
||||
<li>The methods <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.18.0/net/sourceforge/pmd/lang/java/ast/ASTImportDeclaration.html#getImportedNameNode()"><code class="highlighter-rouge">getImportedNameNode</code></a> and
|
||||
<a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.18.0/net/sourceforge/pmd/lang/java/ast/ASTImportDeclaration.html#getPackage()"><code class="highlighter-rouge">getPackage</code></a> have been deprecated and
|
||||
will be removed with PMD 7.0.0.</li>
|
||||
<li>The method <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/RuleContext.html#setSourceCodeFilename(String)"><code class="highlighter-rouge">RuleContext#setSourceCodeFilename</code></a> has been deprecated
|
||||
and will be removed. The already existing method <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/RuleContext.html#setSourceCodeFile(File)"><code class="highlighter-rouge">RuleContext#setSourceCodeFile</code></a>
|
||||
should be used instead. The method <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/RuleContext.html#getSourceCodeFilename()"><code class="highlighter-rouge">RuleContext#getSourceCodeFilename</code></a> still
|
||||
exists and returns just the filename without the full path.</li>
|
||||
<li>The method <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/processor/AbstractPMDProcessor.html#filenameFrom(DataSource)"><code class="highlighter-rouge">AbstractPMDProcessor#filenameFrom</code></a> has been
|
||||
deprecated. It was used to determine a “short name” of the file being analyzed, so that the report
|
||||
can use short names. However, this logic has been moved to the renderers.</li>
|
||||
<li>The method <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/Report.html#metrics()"><code class="highlighter-rouge">Report#metrics</code></a> and <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/Report.html#"><code class="highlighter-rouge">Report</code></a> have
|
||||
been deprecated. They were leftovers from a previous deprecation round targeting
|
||||
<a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/lang/rule/stat/StatisticalRule.html#"><code class="highlighter-rouge">StatisticalRule</code></a>.</li>
|
||||
</ul>
|
||||
|
||||
<h5 id="internal-apis">Internal APIs</h5>
|
||||
|
||||
<p>Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0. You can identify them with the <code class="highlighter-rouge">@InternalApi</code> annotation. You’ll also get a deprecation warning.</p>
|
||||
|
||||
<ul>
|
||||
<li>pmd-core
|
||||
<ul>
|
||||
<li><a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.18.0/net/sourceforge/pmd/cache/package-summary.html#"><code class="highlighter-rouge">net.sourceforge.pmd.cache</code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>pmd-java
|
||||
<ul>
|
||||
<li><a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.18.0/net/sourceforge/pmd/lang/java/typeresolution/package-summary.html#"><code class="highlighter-rouge">net.sourceforge.pmd.lang.java.typeresolution</code></a>: Everything, including
|
||||
subpackages, except <a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.18.0/net/sourceforge/pmd/lang/java/typeresolution/TypeHelper.html#"><code class="highlighter-rouge">TypeHelper</code></a> and
|
||||
<a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.18.0/net/sourceforge/pmd/lang/java/typeresolution/typedefinition/JavaTypeDefinition.html#"><code class="highlighter-rouge">JavaTypeDefinition</code></a>.</li>
|
||||
<li><a href="https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.18.0/net/sourceforge/pmd/lang/java/ast/ASTCompilationUnit.html#getClassTypeResolver()"><code class="highlighter-rouge">ASTCompilationUnit#getClassTypeResolver</code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="external-contributions">External Contributions</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1943">#1943</a>: [apex] Adds “debug should use logging level” best practice rule for Apex - <a href="https://github.com/renatoliveira">Renato Oliveira</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1965">#1965</a>: [scala] Use Scalameta for parsing - <a href="https://github.com/tophersmith">Chris Smith</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1970">#1970</a>: [java] DoubleBraceInitialization: Fix example - <a href="https://github.com/tweimer">Tobias Weimer</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1971">#1971</a>: [java] 1862 - Message Digest should not be used as class field - <a href="https://github.com/AnthonyKot">AnthonyKot</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1972">#1972</a>: [plsql] ParseError - SELECT with FOR UPDATE OF - <a href="https://github.com/szyman23">Piotr Szymanski</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1974">#1974</a>: [plsql] Fixes for referencing record type variables - <a href="https://github.com/szyman23">Piotr Szymanski</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1975">#1975</a>: [plsql] TRIM function with record type variables - <a href="https://github.com/szyman23">Piotr Szymanski</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1976">#1976</a>: [plsql] Fix for mistaking / for MultiplicativeExpression - <a href="https://github.com/szyman23">Piotr Szymanski</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1977">#1977</a>: [plsql] fix for skipping sql starting with WITH - <a href="https://github.com/szyman23">Piotr Szymanski</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1986">#1986</a>: [plsql] Fix for cursors in anonymous blocks - <a href="https://github.com/szyman23">Piotr Szymanski</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/1994">#1994</a>: [core] Resolve pmd-report failure when java folder in filepath - <a href="https://github.com/shahamish150294">Amish Shah</a></li>
|
||||
<li><a href="https://github.com/pmd/pmd/pull/2015">#2015</a>: [java] Update doc for unused formal parameter - <a href="https://github.com/shahamish150294">Amish Shah</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<div class="tags">
|
||||
|
Reference in New Issue
Block a user