1518 Commits

Author SHA1 Message Date
Andreas Dangel
2e006697e0 [core] Refactor XMLRenderer to use XMLStreamWriter
In order to properly support different encodings, a OutputStream
is needed. Then Java will take care of unmappaple characters
and encode them as entities for XML.

For backwards compatibility, a writer is still created and exposed.
2020-07-09 10:56:44 +02:00
Andreas Dangel
0bd9b1db6b [core] XMLRenderer - avoid unmappable characters for non UTF-8 encodings 2020-07-05 22:10:14 +02:00
Andreas Dangel
d927973244 [core] PMD XMLRenderer - correctly support encoding
The XMLRenderer uses by default UTF-8 encoding, but the
writer uses the system default encoding, which doesn't work
well together.

Provide new experimental API Renderer::setReportFile, so that
renderer implementations can create their own writers.
The default implementation in AbstractRenderer is backwards compatible.
2020-07-05 14:21:46 +02:00
Andreas Dangel
3bb091e26d [core] CPD: Also escape filename, explicitly set XML 1.0 2020-07-05 11:20:17 +02:00
Andreas Dangel
3004e76257 [core] CPD: Add correct XML 1.0 escaping for code snippets 2020-07-03 21:11:57 +02:00
Clément Fournier
596f27bf93 Checkstyle 2020-06-27 19:50:18 +02:00
Clément Fournier
2fac2df551 Format ruleset tests 2020-06-27 17:59:19 +02:00
Andreas Dangel
95d8e80c1b [maven-release-plugin] prepare for next development iteration 2020-06-27 11:31:27 +02:00
Andreas Dangel
a219b2e1be [maven-release-plugin] prepare release pmd_releases/6.25.0 2020-06-27 11:31:16 +02:00
Andreas Dangel
842bdb000c Merge branch 'pr-2609'
[core] Deprecate support for List attributes with XPath 2.0 #2609
2020-06-26 18:04:15 +02:00
Andreas Dangel
3831a8589c Merge branch 'pr-2574'
[java] New Performance Rule UseIOStreamsWithApacheCommonsFileItem #2574
2020-06-26 17:58:49 +02:00
Andreas Dangel
91868f3156 Deprecations for #2490 2020-06-26 10:37:24 +02:00
Andreas Dangel
6fded20178 Merge branch 'master' into perf-UseIOStreamsWithApacheCommonsFileItem 2020-06-22 19:32:29 +02:00
Andreas Dangel
c098936708 [core] Use DeprecatedAttribute.NO_REPLACEMENT for List attributes
Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
2020-06-22 19:18:55 +02:00
Clément Fournier
ae2b481aa2 Merge branch 'master' into perf-AvoidCalendarDateCreation 2020-06-21 17:42:25 +02:00
Andreas Dangel
9c48ad1523 [core] Deprecate support for List attributes with XPath 2.0
Fixes #2451
2020-06-20 14:44:21 +02:00
Andreas Dangel
534bfe3c55 Merge branch 'pr-2572'
[cpd] Allow CPD tests based on a text dump #2572
2020-06-18 20:09:58 +02:00
Clément Fournier
2cfec287db Merge branch 'master' into fix-xpath-rulechain 2020-06-18 17:16:23 +02:00
Clément Fournier
121fb55567 Add test case 2020-06-18 17:12:37 +02:00
Andreas Dangel
db89c43fb6 Merge branch 'pr-2566'
[java] Auxclasspath in PMD CLI does not support relative file path #2566
2020-06-18 15:04:49 +02:00
Andreas Dangel
4e0e2d14ba [core] Fix XPath 2.0 Rule Chain Analyzer
For the XPath expression

(//ForStatement | //WhileStatement | //DoStatement)//AssignmentOperator

we threw away "AssignmentOperator" and started visiting at this node.
But that's not possible, because that's not at the root of the expr.
2020-06-18 12:44:18 +02:00
Clément Fournier
05f3740832 Make method private 2020-06-14 02:31:28 +02:00
Clément Fournier
b976d6550d Preserve column numbers in AnyTokenizer 2020-06-14 00:42:15 +02:00
Clément Fournier
6eba9a827f Fix ruby lexer 2020-06-13 22:51:00 +02:00
Clément Fournier
d8c3831db8 Fix getSlice
The method path for when the
code is not loaded yet was incorrect.

This was hidden by the fact that tests
use a dummy tokenizer *before* cutting
out a slice, so that the code is in the
soft reference, and that code path is
never taken in the relevant tests.
2020-06-13 21:24:36 +02:00
Andreas Dangel
488f38871e [doc] Update release notes, refs #1932 2020-06-13 19:49:12 +02:00
Andreas Dangel
b8e1ec95e1 [doc] Update release notes, refs #1932 2020-06-13 18:59:23 +02:00
Clément Fournier
a976e9af47 Fix sourceCode test 2020-06-13 17:11:47 +02:00
Clément Fournier
1ee33c7c20 Normalize CPD newlines
Otherwise tests are not platform-independent.
Denormalizing to a platform-specific delimiter
should be done in the renderers
2020-06-13 16:57:57 +02:00
Clément Fournier
ceda6bb965 Fix newline-only tokens
This happens eg in XML. Previously the end column would have been zero. We can't blindly make it 1 because the end column is inclusive. So we instead use the last column of the previous line.
2020-06-13 14:46:55 +03:00
Clément Fournier
d405eab97f Fix java 7 incompatibility 2020-06-12 18:22:21 +02:00
Clément Fournier
43412b532b Fix column problem with Antlr multiline tokens 2020-06-12 18:15:33 +02:00
Andreas Dangel
5653400257 Merge branch 'pr-2519'
[java] Enable rule UnnecessaryCast (codestyle) #2519
2020-06-12 13:55:44 +02:00
Andreas Dangel
a171ab8512 [doc] Update release notes and releases ruleset 2020-06-12 13:54:40 +02:00
Andreas Dangel
28ea13e4f9 Merge branch 'pr-2567'
[c#] Fix CPD suppression with comments doesn't work #2551 #2567
2020-06-12 12:49:21 +02:00
Andreas Dangel
8defb2fde2 Add missing relativePath configuration in all pom modules 2020-06-07 12:36:58 +02:00
Andreas Dangel
1483918308 [core] Fix tests under Windows, fix space handling in test
Absolute paths under Windows use a drive letter...
2020-06-05 11:53:52 +02:00
LixonLookose
c7c31be6cc [c#] CPD suppression with comments doesn't work #2551
CPD Suppressions for c# fixed
test added
2020-06-04 17:53:22 +05:30
Andreas Dangel
08c6ffd719 [java] Auxclasspath in PMD CLI does not support relative file path
Fixes #2549
2020-06-04 12:27:07 +02:00
Andreas Dangel
ab04bdacdd [maven-release-plugin] prepare for next development iteration 2020-05-24 17:34:34 +02:00
Andreas Dangel
229cb2bdca [maven-release-plugin] prepare release pmd_releases/6.24.0 2020-05-24 17:34:25 +02:00
Andreas Dangel
6049126228 Merge branch 'pr-2465'
[dependencies] Upgrade hamcrest, mockito and JUnit #2465
2020-05-22 11:46:04 +02:00
Andreas Dangel
0cc00277d3 Merge branch 'pr-2474'
[core] Stop JavaCharStream from throwing Error #2474
2020-05-18 20:28:37 +02:00
Andreas Dangel
3449c9a372 Merge branch 'pr-2478'
[java] New rule: LiteralsFirstInComparisons #2478
2020-05-18 20:17:23 +02:00
Andreas Dangel
3305eeedd2 [core] Add new rule to releases ruleset for 6.24.0 2020-05-18 20:11:25 +02:00
Clément Fournier
35e9f7d1bd Doc 2020-05-16 19:19:48 +02:00
Clément Fournier
c5f73d137a Add test for invalid language version NPE
Refs https://github.com/pmd/pmd/pull/2486#discussion_r425381773
2020-05-16 19:07:09 +02:00
Juan Martín Sotuyo Dodero
465dead81c Optimize imports 2020-05-15 11:44:09 -03:00
Juan Martín Sotuyo Dodero
0f552ee620 Further refine the addVersion API 2020-05-15 11:42:28 -03:00
Juan Martín Sotuyo Dodero
d1e0f8c5fa Bring back binary compatibility 2020-05-14 16:30:06 -03:00