Skip to content

[core] Autofixes feature development #693

@MatiasComercio

Description

@MatiasComercio

Autofixes

Hi to everyone! We are developing autofixes for PMD! 🎉
Together with @gibarsin, and with @jsotuyod as our mentor, we are implementing all the autofixes features listed here.

This issue will serve as our roadmap for all the changes that we are going to implement, linking the pull requests that implement each of the changes listed below. Note that we will be updating this list as ideas or suggestions arise.

Any feedback, suggestion or idea you may have will be really appreciated and of course welcomed.

We hope, and it is our intention, that autofixes get fully implemented by July, 2018.

That's all for now! Thanks in advance to everyone making this HUGE feature possible with feedback, bug reports (we hope not 😄), and any kind of help you may give us.

List of changes

  • [core] - Add AST operation over nodes (addChild, setChild, removeChild, remove)
  • [core] - Update tokens according to AST operations
  • [core] - Store a Fix when reporting a new rule violation
  • [core] - Apply stored Fixes after each rule finishes traversing the AST
  • [core] - Update the source code file with the applied fixes
  • [core] - Cache diff operations for fixed files when autofixes are disabled (and cache is enabled)
  • [core] - Apply cached diff operations
  • [core] - Add autofix as a command line parameter

Bare in mind issues

  • Add a lock system to avoid node manipulation outside autofix rules
    • Consider this comment
    • Another option may be to have a common object with all nodes of the same AST pointing to it to implement the control of these modifications, but we have to discuss it yet.

Extras

Deprecated changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancementAn improvement on existing features / rulesin:autofixesAffects the autofixes framework

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions