GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.pmd-code.org — Best Practices | PMD Source Code Analyzer
Release date: 28-December-2026
Best PracticesRules which enforce generally accepted best practices.
Table of ContentsAvoidWithStatementSince: PMD 5.0.1 Priority: High (1) Avoid using with - it’s bad news This rule is defined by the following XPath expression: Example(s): Use this rule by referencing it: ConsistentReturnSince: PMD 5.0 Priority: Medium High (2) ECMAScript does provide for return types on functions, and therefore there is no solid rule as to their usage. However, when a function does use returns they should all have a value, or all with no value. Mixed return usage is likely a bug, or at best poor style. This rule is defined by the following Java class: net.sourceforge.pmd.lang.ecmascript.rule.bestpractices.ConsistentReturnRule Example(s): Use this rule by referencing it: GlobalVariableSince: PMD 5.0 Priority: High (1) This rule helps to avoid using accidentally global variables by simply missing the "var" declaration. Global variables can lead to side-effects that are hard to debug. This rule is defined by the following XPath expression: Example(s): Use this rule by referencing it: ScopeForInVariableSince: PMD 5.0 Priority: High (1) A for-in loop in which the variable name is not explicitly scoped to the enclosing scope with the ‘var’ keyword can refer to a variable in an enclosing scope outside the nearest enclosing scope. This will overwrite the existing value of the variable in the outer scope when the body of the for-in is evaluated. When the for-in loop has finished, the variable will contain the last value used in the for-in, and the original value from before the for-in loop will be gone. Since the for-in variable name is most likely intended to be a temporary name, it is better to explicitly scope the variable name to the nearest enclosing scope with ‘var’. This rule is defined by the following XPath expression: Example(s): Use this rule by referencing it: UseBaseWithParseIntSince: PMD 5.0.1 Priority: High (1) This rule checks for usages of parseInt. While the second parameter is optional and usually defaults to 10 (base/radix is 10 for a decimal number), different implementations may behave differently. It also improves readability, if the base is given. See also: parseInt() This rule is defined by the following XPath expression: Example(s): Use this rule by referencing it: |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |