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

Merge OrganizeImports 0.6.0+37-596459af into Scalafix as a built-in rule #1480

Merged
merged 343 commits into from
Jun 3, 2023

Conversation

liancheng
Copy link
Contributor

@liancheng liancheng commented Sep 24, 2021

Per the discussion in liancheng/scalafix-organize-imports#215, this PR tries to merge the OrganizeImports rule into Scalafix as a built-in rule.

TODO:

Bonus:

  • keep git history
  • fail if RemoveUnused.imports & OrganizeImports.removeUnused are both enabled
  • Run scalafix with the local OrganizeImports rule on the scalafix codebase

liancheng and others added 30 commits April 30, 2020 01:55
dependabot bot and others added 5 commits July 6, 2022 13:55
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.1.0 to 3.1.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](codecov/codecov-action@v2.1.0...v3.1.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@matthughes
Copy link

Any updated status on this? The referenced issue #1528 appears merged. What is remaining?

@daddykotex
Copy link
Contributor

I'd be happy to pick up the work on this if there is anything left to be done

@tgodzik
Copy link
Contributor

tgodzik commented Mar 13, 2023

Not 100% sure what needs to be done, but probably if you are able to finish the rest of TODOs and raise another PR that would be great! @liancheng I worry might not have enough time on his hands to respond

@bjaglin what do you think? What do we need here to be done still?

Bumps [olafurpg/setup-scala](https://github.com/olafurpg/setup-scala) from 13 to 14.
- [Release notes](https://github.com/olafurpg/setup-scala/releases)
- [Commits](olafurpg/setup-scala@v13...v14)

---
updated-dependencies:
- dependency-name: olafurpg/setup-scala
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@liancheng
Copy link
Contributor Author

@tgodzik, sorry for the late response, but yeah, I'm afraid I no longer have cycles to maintain this project, and I don't have enough expertise to address Scala 3 related issues. I believe merging this rule into Scalafix is the best choice for the community.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 12, 2023

@daddykotex I think the remaining points need to be addressed so:

  • Move the test infra and test cases
  • Documentation

Otherwise a stretch goals would be:

  • Warn and shadow the original OrganizeImports rule under the com.github.liancheng package (probably needs to be reported in the original rule)
  • Bonus: fail if RemoveUnused.imports & OrganizeImports.removeUnused are both enabled

but I think two first points would be enough unless anyone else disagrees?

@bjaglin bjaglin force-pushed the organize-imports branch 3 times, most recently from 04a826c to e69ba2c Compare May 23, 2023 23:43
@bjaglin bjaglin force-pushed the organize-imports branch from e69ba2c to b10f4f2 Compare May 23, 2023 23:44
@bjaglin
Copy link
Collaborator

bjaglin commented May 24, 2023

Sorry for not getting back to you despite offering your help @daddykotex. I finally found some time to integrate the tests, the doc (asciidoc2markdown & a bunch of manual updates), as well as the git history (all changes happen in a merge commit so git blame does work quite OK), so the best at this point would be a review.

The GitHub UI does not play very well with merge commits as the diff is only done with the main parent, but you should be able to see the actual diff compared to the original repo by looking at liancheng@b10f4f2 with a local git tool git show b10f4f289d0b93741dabb916dbf01168c264ae74 -c --combined-all-paths -M10 --patience -w seems to do the trick. Transformed with sed 's/^ -/-/' | sed 's/^ +/ /' | sed 's/^+ / /' | sed 's/^++/+/', it gives a somewhat readable diff.

Warn and shadow the original OrganizeImports rule under the com.github.liancheng package (probably needs to be reported in the original rule)

I ran a quick test to ensure that having 2 OrganizeImports available in the classpath for the ServiceLoader does not result in any error, and that the built-in rule is favored. So this could go as-is.

I would still like to add a check to avoid the compatibility warning when having com.github.liancheng::organize-imports in the classpath (which is the case for many, if not most Scalafix users), as it is now even more of a false positive since the community rule is no longer executed despite being loaded:

[info] Loading external rule(s) built against an old version of Scalafix (0.9.24).
[info] This might not be a problem, but in case you run into unexpected behavior, you
[info] should try a more recent version of the rules(s) if available. If that does
[info] not help, request the rule(s) maintainer to build against Scalafix 0.10.4
[info] or later, and downgrade Scalafix to 0.9.x (x>=24) for the time being.

I'll see if I get the time to do that this week, before the upcoming 0.11.0 release just waiting for the Scala 2.x patch releases.

@bjaglin bjaglin marked this pull request as ready for review May 24, 2023 00:11
@bjaglin bjaglin changed the title Merge OrganizeImports into Scalafix as a built-in rule Merge OrganizeImports 0.6.0 into Scalafix as a built-in rule Jun 3, 2023
@bjaglin bjaglin merged commit 6f44f12 into scalacenter:main Jun 3, 2023
@bjaglin bjaglin changed the title Merge OrganizeImports 0.6.0 into Scalafix as a built-in rule Merge OrganizeImports 0.6.0+37-596459af into Scalafix as a built-in rule Jun 4, 2023
@bjaglin
Copy link
Collaborator

bjaglin commented Jun 4, 2023

bjaglin changed the title Merge OrganizeImports 0.6.0 into Scalafix as a built-in rule Merge OrganizeImports 0.6.0+37-596459af into Scalafix as a built-in rule

It turns out that the imported rule contains a (cool) unreleased bugfix 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.