Skip to content

[Feature request] Option to do sanity checks on output #1353

Open
@reinux

Description

@reinux

I propose we ...

Do sanity checks to ensure the output matches the semantics of the input

The existing way of Fantomas deals with this problem is ...

If it breaks something, there isn't any guarantee that anyone will notice

Pros and Cons

The advantages of making this adjustment to Fantomas are ...

  • Ensure that Fantomas doesn't introduce bugs in code or delete code etc.
  • Confidence for use in production
  • More robust unit tests

The disadvantages of making this adjustment to Fantomas are ...

  • Slight performance hit
  • Need to consider situations where AST differs but behavior doesn't (e.g. superfluous brackets)

Examples

Please provide multiple examples (before and after scenarios) and explain what rules did apply to achieve the outcome.

A bug like #1352 provides an error message instead of producing incorrect code without warning.

Extra information

Estimated cost (XS, S, M, L, XL, XXL):

M

Related suggestions: (put links to related suggestions here)

I would prefer that Fantomas refuse to change code if it incorrectly thinks it may have changed the semantics, than for it to produce code that may or may not compile but is nonetheless wrong.

Affidavit (please submit!)

Please tick this by placing a cross in the box:

Please tick all that apply:

  • This is not a breaking change to Fantomas
  • I or my company would be willing to help implement and/or test this
  • This suggestion is part of the Microsoft style guide (please add a link to section if so)
  • This suggestion is part of the G-Research style guide (please add a link to section if so)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions