typelevel / scalacheck

Property-based testing for Scala
http://www.scalacheck.org
BSD 3-Clause "New" or "Revised" License
1.94k stars 405 forks source link

Add scalafmt to the repository #950

Closed satorg closed 1 year ago

satorg commented 1 year ago

This is an effort to introduce ScalaCheck and ScalaFmt to each other. Recently I realized that those two great guys have never ever met. So I decided to give it a try.

satorg commented 1 year ago

I've created it as a Draft because before starting applying the formatting, I would like to agree on the scalafmt.conf file itself. The initial scalafmt.conf is very minimalistic, but I am open to tune it as necessary to make everyone comfortable with it.

vivekragunathan commented 1 year ago

It would be nice if we agree to apply the formatting to build.sbt too.

Also I think we should takes a few rounds of applying the formatting to reduce change history overload. Start with something small and iteratively apply other (bigger) things.

satorg commented 1 year ago

It would be nice if we agree to apply the formatting to build.sbt too.

Yes sure – this PR implies formatting for build.sbt too.

rossabaker commented 1 year ago

Don't forget that format commits can be added to a .git-blame-ignore-revs file. Most Typelevel repos use the same config, as a lot of the benefit is to avoid fights over inconsequential preferences. I'm in favor of this, and I think one isolated commit to do the reformat, added to blame ignore, would be great.

vivekragunathan commented 1 year ago

Don't forget that format commits can be added to a .git-blame-ignore-revs file. Most Typelevel repos use the same config, as a lot of the benefit is to avoid fights over inconsequential preferences. I'm in favor of this, and I think one isolated commit to do the reformat, added to blame ignore, would be great.

Oh wow, I did not that. That would work out great.

rossabaker commented 1 year ago

A really cool thing is that Scala Steward adds to that file whenever the formatting changes through plugin upgrades.

rossabaker commented 1 year ago

Also needs a githubWorkflowGenerate?

satorg commented 1 year ago

@rossabaker , I'm struggling with the startYear setting, which is required for sbt-header. Currently in the headers it is set in this way:

/*-------------------------------------------------------------------------*\
**  ScalaCheck                                                             **
**  Copyright (c) 2007-2021 Rickard Nilsson. All rights reserved.          **
...

But if I set it to 2007 and keep using the "BSD-3-Clause" license, then the headers become

/*
 * Copyright (c) 2007, Typelevel
 * All rights reserved.
...

Would such a change be fine there?

armanbilge commented 1 year ago

@satorg if you add a dependency to latest sbt-header you can use headerEndYear (kindly contributed by Vasil in https://github.com/sbt/sbt-header/pull/282). (sbt-typelevel ships an old sbt-header b/c it broke bincompat ...).

satorg commented 1 year ago

@armanbilge

if you add a dependency to latest sbt-header you can use headerEndYear

You've foreseen my next question, actually ) So yeah, I think I can do it too.

But I'm a bit concerned, is it correct to put Typelevel and 2007 together? I doubt that Typelevel org is that old...

satorg commented 1 year ago

I think this PR is ready for review.

Feel free to suggest changes to the .scalafmt.conf file please – I tried to be conservative in this initial work, but open to any other formatting rules.

Also, please pay attention to scaladoc comments – turned out they've changed the most after the re-formatting.

The last commit in the PR contains changes to .git-blame-ignore-revs.

Thank you.

satorg commented 1 year ago

@rossabaker @armanbilge sorry for pinging you guys. There's no urgency, but when you have time – could you provide any feedback on this please? Thank you!