-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[core] Rule Violation Fixes applier flow for AST #856
Conversation
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.
This PR has a lot of repeated code from #850 which makes it really hard to audit. Please, rework it to have it separately.
* @param applicableCompilationUnits the list of applicable compilation units on which to apply and fix the rules | ||
* @param context the context which the visitors will have | ||
*/ | ||
public void applyWithAutoFixes(final List<? extends Node> applicableCompilationUnits, final RuleContext context) { |
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.
do we really need to copy / paste 30+ lines to have an exact duplicate of apply
that merely adds a context.getRuleViolationFixesApplier().applyAutoFixesAndClear();
?
* @param context the context passed to the visitors | ||
* @param language The AST source | ||
*/ | ||
public void applyWithAutoFixes(final List<Node> applicableCompilationUnits, final RuleContext context, final Language language) { |
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.
ditto
/** | ||
* Apply, in order of insertion, the auto fixes for the nodes. In the end it calls the {@link #clear()} method. | ||
*/ | ||
public void applyAutoFixesAndClear() { |
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.
what's the benefit in reusing the same instance? Why do we keep both versions of these methods? It seems to me we will always want to use the later, and that it's a hack just to avoid instantiating more RuleViolationFixesApplier
. To what end, I'm not sure
We are closing this as it has been deprecated in favor of a new autofixes approach. See #693. |
Summary
Implements #693:
RuleViolationFix operations for AST should be stored and applied after application of rule chain and application of every rule so that the following rule may have the most updated representation of the AST.
Additions
Note
Consider looking only at the following commit which is dependant on the commits of #850: e9a3070. After merging the mentioned PR, this note can be deleted.