rewrite
rewrite copied to clipboard
Add support for MethodParamPadding to java style auto-detection
Issue discovered with src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
Problem
Error: src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java:[494] (sizes) LineLength: Line is longer than 120 characters (found 124). Error: src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java:[494,84] (whitespace) ParenPad: '(' is not followed by whitespace. Error: src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java:[494,122] (whitespace) ParenPad: ')' is not preceded with whitespace.
Expected behavior
Method Parameter Padding and Line Lenght style violations should not fail
Example diff
{
try
{
- if ( sourceDirectoryToCheck.getCanonicalPath().startsWith( excludeDir.getCanonicalPath() ) )
+ if ( sourceDirectoryToCheck.getCanonicalFile().toPath().startsWith(excludeDir.getCanonicalFile().toPath()) )
{
getLog().debug( "Directory " + sourceDirectoryToCheck.getAbsolutePath()
+ " has been excluded as it matches excludeRoot "
https://github.com/apache/maven-build-cache-extension/blob/master/src/main/java/org/apache/maven/buildcache/CacheUtils.java
while ( entry != null )
{
Path file = out.resolve( entry.getName() );
+ if (!file.normalize().startsWith(out.normalize())) {
+ throw new RuntimeException("Bad zip entry");
+ }
if ( entry.isDirectory() )
{
Files.createDirectory( file );
Recipes in example diff:
- org.openrewrite.java.security.PartialPathTraversalVulnerability
References:
- Recipe ID:
undefined
- Recipe Name: "Partial path traversal vulnerability"
- Repository: apache/maven-pmd-plugin/master
- Created at Fri Jul 29 2022 07:21:08 GMT-0700 (Pacific Daylight Time)
Still requires update for AutoDecting Spaces#Within.MethodCallParentheses