scalafix icon indicating copy to clipboard operation
scalafix copied to clipboard

Provide an option to look at linting errors without doing any rewrites

Open Prithvirajbilla opened this issue 6 years ago • 2 comments

Problem

When writing linting rules which can possibly do a autofix/rewrite, it would be nice to have an option to run all linting rules to see what the errors were without doing a rewrite. And then run scalafix again to rewrite the linting errors which have an autofix.

For e.g: Let's say I want to write a linter rule which enforces javaconverters over java conversions. It would be good if it let the dev know other helpful information in linting message and an option to autofix it. currently we either do a check (--check flag) which prints patch to terminal (not pleasant) or automatic rewrite (with out --check flag)

Proposal

Add an option --dry-run (name upfor debate), which prints out only Patch.Lint messages to terminal without doing any rewrites and Optionally, letting users know there is a possibility of fixing few linting errors.

Prithvirajbilla avatar Mar 19 '19 14:03 Prithvirajbilla

other naming options for --dry-run could be --lint. but like the --dry-run better

Prithvirajbilla avatar Mar 19 '19 14:03 Prithvirajbilla

https://github.com/scalacenter/scalafix/pull/1737 kind of addresses this, not from an end-user perspective, but from a client one

bjaglin avatar Jun 30 '23 23:06 bjaglin