-
Notifications
You must be signed in to change notification settings - Fork 16
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
Update and apply scalafmt #57
Update and apply scalafmt #57
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
4680eb5
to
61f3d08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I agree with removing pre-commit-hooks. I would prefer just running pre-commit manually with pre-commit run -a
whenever you want and just verifying that pre-commit
succeeds with a github workflow.
Which IDE do you use? I use IntelliJ and you can tell it to not run git hooks. Also, you don't have to install pre-commit hooks locally. |
No longer at Rally myself, but from my time there, I found pre-commit-hooks absolutely invaluable. In combination with scalafmt and a properly-configured IntelliJ, it meant that I almost never needed to think about formatting, which was a non-trivial time-saver. |
Regarding me personally when I did have them available it slowed down my workflow especially in large projects (especially with Scala due to sbt startup time). I typically only ran a scalafmt just before I was going to push something where as locally I may commit many times quickly. In tandem with the github actions scalafmt which takes a few seconds to complete on CI, if I did happen to forget to format I pretty got immediate feedback just when creating the PR. In any case I am not going to die on this hill so I will rebase the PR to undo the removal of the pre commit hook. |
bb615ef
to
07cb459
Compare
Maybe we can look into using Also, if you prefer, you don't have to install pre-commit locally and only run it manually when you want to finalize a commit with Also, we should definitely be validating |
Hmm...
|
@jeffmay You can check the failure in the actual github action at https://github.com/rallyhealth/scalacheck-ops/actions/runs/3221009924/jobs/5268494582 i.e.
You failed to format |
83c00c1
to
76089f0
Compare
So |
I wonder how we can bridge the gap between the github action and pre-commit-conifg... I want to be able to run hooks that will autoformat the code (quickly) so that it passes CI. I think the "quickly" part rules out the old pre-commit-hooks that requires running a new JVM and |
I guess you can try sbt in thin client mode (see https://www.scala-sbt.org/1.x/docs/sbt-1.4-Release-Notes.html#Native+thin+client), that should reuse the JVM process. Even though it doesn't work with environment variables I don't think thats relevant here. Or as you said you could also just include the binaries of scalafmt-native in the git repo however it only supports Linux/Mac (see https://scalameta.org/scalafmt/docs/installation.html#native-image) and it also presents its own host of problems. |
6887a55
to
ccc9b7b
Compare
@mdedetrich it was easier than I thought. |
ae034ae
to
6ad21a8
Compare
6ad21a8
to
8cb4fa9
Compare
028c1bd
to
f09e0d2
Compare
1706d97
23c87fa
to
804e445
Compare
/** Some formatted | ||
* @param gen | ||
* @param config | ||
* @param typeName | ||
* @tparam T | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove. This was for testing
- Add pre-commit-hooks-scala v0.0.1 - Run scalafmt via coursier hook - Run pre-commit on all files - Validate pre-commit in format.yml github workflow
804e445
to
978db2b
Compare
Still something wonky going on: https://github.com/rallyhealth/scalacheck-ops/actions/runs/3235997094/jobs/5301188323 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Well, I re-ran it and it was fine... hopefully not a source of flakiness. |
Weird... looks like it had trouble downloading |
Description
This PR updates the scalafmt config to the newest version as well as replacing a pre commit git hook with a github workflow action. This may be subjective but I have a personal hate with putting formatters within githooks because it really messes with IDE's especially in large codebases. Instead the github workflow action
Type of change
Updating of scalafmt
Checklist: