Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Allow linters to disable 'yes to all' autofixes #86

Closed
fredemmott opened this issue Jun 21, 2018 · 0 comments · Fixed by #516
Closed

Allow linters to disable 'yes to all' autofixes #86

fredemmott opened this issue Jun 21, 2018 · 0 comments · Fixed by #516

Comments

@fredemmott
Copy link
Contributor

Some linters have unsafe autofixes, for example, the 'basic assignment' linter also detects accidental invariant($foo = $bar, ...)

lexidor added a commit to lexidor/hhast that referenced this issue Sep 17, 2022
fixes hhvm#86
In order to make this change backwards compatible,
allowYesToAll() defaults to true.
Unsafe linters may override this to false.
I also considered a default of false,
but that would entail altering all safe linters (including third-party).
Unsafe linters may need to suppress `must use override` linter
if they wish to remain compatible with previous versions of hhast.
@Atry Atry closed this as completed in #516 Sep 21, 2022
Atry pushed a commit that referenced this issue Sep 21, 2022
* Configure "yes to all" per linter
fixes #86
In order to make this change backwards compatible,
allowYesToAll() defaults to true.
Unsafe linters may override this to false.
I also considered a default of false,
but that would entail altering all safe linters (including third-party).
Unsafe linters may need to suppress `must use override` linter
if they wish to remain compatible with previous versions of hhast.

* Add allowYesToAll() to unsafe linters
Some linters look like they might be unsafe, but aren't on close inspection.
I added allowYesToAll(): bool { return true; } on those.
I checked every autofixing linter.
If I could not find a bad autofix, I left the linter untouched.

* Revert allowYesToAll to true

I changed this during testing and forgot to flip it back.

* Correct mistaken variable name in comment

The example first used `$a` as a meta syntactic variable.
I later changed to `$k` and `$v` for key and value.
I didn't update every use of `$_a`.

* Move allowYesToAll() down the type hierarchy
Suggested in a code review.
This only makes sense for autofixing linters.

* Rename allowYesToAll() to areBulkAutoFixesSafe()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant