344 Commits

Author SHA1 Message Date
Andreas Dangel
d92688a07d Introduce end-of-line normalization
References pmd/build-tools#2
2017-02-02 20:52:08 +01:00
Andreas Dangel
ae42081159 Merge branch 'issue-213'
Fixes #213
Closes #198 (rebased onto pmd/5.4.x)
2017-01-27 12:19:46 +01:00
Juan Martín Sotuyo Dodero
c2d22a1bdf Make Mark's code snippet lazy
- This greatly reduces the memory footprint during analysis,
    addressing part of the issues raised ay #185
 - Rendering is still done to a single String which is then either printed
    to STDOUT or a file, this stiill needs refactoring.
2017-01-27 12:01:46 +01:00
Andreas Dangel
61792f792f Merge branch 'pr-190'
Closes #190 (rebased onto pmd/5.4.x)
2017-01-22 19:49:48 +01:00
Juan Martín Sotuyo Dodero
3caa71b94b Resolve #180 - refactor pmd processors
- SourceCodeProcessor now consistently calls rule sets start / end
    if cache is not up to date
 - Both Mono and MultiThread Processors rely on PmdRunnable, just using
    different execution strategies
 - This also fixes https://sourceforge.net/p/pmd/bugs/1511/
2017-01-22 19:19:21 +01:00
Andreas Dangel
2efe75fac5 Merge branch 'unit-test-for-pr-170' 2017-01-21 13:53:57 +01:00
Andreas Dangel
4c1890d56c Add unit test to verify encoding of XML formatter 2017-01-21 11:58:59 +01:00
Juan Martín Sotuyo Dodero
552bb7eabf Merge branch 'pr-170' 2017-01-10 10:20:10 -03:00
pyxide
43a38d3144 Console encoding only when interactive 2017-01-10 09:54:44 -03:00
pyxide
d7c503bee4 checkstyle fixes 2017-01-10 09:54:44 -03:00
pyxide
958f8df5f5 Reflection detection code for console encoding
Note: calling the static native method `String Console.encoding()` returns the current console encoding, even if `System.console()` is null because the console is not interactive (pipe or redirection).
2017-01-10 09:54:44 -03:00
pyxide
89600bfcc4 checkstyle fixes 2017-01-10 09:54:44 -03:00
pyxide
abf65acb63 Bug fix and enhanced console output encoding
- due to some rewriting without testing, the encoding property was not added to the renderer properties.
- better console encoding: use system property `sun.stdout.encoding` in interactive console, and `file.encoding` in piped or redirected output
2017-01-10 09:54:44 -03:00
pyxide
4c71b0da4a checkstyle fixes 2017-01-10 09:54:44 -03:00
pyxide
368313fd8f Update Formatter.java 2017-01-10 09:54:44 -03:00
pyxide
74583d003a Ant Task Formatter encoding issue with XMLRenderer
Hi,

The writers in the Ant task's formatter uses the default platform's encoding (for instance cp1252 on Western Windows) and the XMLRenderer sets the default XML encoding to UTF-8. This may lead to incorrect XML encoding, detected for instance when the XML file is sent to a XSLT task.
This goes undetected as long as the characters in the XML file are in the ASCII subset, which is frequently the case with code, usually in plain Latin language. In my case, the issue was raised because of the localized formatting of some line numbers greater than 999, due to localized thousand separator 0xA0, which is out of the ASCII subset.

I modified the Formatter class to always use a charset for writers. When no encoding is specified, UTF-8 is used instead of the default platform's encoding.

I strongly recommend to *always set the encoding parameter* of the formatter element. It should be reflected as so in the Ant Task documentation.

```xml
<pmd encoding="cp1252"> <!-- source encoding -->
  <formatter type="xml" toFile="pmd.xml">
    <param name="encoding" value="UTF-8" /> <!-- report encoding -->
  </formatter>
  <fileset dir="src/main/java">
    <include name="**/*.java"/>
  </fileset>
</pmd>
```
Note: when digging into sourceforge issues for similar bugs, I found [Bug 877: Output with encoding CP1252](https://sourceforge.net/p/pmd/bugs/877/) . Not the same task, but the same symptoms, probably the same cause ?
2017-01-10 09:54:44 -03:00
Andreas Dangel
e1d12dd4f8 Further Javadoc doclint fixes
References #1516 [build] doclint error during build
2017-01-07 17:05:03 +01:00
Andreas Dangel
3277febd88 [core] Javadoc doclint fixes
References #1516 [build] doclint error during build
2017-01-05 20:20:54 +01:00
Andreas Dangel
a1825c4114 Javadoc doclint fixes
References #1516 [build] doclint error during build
2017-01-05 18:31:06 +01:00
Andreas Dangel
2c714e1fbc Merge branch 'pr-164'
Closes #164 (rebased onto pmd/5.5.x)
2017-01-03 12:19:45 +01:00
Juan Martín Sotuyo Dodero
932ad7dd2b Reduce memory allocations during symbol table 2017-01-03 12:07:30 +01:00
Andreas Dangel
c9ada390db Merge branch 'pr-161'
Closes #161 (rebased onto pmd/5.5.x)
2017-01-03 11:33:24 +01:00
Juan Martín Sotuyo Dodero
b950929b7c Improve symboltable codebase
- Move shared code to pmd-core
 - Allow search methods to stop searching when they want to
 - If we are looking for a variable declaration, just search among those and not all name declarations
 - This is roughtly another 10% improvement on symbol table performance
2017-01-03 11:22:42 +01:00
Andreas Dangel
7a46613043 Merge branch 'issue-1512' of https://github.com/Monits/pmd into pr-156 2017-01-03 09:29:56 +01:00
Juan Martín Sotuyo Dodero
729b843254 Merge branch 'pr-173' 2017-01-02 15:41:11 -03:00
Juan Martín Sotuyo Dodero
b937ebd80f Add new rule to release 2017-01-02 15:28:11 -03:00
Andreas Dangel
feb79d5213 Fix checkstyle 2016-12-23 18:24:32 +01:00
Andreas Dangel
544d22f9b8 Merge branch 'checksum-aware' of https://github.com/Monits/pmd into pr-145 2016-12-23 18:21:50 +01:00
Andreas Dangel
eb2d942ed4 pmd-core: checkstyle fixes 2016-12-16 12:32:18 +01:00
Juan Martín Sotuyo Dodero
9e9d133af4 Merge branch 'pr-160' 2016-12-13 10:13:20 -03:00
Juan Martín Sotuyo Dodero
2aacbca341 Add ApexDangerousMethods to releases/553.xml 2016-12-13 10:04:33 -03:00
Andreas Dangel
bc8cadc847 Merge branch 'cache-dir-creation' of https://github.com/Monits/pmd into pr-144 2016-12-10 10:39:48 +01:00
Andreas Dangel
b5b9ed7bc7 Merge branch 'symboltable-tidyup' of https://github.com/Monits/pmd into pr-139 2016-12-09 09:29:55 +01:00
Juan Martín Sotuyo Dodero
efebb1ef6b Unify AvoidConstantsInterface and ConstantsInInterface
- We stick to ConstantsInInterface since it covers all scenarios the other one did,
    and allows greater configuration.
 - The existing test cases were already covered, so we can safely drop them.
2016-12-08 18:04:37 -03:00
Andreas Dangel
f10a1ecab7 Merge branch 'pmd/5.5.x'
# Conflicts:
#	pmd-core/src/main/java/net/sourceforge/pmd/util/ClasspathClassLoader.java
2016-12-03 19:09:56 +01:00
Andreas Dangel
220a1f98a8 Update releases/553.xml ruleset 2016-12-03 19:08:34 +01:00
Juan Martín Sotuyo Dodero
c296560921 Make ClasspathClassLoader parallel capable
- It's just a bunch of static methods with no state on a URLClassLoader
 - We should probably review if this class makes sense at all, or should
    be replaced with helper methods on top of PMDASMClassLoader
2016-12-03 19:00:32 +01:00
Andreas Dangel
0d72228d26 Checkstyle fixes 2016-12-03 18:47:09 +01:00
Andreas Dangel
ae593c934b Merge branch 'parallel-classloader' of https://github.com/Monits/pmd into pr-138 2016-12-03 18:43:14 +01:00
Andreas Dangel
d2bc0f3739 Checkstyle fixes 2016-12-03 11:31:01 +01:00
Andreas Dangel
617c6c622c Merge remote-tracking branch 'origin/master' into codestyle
# Conflicts:
#	pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java
#	pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java
#	pmd-core/src/main/java/net/sourceforge/pmd/RuleSets.java
#	pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java
#	pmd-core/src/main/java/net/sourceforge/pmd/SourceCodeProcessor.java
#	pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SourceCodePositioner.java
#	pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AttributeAxisIterator.java
#	pmd-core/src/main/java/net/sourceforge/pmd/lang/symboltable/AbstractScope.java
#	pmd-core/src/main/java/net/sourceforge/pmd/processor/MonoThreadProcessor.java
#	pmd-core/src/main/java/net/sourceforge/pmd/processor/MultiThreadProcessor.java
#	pmd-core/src/test/java/net/sourceforge/pmd/ConfigurationTest.java
#	pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java
#	pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/imports/UnnecessaryFullyQualifiedNameRule.java
#	pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/TypeSet.java
#	pmd-java/src/test/java/net/sourceforge/pmd/lang/java/symboltable/ClassScopeTest.java
#	pmd-java/src/test/java/net/sourceforge/pmd/lang/java/symboltable/STBBaseTst.java
#	pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java
#	pmd-xml/src/test/java/net/sourceforge/pmd/lang/xml/XmlParserTest.java
2016-12-02 15:42:31 +01:00
Andreas Dangel
62bb803810 checkstye: remove old configuration files 2016-12-02 15:13:32 +01:00
Andreas Dangel
9a39c3ec02 pmd-core: checkstyle - use module specific suppressions file 2016-12-02 09:13:50 +01:00
Juan Martín Sotuyo Dodero
1d6c9327a0 Refactor RuleSet creation
- RuleSet is now immutable
 - RuleSets are created through a RuleSetBuilder
 - RuleSetBuilder is accessed solely from RuleSetFactory
 - RuleSetFactory can now either parse XMLs for rule set creation,
    or create single rule rulesets
2016-11-30 15:25:19 -03:00
Juan Martín Sotuyo Dodero
1c387e3515 [core] Create missing intermediate directories for cache
If the cache location points to a file within a non-existing directory
   make sure to create it for storage to succeed.
2016-11-29 16:55:11 -03:00
Juan Martín Sotuyo Dodero
52ee5e9b0b Tiny improvements and code tidy up 2016-11-28 02:23:24 -03:00
Juan Martín Sotuyo Dodero
896233c2b5 Make ClasspathClassLoader parallel capable
- It's just a bunch of static methods with no state on a URLClassLoader
 - We should probably review if this class makes sense at all, or should
    be replaced with helper methods on top of PMDASMClassLoader
2016-11-28 02:15:50 -03:00
Andreas Dangel
a6e3a20d19 Merge branch 'issue-1545'
Closes #134
PR has been rebased for 5.5.x
2016-11-26 20:03:55 +01:00
Juan Martín Sotuyo Dodero
268c62e772 Symbol table can now handle inner classes
- Types are now attempted to be resolved as inner classes if public attempt fails
 - ClassScope offers a `resolveType` method that qualifies the name as per local rules
    before resolution
2016-11-26 19:53:53 +01:00
Andreas Dangel
f02a009f24 Merge branch 'thread-safe-rsfactory' of https://github.com/Monits/pmd into pr-131 2016-11-26 17:51:33 +01:00