You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by Mike Beckerle <mb...@apache.org> on 2023/06/23 16:13:26 UTC

I am really hating scalafmt

We added scalafmt, and I have not done much coding since that time. Now
that I have, I hate it.

It turns this:

val optURI =
  Misc.getResourceRelativeOption(sysId, baseURI) orElse
    Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId), baseURI)

into:

val optURI =
  Misc
    .getResourceRelativeOption(sysId, baseURI)
    .orElse(
      Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
baseURI)
    )

This is awful. And you can't override it, because if your code doesn't
conform, it fails a format check.

I suggest we just turn off this scalafmt stuff.

RE: I am really hating scalafmt

Posted by "McGann, Mike" <mm...@owlcyberdefense.com>.
I do a lot of work in go and I really enjoy having gofmt around. Formatting code in a consistent way is one less thing that I need to think about, and when working in larger groups, one less thing to constantly debate. I do think that scalafmt is a bit more opinionated in certain ways, but I think coming up with a more agreeable configuration is better than not having it at all. 

// Mike

-----Original Message-----
From: Mike Beckerle <mb...@apache.org> 
Sent: Friday, June 23, 2023 12:13
To: dev@daffodil.apache.org
Subject: I am really hating scalafmt

We added scalafmt, and I have not done much coding since that time. Now that I have, I hate it.

It turns this:

val optURI =
  Misc.getResourceRelativeOption(sysId, baseURI) orElse
    Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId), baseURI)

into:

val optURI =
  Misc
    .getResourceRelativeOption(sysId, baseURI)
    .orElse(
      Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
baseURI)
    )

This is awful. And you can't override it, because if your code doesn't conform, it fails a format check.

I suggest we just turn off this scalafmt stuff.

Re: I am really hating scalafmt

Posted by Mike Beckerle <mb...@apache.org>.
Ah. This is great. So when scalafmt clobbers my code I'll bracket it with
this instead and if those get to be too frequent, we'll revisit.

Thanks


On Mon, Jun 26, 2023 at 11:38 AM Adam Rosien <ad...@rosien.net> wrote:

> There's
> ```
> // format: off
> ...
> // format: on
> ```
>
> https://scalameta.org/scalafmt/docs/configuration.html#-format-off
>
> On Fri, Jun 23, 2023 at 9:20 AM Steve Lawrence <sl...@apache.org>
> wrote:
>
> > scalafmt as a lot of configurability. Maybe there are some options we
> > could tweak?
> >
> > On 2023-06-23 12:13 PM, Mike Beckerle wrote:
> > > We added scalafmt, and I have not done much coding since that time. Now
> > > that I have, I hate it.
> > >
> > > It turns this:
> > >
> > > val optURI =
> > >    Misc.getResourceRelativeOption(sysId, baseURI) orElse
> > >
> Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
> > baseURI)
> > >
> > > into:
> > >
> > > val optURI =
> > >    Misc
> > >      .getResourceRelativeOption(sysId, baseURI)
> > >      .orElse(
> > >
> > Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
> > > baseURI)
> > >      )
> > >
> > > This is awful. And you can't override it, because if your code doesn't
> > > conform, it fails a format check.
> > >
> > > I suggest we just turn off this scalafmt stuff.
> > >
> >
> >
>

Re: I am really hating scalafmt

Posted by Adam Rosien <ad...@rosien.net>.
There's
```
// format: off
...
// format: on
```

https://scalameta.org/scalafmt/docs/configuration.html#-format-off

On Fri, Jun 23, 2023 at 9:20 AM Steve Lawrence <sl...@apache.org> wrote:

> scalafmt as a lot of configurability. Maybe there are some options we
> could tweak?
>
> On 2023-06-23 12:13 PM, Mike Beckerle wrote:
> > We added scalafmt, and I have not done much coding since that time. Now
> > that I have, I hate it.
> >
> > It turns this:
> >
> > val optURI =
> >    Misc.getResourceRelativeOption(sysId, baseURI) orElse
> >      Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
> baseURI)
> >
> > into:
> >
> > val optURI =
> >    Misc
> >      .getResourceRelativeOption(sysId, baseURI)
> >      .orElse(
> >
> Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
> > baseURI)
> >      )
> >
> > This is awful. And you can't override it, because if your code doesn't
> > conform, it fails a format check.
> >
> > I suggest we just turn off this scalafmt stuff.
> >
>
>

Re: I am really hating scalafmt

Posted by Steve Lawrence <sl...@apache.org>.
scalafmt as a lot of configurability. Maybe there are some options we 
could tweak?

On 2023-06-23 12:13 PM, Mike Beckerle wrote:
> We added scalafmt, and I have not done much coding since that time. Now
> that I have, I hate it.
> 
> It turns this:
> 
> val optURI =
>    Misc.getResourceRelativeOption(sysId, baseURI) orElse
>      Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId), baseURI)
> 
> into:
> 
> val optURI =
>    Misc
>      .getResourceRelativeOption(sysId, baseURI)
>      .orElse(
>        Misc.getResourceRelativeOption(removeInitialUpwardPathSteps(sysId),
> baseURI)
>      )
> 
> This is awful. And you can't override it, because if your code doesn't
> conform, it fails a format check.
> 
> I suggest we just turn off this scalafmt stuff.
>