-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds per codemod Includes/Excludes #438
Changes from all commits
8aed515
33f495a
c5b9924
6b66393
0df51f2
f2c89e4
ab03c27
df5de2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import com.github.javaparser.ast.CompilationUnit; | ||
import io.codemodder.codetf.UnfixedFinding; | ||
import io.codemodder.javaparser.JavaParserChanger; | ||
import java.nio.file.Path; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
@@ -29,6 +30,17 @@ protected CompositeJavaParserChanger(final JavaParserChanger... changers) { | |
this.changers = Arrays.asList(Objects.requireNonNull(changers)); | ||
} | ||
|
||
@Override | ||
public IncludesExcludesPattern getIncludesExcludesPattern() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem right, but not sure I have another proposal right now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally this would be an intersection of all the patterns. But I'm not sure we can calculate this with just the patterns themselves. |
||
// The first changer will dictate which files this composition accepts | ||
return changers.get(0).getIncludesExcludesPattern(); | ||
} | ||
|
||
@Override | ||
public boolean supports(final Path file) { | ||
return changers.stream().anyMatch(c -> c.supports(file)); | ||
} | ||
|
||
@Override | ||
public CodemodFileScanningResult visit( | ||
final CodemodInvocationContext context, final CompilationUnit cu) { | ||
|
@@ -44,9 +56,4 @@ public CodemodFileScanningResult visit( | |
|
||
return CodemodFileScanningResult.from(changes, unfixedFindings); | ||
} | ||
|
||
@Override | ||
public boolean shouldRun() { | ||
return changers.stream().anyMatch(CodeChanger::shouldRun); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we expose the actual values so both the tests and the CLI use the same values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLI doesn't use these default includes anymore.
Do you still want these to be the default values for find-and-fix codemods? Right now every javaparser based one will only have
**.java
as its pattern.