Skip to content
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

Add a default set of rules for running scalafix #3330

Open
2 tasks
Gedochao opened this issue Nov 28, 2024 · 3 comments
Open
2 tasks

Add a default set of rules for running scalafix #3330

Gedochao opened this issue Nov 28, 2024 · 3 comments
Labels
enhancement New feature or request experimental Tickets tied to experimental features. scalafix Issues tied with scalafix integration subcommand:fix issues tied to the `fix` sub-command.

Comments

@Gedochao
Copy link
Contributor

Is your feature request related to a problem? Please describe.
We currently require a .scalafix.conf file to be present in the project.
We should use a predefined default set of rules, if none are provided.

Describe the solution you'd like

  • when scalafix is run in a directory with no .scalafix.conf, a set of default rules should be run (the temp config file can be kept in the .scala-build workspace directory)
  • there should be a command line option for persisting the default set of rules in a .scalafix.conf file in the project root directory
@Gedochao Gedochao added enhancement New feature or request subcommand:fix issues tied to the `fix` sub-command. scalafix Issues tied with scalafix integration labels Nov 28, 2024
@Gedochao
Copy link
Contributor Author

@bjaglin @dos65 @Vigorge @tgodzik
Any suggestions on what rules should be enabled by default?

@Gedochao Gedochao added the experimental Tickets tied to experimental features. label Nov 28, 2024
@tgodzik
Copy link
Member

tgodzik commented Nov 28, 2024

That is an interesting question, since it might be highly subjective. 🤔

I think OrganizeImports is a pretty sure one.

Let's maybe create a list:

  • ExplicitResultTypes <- this still needs some work for Scala 3

  • NoAutoTupling Inserts explicit tuples for adapted argument lists for compatibility with -Yno-adapted-args <- not super neccessary

  • OrganizeImports <- 100% and should be safe

  • RemoveUnused <- this one is also safe and only removes anything reported by the compiler under -Wunused

  • DisableSyntax Reports an error for disabled features such as var or XML literals. <- I don't think we need this one

  • LeakingImplicitClassVal - Adds 'private' to val parameters of implicit value classes <- also looks pretty safe

  • NoValInForComprehension Removes deprecated val inside for-comprehension binders <- should also be safe

  • ProcedureSyntax Replaces deprecated Scala 2.x procedure syntax with explicit ': Unit =' <- feels sensible

  • RedundantSyntax Removes redundant syntax such as final modifiers on an object <- also ok

@dos65
Copy link
Contributor

dos65 commented Nov 28, 2024

I like Tomek's list above.

I think OrganizeImports + RemoveUnused fall into MUST category.
Also it would be nice to automatically or by default add -Wunused flag without explicit notification to user that it's required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental Tickets tied to experimental features. scalafix Issues tied with scalafix integration subcommand:fix issues tied to the `fix` sub-command.
Projects
None yet
Development

No branches or pull requests

3 participants