News for hackers. Stuff that matters.
Re:GitHub Super Linter: one linter to rule them all by philwelch on Thursday June 18, 2020 @01:00PM (#23565091)
I can wholeheartedly recommend Black for Python, gofmt for Go, and terraform fmt for Terraform.

What are some other great formatters out there?

Re:GitHub Super Linter: one linter to rule them all by kevinastone on Thursday June 18, 2020 @01:27PM (#23565382)
The previously mentioned prettier[0] along with swift-format[1] and rustfmt[2].

[0]: https://prettier.io [1]: https://github.com/apple/swift-format [2]: https://github.com/rust-lang/rustfmt

Re:GitHub Super Linter: one linter to rule them all by koreth1 on Thursday June 18, 2020 @07:38PM (#23569376)
Re:GitHub Super Linter: one linter to rule them all by Guillaume86 on Thursday June 18, 2020 @01:56PM (#23565711)
I wish there was good C# one (and ideally a standard one like go). When switching between typescript with prettier and C# the first thing I notice is the lack of autoformating.

edit: seems https://github.com/dotnet/format is the closest thing

Re:GitHub Super Linter: one linter to rule them all by sethreno on Thursday June 18, 2020 @04:40PM (#23567756)
I wish their was a standard c# formatter too. dotnet-format doesn't support wrapping long lines which is one of the more important features in my opinion.

Resharper has a free command line tool that supports wrapping long lines. https://www.jetbrains.com/help/resharper/CleanupCode.html

I made a wrapper for it to try and make it easier to use. https://github.com/sethreno/ReGitLint#regitlint

Re:GitHub Super Linter: one linter to rule them all by Guillaume86 on Friday June 19, 2020 @04:40AM (#23572415)
Thanks I will check it out
Re:GitHub Super Linter: one linter to rule them all by Merad on Thursday June 18, 2020 @09:35PM (#23570139)
ReSharper's formatter is pretty good, but you do have to pay to use it in the VS IDE and it's kind of slow. The service I'm working on at present is fairly small (20k LOC) and formatting the entire solution takes about 5 minutes in the IDE or 30 minutes in CI. :/
Re:GitHub Super Linter: one linter to rule them all by sethreno on Thursday June 18, 2020 @10:05PM (#23570287)
Is your service open source? I'd be interested in testing it. Also, you could speed up formatting in CI by only formatting files that changed.
Re:GitHub Super Linter: one linter to rule them all by Merad on Saturday June 20, 2020 @10:24AM (#23584116)
Nah, this is from my day job so it's a proprietary closed source thing. Supposedly the CI speed issues are because the CI has to start with cold caches every run (we use Gitlab pipelines that run in docker containers) whereas the IDE has the caches on hand. Something about the way our devops has set up the Gitlab runners makes enabling shared cache much hard than it should be so I haven't had the chance to test that. I don't think I ever tried limiting it to only changed files, that's worth a shot.
Re:GitHub Super Linter: one linter to rule them all by gregors on Friday June 19, 2020 @06:54PM (#23579688)
Re:GitHub Super Linter: one linter to rule them all by ScoutOrgo on Thursday June 18, 2020 @06:13PM (#23568719)
I really want one for sql, but haven't found any good ones available.
Re:GitHub Super Linter: one linter to rule them all by wenc on Thursday June 18, 2020 @01:29PM (#23565399)
Another recommendation for Black. I use 'black -l 120' because the default PEP recommended 80 chars per line is too restrictive.
Re:GitHub Super Linter: one linter to rule them all by minimaxir on Thursday June 18, 2020 @01:48PM (#23565611)
Black uses a 88 char per line limit. In the course of normal Python coding I rarely hit it.

For public code I do not recommend changing the defaults since it may make PRs a mess.

Re:GitHub Super Linter: one linter to rule them all by philwelch on Thursday June 18, 2020 @02:08PM (#23565838)
The 88 character limit is just a best effort thing anyway. I find the double-quote coercion more disruptive.
Re:GitHub Super Linter: one linter to rule them all by wenc on Thursday June 18, 2020 @02:23PM (#23566010)
I started programming in the 80s, so I'm used to double-quoting anyway.

Apostrophes occur so often in English that it makes it easier to type strings like "I'm a dog". With single quoting you have to go 'I\'m a dog'.

If I hit double quotes in a string, I just triple-quote.

"""He said "hah" sarcastically""".

I know Guido (van Rossum) prefers single quotes -- I'm not sure why exactly -- so it's become a default Python style. I tried to adopting it but always ended up reverting to double quotes.

Re:GitHub Super Linter: one linter to rule them all by _bohm on Thursday June 18, 2020 @04:21PM (#23567539)
I use single quotes simply because I'm lazy and tapping the quote key with my pinky is marginally easier than shift-quote :p
Re:GitHub Super Linter: one linter to rule them all by a1369209993 on Thursday June 18, 2020 @05:10PM (#23568079)
> I'm not sure why exactly

Might be ease of typing? Eg: `foo = 'bar'` doesn't require any shift chords, whereas `foo = "bar"` requires two. Though then I'd expect similar preference for kebab-case in identifies, for similar reason.

Re:GitHub Super Linter: one linter to rule them all by wenc on Thursday June 18, 2020 @08:18PM (#23569647)
Yes, that must be right, although to me the trade-off is escaped strings which lack good aesthetics.

'The class of \'72 didn\'t think much of Sam\'s speech'

vs

"The class of '72 didn't think much of Sam's speech"

To me, the shift chord is an almost negligible price to pay for more aesthetically pleasing strings, especially since on a QWERTY keyboard, the shift key is literally right next to the ' key. For emacs users who are used to complex key chords, it's even more negligible.

I do use single quotes for strings frequently in interpolated f-strings though:

f"The date is {result['year']}"

Re:GitHub Super Linter: one linter to rule them all by chrismorgan on Friday June 19, 2020 @04:29AM (#23572350)
Unless I mean straight quotes, I type curly quotes as a matter of course. Love my Compose key. :)
Re:GitHub Super Linter: one linter to rule them all by minimaxir on Thursday June 18, 2020 @03:49PM (#23567097)
That, I've gotten surprisingly used to. (atleast Black is smart about using single-quotes instead if you use double-quotes in a string)
Re:GitHub Super Linter: one linter to rule them all by mintplant on Thursday June 18, 2020 @03:48PM (#23567082)
I maintain Lavender as a Black alternative with single-quote support.

https://github.com/spinda/lavender

Re:GitHub Super Linter: one linter to rule them all by leadingthenet on Thursday June 18, 2020 @04:59PM (#23567960)
But the double quotes are exactly what I like about Black haha.
Re:GitHub Super Linter: one linter to rule them all by The_rationalist on Thursday June 18, 2020 @04:02PM (#23567307)
We use klint at work (Kotlin) https://github.com/pinterest/ktlint It's take inspiration from standardjs and gofmt
Re:GitHub Super Linter: one linter to rule them all by reledi on Thursday June 18, 2020 @06:43PM (#23568968)
mix format for Elixir

rubyfmt for Ruby