News for hackers. Stuff that matters.
Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Thursday June 18, 2020 @12:37PM (#23564827)
Great! Now do it for code formatters!

After using Prettier for a few years I'm firmly in the camp of mandatory/enforced code formatters. As long as it's a half decent formatter like Prettier I believe my personal opinions on the specific formatting choices are much less important than essentially never having to think about formatting again, in particular having to ask people to fix formatting in code reviews (or fix it myself).

I also love just banging out code, saving, and having my editor clean up the formatting for me.

Re:GitHub Super Linter: one linter to rule them all by honkycat on Thursday June 18, 2020 @01:51PM (#23565652)
One of the hills I am willing to die on is auto-formatting. Code formatting is easily automated to an acceptable level, and people's personal preferences are subjective.

I like to solve interesting problems, and concentrate on crafting high quality software. Manual code formatting contributes to neither of these disciplines. Code formatting is BORING robot work, not human work. Total pointless drudgery. Toiling away because you like your bracket with a different spacing is IDIOTIC. Run the formatter and move on.

Re:GitHub Super Linter: one linter to rule them all by VectorLock on Thursday June 18, 2020 @05:22PM (#23568187)
Normally I agree with treating code as a means to an end rather than an end to itself but I take a certain enjoyment in crafting in some way aesthetically pleasing code as well. I even find that if the code is "ugly" that there frequently might be a more eloquent and objectively better way of doing things. And a little time hand formatting I think is worth it if you're maximizing understandability and readability.

Not arguing about style is nice, but having to resort to this brutalist architecture style of code formatting doesn't seem great to me. "Its just holding people, who CARES what the building looks like!"

Re:GitHub Super Linter: one linter to rule them all by a_t48 on Thursday June 18, 2020 @05:45PM (#23568420)
Consistent style is more important than each block of code being perfectly pretty. You can still argue aesthetics, but they need to be applied across the entire codebase. Never having to bother someone because their PR doesn't meet the formatting guidelines is well worth it.
Re:GitHub Super Linter: one linter to rule them all by ergothus on Thursday June 18, 2020 @10:06PM (#23570295)
> Consistent style is more important than each block of code being perfectly pretty

"Pretty", yes, but we're literally talking about using language to communicate. Consistency taken to extremes is harmful to communication.

I don't understand the worship that people have for consistency. STUPID inconsistencies are bad, yes, and yes, there are certainly arguments that about subjective matters that are a waste of time. But distilling everything down to the lowest common denominator of grunt-talking is very consistent and terrible communication. (Does that feel like a strawman? I'd love for it to be! Once people stop talking about consistency uber-alles we'll be discussing the things that I consider important.) Right now, the most common reaction is to dismiss any idea of communication through language as irrelevant, subjective, and a waste of time."

Re:GitHub Super Linter: one linter to rule them all by xondono on Friday June 19, 2020 @05:12AM (#23572651)
I’d agree that 100% consistency is harmful to communication, but the primary communication happening in programming is with a computer. Even when it comes to other developers looking at your code, their internal process is “let me simulate what the computer understands”.

Unless you are enforcing weird autoformat choices, everything should look pretty enough.

Re:GitHub Super Linter: one linter to rule them all by davedx on Friday June 19, 2020 @06:34AM (#23573041)
> the primary communication happening in programming is with a computer

Working in a team with 15 people on the same code base I disagree with this. Count the computer as one teammate

Re:GitHub Super Linter: one linter to rule them all by VectorLock on Friday June 19, 2020 @12:48PM (#23576205)
"Style" means things that the human sees. If it changes execution its not style any more. This is what tests are designed to enforce.
Re:GitHub Super Linter: one linter to rule them all by waheoo on Thursday June 18, 2020 @07:22PM (#23569270)
People at work nit: my code all the time. I just straight up ignore them. If they ask me why, I tell them to add an autoformat to our ci or shut the hell up.

Fwiw, i use an auto formatter but its got problems with certain rules so i switch them off.

The reason we dont have it turned on in ci is because these rules break code.

Re:GitHub Super Linter: one linter to rule them all by a_t48 on Thursday June 18, 2020 @08:13PM (#23569618)
Yeah, auto formatter (or at least format validation) is a must.
Re:GitHub Super Linter: one linter to rule them all by forty on Friday June 19, 2020 @08:01AM (#23573480)
There are two kind of painting. You can paint a wall/a building, or you can paint Mona Lisa.

This is the same for programming. Each dev have their own taste in term of code style and code formatting preferences. I was an early employee in a startup, and at some point I was able to tell who wrote a chunk of code just from the code style, it was fun :) but as company grown, and team got bigger, it got more "professional", now we have prettier which erases a big part of our code personality. If you believe like me that coders are artists you might find that a bit sad, but the truth is that most Enterprise software building is wall painting, and art doesn't have its place there. That doesn't prevent us from painting Mona Lisa at home though :)

Re:GitHub Super Linter: one linter to rule them all by javajosh on Friday June 19, 2020 @10:08AM (#23574659)
I like the point in general, but I will say there are times when idiosyncratic formatting can really help understanding "this particular bit of code". Often it has to do with aligning values so that they are easier to read; if a code formatter was smart enough to at least understand the signal the programmer is sending, and maintain (or even improve!) that kind of formatter, it would be the best of all worlds.

One simple example is when you're parsing text and you have a long list of simple one-line if statements. I personally think it's wasteful and harder to read that block of code if you impose curly braces and new lines on that list of conditionals. This kind of formatting convention has been around for at least 40 years, and it makes the code more readable. I have yet to see an auto-formatter that doesn't turn that kind of code section into an unreadable mess.

Re:GitHub Super Linter: one linter to rule them all by dnautics on Friday June 19, 2020 @11:15AM (#23575303)
Or key value lists where the keys have slightly different lengths.
Re:GitHub Super Linter: one linter to rule them all by Lorkki on Saturday June 20, 2020 @04:13AM (#23582575)
It's possible to do both: https://designyoutrust.com/2019/03/in-berlin-there-was-a-gia...

There's also plenty of room for art in the choice of materials and colours as well as the shapes of buildings. Likewise, with code, if you limit yourself to only what one person can do, you'll end up with a very constrained view of what "art" means.

Re:GitHub Super Linter: one linter to rule them all by antaviana on Saturday June 20, 2020 @05:23AM (#23582830)
You will flip out when you discover “git blame” or, even better, GitLens on Visual Studio Code.
Re:GitHub Super Linter: one linter to rule them all by epistasis on Thursday June 18, 2020 @10:36PM (#23570445)
I find that if the auto formatter isn't dealing well with a section of code, it's usually an indication that the code architecture is off. Too clever, too verbose, too much nesting, trying too hard to make one-liners, etc.

There's a beauty that comes from simplicity, and code for matters, at least for me, are good of reminding me of that.

Re:GitHub Super Linter: one linter to rule them all by stimpson_j_cat on Thursday June 18, 2020 @05:53PM (#23568518)
Not to mention it dirties up version control. It's a lot easier to tell which _significant_ things changed from the last commit when you're scanning a diff and no formatting changes are highlighted.
Re:GitHub Super Linter: one linter to rule them all by waheoo on Thursday June 18, 2020 @07:56PM (#23569502)
Ive seen heaps of autoformatters dirty up version control. Mostly when theyre fussing about new lines. I kind of wish autoformatters would just ignore new lines and focus on indentation alone. It would certainly cut down on the over zealous rules.

I also think formatting should be separate from linting but because they both require a parser people seem to think theyre the same thing.

Re:GitHub Super Linter: one linter to rule them all by SOLAR_FIELDS on Thursday June 18, 2020 @08:57PM (#23569902)
Wouldn't having the autoformatter run as a pre-commit hook alleviate this issue? (This is assuming you had already cleaned up all of the currently checked in code with said autoformatter)
Re:GitHub Super Linter: one linter to rule them all by waheoo on Thursday June 18, 2020 @09:56PM (#23570242)
Prettier specifically annoys me to no end with this problem.

If youre adding more attributes to a jsx component later and know it you might format to multiline early. It decides to undo your work and slow you down, because some arbitrary line length.

Similarly, if you go over that line length, on something you want single line for readability of structure, it just straight up does what it wants.

Im 100% on the auto format train but it has to go the gofmt route and only apply rules that are actually important and incredibly uncontroversial.

Re:GitHub Super Linter: one linter to rule them all by crooked-v on Thursday June 18, 2020 @10:27PM (#23570407)
> It decides to undo your work

What you're missing here is that you're supposed to be using it all along, all the time. Format on save. Format on commit. Format on server pipelines. Format all the time. It can never 'undo' anything if it's what's providing the formatting in the first place.

Re:GitHub Super Linter: one linter to rule them all by waheoo on Thursday June 18, 2020 @10:49PM (#23570494)
Thats what im talking about. If you add text to a line, and it goes over a length, it will reformat a jsx element into about 5 lines instead of 1. Similarly, when you add more than it needs because you want consistency, or know youll add more, and the formatter runs, often it undoes your work.
Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Friday June 19, 2020 @01:40AM (#23571341)
Prettier lets you control object literal formatting by inserting/removing the newline after the opening brace, I'm not sure why they don't do that for JSX elements.

https://prettier.io/docs/en/rationale.html#multi-line-object...

Re:GitHub Super Linter: one linter to rule them all by earthboundkid on Friday June 19, 2020 @12:14AM (#23570906)
If you really want 5 lines, add a dummy // in there and will be forced to use 5 instead of 1. Dirty hack, but it works.
Re:GitHub Super Linter: one linter to rule them all by vages on Friday June 19, 2020 @02:22AM (#23571572)
That, or a prettier-ignore comment above the JSX tag. I find your solution more elegant, though.

My two cents: Write the comment's purpose inside it. "// Comment inserted to force prettier line break until more attributes are added"

Re:GitHub Super Linter: one linter to rule them all by waheoo on Saturday June 20, 2020 @11:11PM (#23589435)
Im talking about adding an attribute in the next 5 minutes, no, im not going to add a comment, or an ignore line while im editing a component. Those are really awful work arounds to a man made problem.
Re:GitHub Super Linter: one linter to rule them all by libria on Thursday June 18, 2020 @11:36PM (#23570690)
It's tunable. Pick a line length you all agree on and when it reformats after that, that's what you asked for.

If the rule never works for you, turn that one off.

If the rule is what you want 99% of the time but it made this one line look dumb, mark that one block #ignore and let the team decide in CR if that was the right call.

Re:GitHub Super Linter: one linter to rule them all by est31 on Thursday June 18, 2020 @09:28PM (#23570105)
Most autoformatters are under active development, and updates to them often causes changes in their behaviour. So you have to have all devs agree on the precise version of the formatter used, and even then you still need to do regular commits that contain nothing but a run of the newest version of the formatter on the codebase, which sadly destroys long term git blame.
Re:GitHub Super Linter: one linter to rule them all by zetafunction on Thursday June 18, 2020 @11:42PM (#23570727)
Chromium has a presubmit that enforces that code is autoformatted. However, it only enforces this for changed lines, and in practice, it works pretty well.
Re:GitHub Super Linter: one linter to rule them all by cheez on Thursday June 18, 2020 @09:52PM (#23570216)
this is a solved problem, pin your packages.
Re:GitHub Super Linter: one linter to rule them all by est31 on Thursday June 18, 2020 @10:23PM (#23570391)
But you still have to update them every now and then otherwise you can't use new features of your language. Which gives you the issue of breakages again.
Re:GitHub Super Linter: one linter to rule them all by waheoo on Thursday June 18, 2020 @10:52PM (#23570506)
I dont think people want to hear that there are still problems with autoformatting text.

Anyway, my point still stands, drop rules about line length and rules that care about inter line break positions and most of these problems go away.

Re:GitHub Super Linter: one linter to rule them all by cheez on Thursday June 18, 2020 @11:00PM (#23570535)
Sure. Most large teams do this on a 6 month basis or when it is needed to implement something. Again, a solved problem.
Re:GitHub Super Linter: one linter to rule them all by CGamesPlay on Thursday June 18, 2020 @10:02PM (#23570274)
This problem is caused by adding a formatter to your editor, instead of adding it to your project (or one of your contributors adding it to their editor). But if you adopt a formatter into the project, then this isn't a problem. Create one commit called "reformat all files", and then use `--ignore-rev` to never see it in your git log.

If your contributor is changing thousands of lines in a diff to fix a typo, ask them not to do that :)

Re:GitHub Super Linter: one linter to rule them all by ornornor on Friday June 19, 2020 @04:07AM (#23572210)
My workaround is to run the formatted in the whole codebase as a separate PR, make the commit with a separate user that’s none of my colleagues (like “Prettier <[email protected]>”) and add that commit’s hash to a file in the repo. I then configure git to use that file for ignoring changes in git blame.

Now the code is formatted and additions won’t trigger reformatting the line or the file.

Re:GitHub Super Linter: one linter to rule them all by gugagore on Thursday June 18, 2020 @08:12PM (#23569605)
That doesn't necessarily mean that you need to check in auto-formatted changes. You can just autoformat the two revisions before feeding it to the diff program.

Of course, a lot of tooling simply isn't there for that, unfortunately, but that's what I see as the ideal solution.

Re:GitHub Super Linter: one linter to rule them all by mbaird on Friday June 19, 2020 @06:26AM (#23573009)
We've found https://git-scm.com/docs/git-blame#Documentation/git-blame.t... very useful in these cases. When Prettier changes significantly, we run across the whole codebase & add the commit to an ignore file.
Re:GitHub Super Linter: one linter to rule them all by ianleeclark on Thursday June 18, 2020 @02:10PM (#23565852)
I agree with this wholeheartedly. Being introduced to gofmt a few years categorically eliminated a certain class of PR comments allowing PRs to be more focused on actual implications and logic.
Re:GitHub Super Linter: one linter to rule them all by necrotic_comp on Thursday June 18, 2020 @02:22PM (#23565989)
Not to mention that if multiple people work on a codebase over time, if a very large project gets very old (like 20 years old), having consistent formatting goes a long way in allowing people to understand code that they may not have context for.
Re:GitHub Super Linter: one linter to rule them all by chrisweekly on Thursday June 18, 2020 @02:13PM (#23565878)
Agreed. I adopted the Wes Bos approach (drive Prettier from ESLint) and it's fantastic.
Re:GitHub Super Linter: one linter to rule them all by antigirl on Thursday June 18, 2020 @11:37PM (#23570700)
Any links? I only use it for react. I found eslint auto fix works well enough for node etc
Re:GitHub Super Linter: one linter to rule them all by chrisweekly on Friday June 19, 2020 @08:38AM (#23573865)
Re:GitHub Super Linter: one linter to rule them all by pmiller2 on Thursday June 18, 2020 @04:47PM (#23567831)
I agree with you, but I’m not gonna lie: you had me worried with your first sentence. :)
Re:GitHub Super Linter: one linter to rule them all by hartator on Thursday June 18, 2020 @10:38PM (#23570458)
I don’t know. I feel formatting choice can carry information and removing that information for conformity might be not worth it.
Re:GitHub Super Linter: one linter to rule them all by pezo1919 on Thursday June 18, 2020 @11:42PM (#23570731)
Huge plus!
Re:GitHub Super Linter: one linter to rule them all by MoroCode on Friday June 19, 2020 @08:21AM (#23573703)
Personally I vote to let people write code in the format they are most comfortable with and run the formatter as part of CI
Re:GitHub Super Linter: one linter to rule them all by SeanDav on Friday June 19, 2020 @09:52AM (#23574512)
Not sure I agree. Most coding is maintenance. Far better to adapt to whatever the coding style convention is.

I also believe that formatters should be "light-touch" and not have an opinion about every last thing. At that point I start thinking, "if you so smart, why don't you write the bloody code!"

Re:GitHub Super Linter: one linter to rule them all by rowanseymour on Thursday June 18, 2020 @12:57PM (#23565059)
It's been go-fmt that's converted me to this way of thinking. It's such a waste of time having a linter tell me after I've checked in code that I'm missing a space on line 123... please just add the space. Please let me and my colleagues never have to argue again about what is the right way to format something.
Re:GitHub Super Linter: one linter to rule them all by unfunco on Thursday June 18, 2020 @01:40PM (#23565515)
I feel the same, fmt is a productivity boon for me too.

There was a good quote from Rob Pike in his Go proverbs talk: "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite."

Re:GitHub Super Linter: one linter to rule them all by FredrikMeyer on Thursday June 18, 2020 @01:31PM (#23565424)
Many linters have built-in auto-fix features like what you describe. (eslint, for example)
Re:GitHub Super Linter: one linter to rule them all by celticninja on Thursday June 18, 2020 @01:50PM (#23565644)

    rubocop -a
For the win.
Re:GitHub Super Linter: one linter to rule them all by reledi on Thursday June 18, 2020 @06:31PM (#23568865)
Not the same experience as some of the best formatters out there. RoboCop is too configurable and too slow.
Re:GitHub Super Linter: one linter to rule them all by halostatue on Thursday June 18, 2020 @11:36PM (#23570693)
It would be nice if Rubocop didn’t need as much customization as it does, because it promotes styles that violate everything I have done in my 18 years of writing Ruby.

Some of its defaults? Fine, whatever. Others? They’re just _wrong_.

Re:GitHub Super Linter: one linter to rule them all by philsnow on Thursday June 18, 2020 @02:23PM (#23566000)
Code autoformatting is amazing and I never want to go back; even though I strenuously disagree with the particular formatting my team/company has chosen for python, I'm so relieved to never ever have a style discussion in PRs that I don't care about double quotes vs single quotes anymore.

BUT

I'm tired of seeing diff chunks on github where 95% of the chunk is because black/gofmt decided to change the formatting / indentation / grouping / whatever. I want language-agnostic, AST-aware diffing, that de-emphasizes the part of a chunk that is irrelevant-in-the-world-of-auto-matic-code-formatting.

Re:GitHub Super Linter: one linter to rule them all by kristo on Thursday June 18, 2020 @02:59PM (#23566414)
Why don’t we just check ASTs in to git instead of text files ?
Re:GitHub Super Linter: one linter to rule them all by ssivark on Thursday June 18, 2020 @03:28PM (#23566789)
I think this is the key question, and doing this will enable numerous interface improvements for people working with software (Eg: separation of content and presents means that everybody can use their favorite view — three-space-tabs, extra-long lines, whatever).

The challenge is that version control on text files (list of lines) is fairly straight forward and language agnostic, while OTOH the VCS would have to run after the language parser processes on the text file, and then be able to interface with the AST generated by the parser (for multiple languages). I presume this would become easy if different languages have the same parsing setup, or we have language/project-specific VCS tools. While the answers are not obvious (to me, at least) this definitely seems like the right direction to move in, instead of getting hung up on plain text and formatting issues.

Re:GitHub Super Linter: one linter to rule them all by nyanpasu64 on Thursday June 18, 2020 @07:10PM (#23569166)
Storing an AST instead of text might be a way to eliminate parsing ambiguity of angle brackets for generic arguments (as opposed to comparisons). It might still be visually ambiguous, but I don't think it's a problem in practice (if the display forces whitespace around comparisons)?
Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Thursday June 18, 2020 @04:32PM (#23567672)
There are some cases where formatters like Prettier don't have one canonical representation for an AST, in particular behavior around line breaks (multiple empty lines are allowed, a line break after an "{" opening brace in an object literal will force it to span multiple lines, etc)

But yeah, otherwise everyone could just have their own preferred formatter/settings and we could commit whatever representation is most optimal for diffing to version control (e.x. multi-line object literals, trailing commas in arrays/args, etc).

You could use something more compact like a binary AST but for compatibility with "legacy" tools that deal with text I think it would be better to use a more verbose text-based representation.

Re:GitHub Super Linter: one linter to rule them all by i_dursun on Thursday June 18, 2020 @03:48PM (#23567084)
I believe unison does something along those lines:

https://www.unisonweb.org/

Re:GitHub Super Linter: one linter to rule them all by jyounker on Thursday June 18, 2020 @05:26PM (#23568214)
I believe that's called "lisp".
Re:GitHub Super Linter: one linter to rule them all by Firadeoclus on Friday June 19, 2020 @10:24AM (#23574816)
Which lisps don't use text files for source code?
Re:GitHub Super Linter: one linter to rule them all by mook on Thursday June 18, 2020 @10:59PM (#23570531)
I kind of like the ability to have comments, though. The tools I've worked with have issues round-tripping them though ASTs.
Re:GitHub Super Linter: one linter to rule them all by philsnow on Thursday June 18, 2020 @07:47PM (#23569436)
I have thought about this a bit in the past, and I think the answer is that the AST for a given blob of text can be different depending on which version of the language you interpret it with. consider 'print "foo"' in python 2.7:

    Python 2.7.15 (default, Feb 14 2019, 16:26:56)
    [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.10.44.4)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ast
    >>> ast.dump(ast.parse('print "foo"'))
    "Module(body=[Print(dest=None, values=[Str(s='foo')], nl=True)])"
but in python 3.7:

    Python 3.7.2 (default, Feb 14 2019, 16:12:42)
    [Clang 10.0.0 (clang-1000.10.44.4)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ast
    >>> ast.parse('print "foo"')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/philsnow/.pyenv/versions/3.7.2/lib/python3.7/ast.py", line 35, in parse
        return compile(source, filename, mode, PyCF_ONLY_AST)
      File "<unknown>", line 1
        print "foo"
                  ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("foo")?
nothing changed in the text, but the AST is different. What should get committed to this hypothetical "git-ast"?

The answer probably lies in creating a different abstraction , different building blocks. In git we have bytes -> blobs -> trees -> commits, where the bytes of a given file get annotated with a file name (and mode bits etc etc, gross posix things) by the tree object.

In git-ast, maybe the abstraction is bytes -> lexemes (which annotates the bytes with a language version, and thus lexer version) -> tree? I haven't gone down the thought experiment that far.

Re:GitHub Super Linter: one linter to rule them all by jlarocco on Thursday June 18, 2020 @09:09PM (#23569991)
I suspect you're probably right, but that example isn't the greatest because Python 3 isn't source compatible with Python 2. The source code text itself isn't even backwards compatible in that case.
Re:GitHub Super Linter: one linter to rule them all by philsnow on Thursday June 18, 2020 @10:56PM (#23570518)
That was maybe not a great example, pick any language change where a new keyword was introduced that wasn't previously a keyword or reserved word.

I tried to make an example with `with`, because that was introduced between 2.4 and 2.5 IIRC, and 2.4 and 2.5 aren't nearly as far apart as 2.* and 3.*, but I didn't find an easy way to install a 2.4 python (it didn't compile in pyenv on my mac, and I looked at a couple docker images before giving up).

Re:GitHub Super Linter: one linter to rule them all by Dylan16807 on Friday June 19, 2020 @01:16AM (#23571213)
But you're describing a benefit of storing an AST. Instead of the code suddenly changing meaning, you have an AST that says what the meaning should be.

The worst case is that you export it with the old version of the converter, and then the code changes meaning. You have silent corruption. But if you stored raw text this would always happen.

The good case is that you export it with the new version of the converter. It will notice that a variable name matches a keyword, and alert you to fix it.

Re:GitHub Super Linter: one linter to rule them all by iso8859-1 on Thursday June 18, 2020 @11:01PM (#23570539)
Since even minor releases can introduce new syntax that previously failed to parse, this happens more than just on major version numbers. For example: async/await, formatting string literals, underscores in numeric literals, the list goes on and on. So you'll have to upgrade your formatter. And when you upgrade it, it may start formatting something differently than it previously did, even if that chunk had no new syntax.
Re:GitHub Super Linter: one linter to rule them all by Dylan16807 on Friday June 19, 2020 @01:05AM (#23571142)
Use one that won't change how it formats on a whim?
Re:GitHub Super Linter: one linter to rule them all by pmiller2 on Thursday June 18, 2020 @04:53PM (#23567897)
Because that requires either compiler support, or a plug-in to be written for each language and language version. But, I guess you can always fall back to text files in the worst case.
Re:GitHub Super Linter: one linter to rule them all by cjohansson on Thursday June 18, 2020 @04:54PM (#23567907)
Sounds like a great idea, or binary representation of lexer tokens, the AST is larger in size than the lexer tokens and the AST can be easily generated from the tokens
Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Thursday June 18, 2020 @04:23PM (#23567561)
This is basically solved by pinning the formatter to a specific version in your project's dependencies, and enforcing its use in continuous integration.

Of course that doesn't help if you're setting up the formatter for the first time, or want to upgrade to a new version.

Some tools like GitHub's diff do try to deemphasize whitespace but it's pretty limited.

Re:GitHub Super Linter: one linter to rule them all by l0b0 on Thursday June 18, 2020 @04:48PM (#23567838)
In easy steps (Python/Git specific):

1. Use a tracked directory for Git hooks: `git config --local core.hooksPath 'git-hooks'`.

2. Create format.bash and lint.bash.

2.1. Run `black` and `isort` in format.bash.

2.2. Run `flake8`, `mypy`, `black` and `isort` in lint.bash.

2.3. Run lint.bash in the pre-commit hook.

2.4. By default, lint/format only files which are different from origin/master to save time: `git diff --diff-filter=d --name-only -z origin/master "[asterisk].py"`.

3. In CI, run lint.bash with `--all` or some other keyword to verify formatting on every file: `git ls-files -z -- "[asterisk].py"`.

After more than a year with this setup I absolutely adore it.

Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Friday June 19, 2020 @01:44AM (#23571366)
Even better, IMHO, is just setting your editor to format on save. That way you can just write ugly code and hit save to get it formatted.

I've found git hooks to be more trouble than they're worth.

But as long as it's enforced in CI you can leave it up to individual team members how they want to do it.

Re:GitHub Super Linter: one linter to rule them all by nxrabl on Thursday June 18, 2020 @02:28PM (#23566069)
Append “?w=1” to the end of a Github PR URL, it’s like passing “-w” to git. (Not that that addresses all of your comment, I just wanted to share the tip. Agreed that smarter diffing would be really nice.)
Re:GitHub Super Linter: one linter to rule them all by u801e on Thursday June 18, 2020 @03:48PM (#23567087)
git diff has a --diff-algorithm parameter that has several options to choose from. I don't know whether Github supports that via url parameters though.
Re:GitHub Super Linter: one linter to rule them all by deadbunny on Thursday June 18, 2020 @06:15PM (#23568748)
The frustration is real in a PR situation when you have your editor set to run a formatter on save (same thing with stripping whitespace) but if you have enough control of the project and want to switch to using a formatter then git can help you there.

You can do a format run over the whole codebase then ignore the commit in blame.

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-w...

Re:GitHub Super Linter: one linter to rule them all by dllthomas on Thursday June 18, 2020 @02:28PM (#23566068)
Hopefully you're already aware but just in case: many tools (including git and github) have an option somewhere to hide whitespace changes. In some contexts this can help a lot, though it certainly doesn't get us all the way there.
Re:GitHub Super Linter: one linter to rule them all by 6gvONxR4sf7o on Thursday June 18, 2020 @12:42PM (#23564889)
So much this. I had strong opinions on style until I found good autoformatters. Now I write horribly unformatted code and it comes out super clean and organized as soon as I hit save. Now I don’t even really care what the standard is because it only affect reading code.
Re:GitHub Super Linter: one linter to rule them all by closed on Thursday June 18, 2020 @01:53PM (#23565676)
I would be a bit surprised if this is true, because it implies that when you're writing code that will be formatted you do not think of the reader's experience.

This could be the case if you have extreme confidence in the formatter, but I have def seen some very funky black outputs. It seems like when writing people will likely do so with a model of how black will yield the final code in mind. (Eg "if I add more characters to this one line list statement, it will get exploded across 5 lines", and affect readability, etc..)

Re:GitHub Super Linter: one linter to rule them all by VectorLock on Thursday June 18, 2020 @05:25PM (#23568202)
Formatters don't have the understanding like the developers do. Certain changes that might increase the understandability for a human might get obliterated if they don't conform to the rules of the autoformatter.
Re:GitHub Super Linter: one linter to rule them all by pmiller2 on Thursday June 18, 2020 @04:57PM (#23567935)
Rather than “writing... with a model of how black will yield the final code in mind,” it’s more like “Oh, shit, Black made a real mess of this. Can I fix this without butchering the code?”
Re:GitHub Super Linter: one linter to rule them all by closed on Thursday June 18, 2020 @07:02PM (#23569101)
Yeah--we're basically second-order black formatters now. Not writing code that looks nice, but writing code so a tool that writes code will make it look nice.
Re:GitHub Super Linter: one linter to rule them all by pmiller2 on Thursday June 18, 2020 @07:57PM (#23569504)
Not really. At least that wasn't my intention to say that. Most of the time, I find Black does a Good Enough Job(tm) that I don't care to mess with it.
Re:GitHub Super Linter: one linter to rule them all by michaelmior on Thursday June 18, 2020 @12:52PM (#23564995)
I agree with sentiment but I don't think it's entirely true that it only affects reading code. When it comes to modifying existing code, I have to deal with whatever format the existing code was written in. For example, personally I hate working with code with tabs so I would find this frustrating. (As an aside, I'll admit this is really my problem and a rather silly one.) Of course one solution is to transform code on read to the current user's preferred format and then back to the canonical format on commit. Although this seems potentially error prone.
Re:GitHub Super Linter: one linter to rule them all by ambicapter on Thursday June 18, 2020 @01:19PM (#23565286)
> When it comes to modifying existing code

You don't have to deal with anything as long as you're using the same formatter everyone else is using.

Re:GitHub Super Linter: one linter to rule them all by michaelmior on Thursday June 18, 2020 @01:24PM (#23565347)
My point was that when writing new code, I can write it in whatever format I want knowing that it's going to be formatted the canonical way. But when modifying code, I have to work with code in one specific format that may not be my preferred format.
Re:GitHub Super Linter: one linter to rule them all by asutekku on Thursday June 18, 2020 @01:29PM (#23565406)
Can’t you just set up a linter/formatter to your style, apply it to your style when editing and on save set it to the project style?
Re:GitHub Super Linter: one linter to rule them all by kevin_thibedeau on Thursday June 18, 2020 @01:40PM (#23565516)
It fucks up the diffs in the codebase.
Re:GitHub Super Linter: one linter to rule them all by michaelmior on Thursday June 18, 2020 @01:55PM (#23565698)
How so? If the canonical format is applied every time you save, you'll always be doing a diff with files using the same format. Of course, it does mean the code in the diffs may not be in your preferred format.
Re:GitHub Super Linter: one linter to rule them all by kevin_thibedeau on Thursday June 18, 2020 @01:57PM (#23565714)
If you want to diff against anything in the past you get a bunch of formatting noise that occludes real changes.
Re:GitHub Super Linter: one linter to rule them all by dtech on Thursday June 18, 2020 @03:47PM (#23567070)
Usually when introducing such a tool you do 1 commit that reformat the whole codebase to the new style and then automatically enforce it.
Re:GitHub Super Linter: one linter to rule them all by erichurkman on Thursday June 18, 2020 @06:33PM (#23568891)
And in those large reformat commits, add a file like `.git-ignore-revs-file` that is checked in, so you can configure git to ignore that revision and pretend it never existed:

    [blame]
      ignoreRevsFile = ".git-ignore-revs-file"
      markIgnoredLines
      markUnblamableLines
Re:GitHub Super Linter: one linter to rule them all by dtech on Friday June 19, 2020 @05:02AM (#23572599)
That's an incredibly useful trick to know
Re:GitHub Super Linter: one linter to rule them all by mcgoo on Thursday June 18, 2020 @03:03PM (#23566468)
This is something that keeps coming back to me either as a feature or as a product of some kind - a tool that can stop this from getting in our way.

The simplest and safest would be to apply the formatter to both the old and the new copy before diffing it. It ceases to be the actual difference at that point, but there are definitely two distinct use cases for diffs - one for humans to read and one for the machine to apply.

The other case that would be amazing but even more of a stretch would be to rewrite the entire history. It seems like there is a spot for "different views of history" and you could do a no-difference merge to join the to histories as of now so that the actual history did not get lost. As I write this, it starts to sound like just a caching system for the idea above.

This needs a highly reliable formatter of course... I have on occasion had code broken when formatting.

Re:GitHub Super Linter: one linter to rule them all by michaelmior on Thursday June 18, 2020 @02:26PM (#23566043)
If you're talking about moving from a codebase that did not use a consistent formatting style or a style that did not match the auto formatter configuration, sure. I was assuming a case where automatic formatting was done from the start.
Re:GitHub Super Linter: one linter to rule them all by peterstensmyr on Thursday June 18, 2020 @07:17PM (#23569220)
Git has an option to ignore certain commits when doing a git blame, —ignore-revs. You can also point it to a file with —ignore-revs-file <file>. You can configure this per project with git config ignoreRevsFile .git-blame-ignore-revs. After doing this, you get nice diffs AND nice looking code. The price to pay is that every developer has to run one git command locally.
Re:GitHub Super Linter: one linter to rule them all by libria on Thursday June 18, 2020 @02:22PM (#23565990)
I feel like this is a team preference problem and not a formatter problem. The formatter will only do what you tell it, spaces or tabs.

Looking at this another way, formatters are designed to "frustrate" devs into working only 1 way. If you think it's more helpful to have a codebase with mixed spaces/tabs with commits that express each developer's unique flair, then a formatter is not for your team.

Re:GitHub Super Linter: one linter to rule them all by VectorLock on Thursday June 18, 2020 @05:28PM (#23568231)
Formatters are a way for one person who likes the formatters output to enforce their will on other who might not necessarily like that.
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

Re:GitHub Super Linter: one linter to rule them all by protonimitate on Thursday June 18, 2020 @01:03PM (#23565134)
Yup, we recently implemented auto linting/formatting using pre-commit hooks and it's made a huge difference in maintainability and readability.

I don't care about the specific formatting/linting rules as much as I care about consistency. Auto formatting is great to reduce friction for those on the team who can't/won't convert change how they write code locally.

Re:GitHub Super Linter: one linter to rule them all by autarch on Thursday June 18, 2020 @11:03PM (#23570548)
Universal formatter & linter tools already exist. A whole bunch of them, and they're much better than this one. I wrote about a number of them on my blog at https://blog.urth.org/2020/05/08/comparing-code-quality-meta...
Re:GitHub Super Linter: one linter to rule them all by bborud on Friday June 19, 2020 @09:17AM (#23574211)
I used to program Java. A friend of mine put together the largest slide deck I have ever seen documenting not only how we format code, but also rules for how to structure code.

We spent a lot of time on making the code look like it at least came from the same company. And weeks of my life has been wasted trying to get people to agree on code formatting and coding style.

Fast forward a few years and we start using Go. I didn't agree with some of the formatting choices or code conventions. And pretty much everyone on the team had at least one thing that would grind their gears.

But we agreed that we'd use the gofmt tool to format the code. As everyone now does: by ensuring whatever IDE or editor we use pipes the code through that.

It took less than a week for everyone to adapt and I have hardly heard anyone complain since. There are still things I think could have been different, but for me, that's a very low price to pay for not needing to have these discussions.

Re:GitHub Super Linter: one linter to rule them all by chriswarbo on Friday June 19, 2020 @06:14AM (#23572954)
IMHO there should be a distinction between code serialisation (the bytes on-disk, in version control) and code formatting for display/editing.

The serialisation should be normalised automatically, preferably in a way that minimises line-based diffs.

The way code is formatted for display should be distinct, and can usually be more of a personal preference. Most people seem to be happy for their editor to use syntax highlighting to make things more readable, but not much else. Indentation, line length, aligning sub-expressions, etc. can also help readability, but showing those things differently from the bytes on disk is usually avoided.

Perhaps this is due to a conflation of meaning for certain bytes. For example, \n can mean "token separator" to the language, "long line splitter" or "intent separator" to the developer, "unit of comparison separator" to version control, etc.

Re:GitHub Super Linter: one linter to rule them all by BurningFrog on Thursday June 18, 2020 @03:23PM (#23566722)
I can definitely format code better than Black does. But that's probably not true for the average programmer. I do appreciate it formatting big dicts for me.

If you find formatting discussions with your teammates painful, Maybe some fraction of your team are stubborn jerks?

I've worked where formatting discussions were always friendly and constructive. It can be done.

Re:GitHub Super Linter: one linter to rule them all by nilkn on Thursday June 18, 2020 @03:25PM (#23566751)
My experience with black is that it’s good enough for Python that it’s a waste of time to not use it. Sure, on many teams formatting discussions are friendly. But why even spend the time?

It also really democratizes the language, because even folks brand new to Python or who are inexperienced with programming in general end up with code that is well-formatted and consistent with everything else.

Re:GitHub Super Linter: one linter to rule them all by BurningFrog on Thursday June 18, 2020 @03:26PM (#23566766)
To me, because readability is the most important aspect of programming, and it needs to be done right.
Re:GitHub Super Linter: one linter to rule them all by nilkn on Thursday June 18, 2020 @03:33PM (#23566860)
But what do you get in that regard by not using black? Maybe in 1% of cases you’ll find a better way of formatting that everyone will also agree is better. That doesn’t seem worth very much at all to me, especially when by not using it you have to do a lot of manual work across the entire team now to get the 99% that is free with black.
Re:GitHub Super Linter: one linter to rule them all by BurningFrog on Thursday June 18, 2020 @04:43PM (#23567789)
Black is not free. At least not for me. I have to put in a fair amount of work to get Black to produce decent code.

Things like changing names to affect line breaks, inlining or outlining expressions etc.

Small things can turn 1 line into 8, and vice versa.

Re:GitHub Super Linter: one linter to rule them all by nilkn on Thursday June 18, 2020 @06:36PM (#23568906)
I’d be willing to bet that in many cases where you feel you need to fight against it, many other folks wouldn’t actually agree that your changes are objectively an improvement.

Now, to be clear, I’m sure it’s possible to find some examples where most programmers would come together and agree that black made the wrong decision. But my experience using it across entire teams is that this is surprisingly rare.

Re:GitHub Super Linter: one linter to rule them all by BurningFrog on Thursday June 18, 2020 @07:13PM (#23569189)
You're probably right, but I'm not interested in putting it to a vote. Most programmers are pretty bad at writing readable code. If the computer can understand the code, many consider it done.

I aim higher than that.

Re:GitHub Super Linter: one linter to rule them all by erik_seaberg on Thursday June 18, 2020 @08:04PM (#23569550)
google-java-format has been imposed from outside our team. It's not configurable, makes poor choices a lot more than 1% of the time, forces diffs to cover many more lines than needed, and vandalizes blocks that were already well-formatted by a professional for human readers.

I think there are few subjective style choices that are so egregious that a robot would have done a better job. Where I want enforcement is likely correctness and safety mistakes.

Re:GitHub Super Linter: one linter to rule them all by nilkn on Thursday June 18, 2020 @08:36PM (#23569764)
I have not used that and can’t speak to its quality.
Re:GitHub Super Linter: one linter to rule them all by pmiller2 on Thursday June 18, 2020 @05:01PM (#23567991)
When you use a standard formatter, people adapt. It’s as if formatting becomes a part of the language. Yes, there’s some initial pain, and, yes, some constructions become awkward occasionally, but, if you really need to, you can generally tell the formatter not to mess with a specific section.
Re:GitHub Super Linter: one linter to rule them all by SPBS on Thursday June 18, 2020 @01:13PM (#23565224)
I like formatters like Prettier and gofmt as well, but not StandardJS. I'd still use it if everyone used it though. I just don't like their stance of relying on automatic semicolon insertion, even if Go does the same thing
Re:GitHub Super Linter: one linter to rule them all by pmiller2 on Thursday June 18, 2020 @04:46PM (#23567820)
I agree with you. We recently implemented a mandatory code formatter for Python code at work. Many people hated it, but I love it for this exact reason. Now, I never get comments about formatting!

In general, I tend not to care a whole lot about style, except to try and match whatever is pre-existing, as long as it’s vaguely readable. Otherwise, it’s basically whatever python-mode on emacs does, subject to a reasonable line length. Formatting nitpicks in code review bug me enough that I always just give in and do what they suggest.

Re:GitHub Super Linter: one linter to rule them all by OkGoDoIt on Friday June 19, 2020 @02:24AM (#23571584)
That would be great if I actually worked on a team who saw the light and used tabs. Unfortunately I haven’t had that pleasure in a long time, so no, I do not agree with their formatting choices to use spaces. I guess what I really need is an editor that will convert spaces to tabs when I open a file and then convert it back to spaces when I close the file. Although that’s still not quite ideal because it’s not always a lossless 2-way conversion.
Re:GitHub Super Linter: one linter to rule them all by nitroll on Saturday June 20, 2020 @07:24PM (#23588309)
No, you need an editor that abstracts away the indentation and uses the existing style of the file. I use the tab key to indent code, my editor (Emacs) is configured to just cycle through sane choices.
Re:GitHub Super Linter: one linter to rule them all by ris on Friday June 19, 2020 @06:12AM (#23572941)
gofmt's idiotic handling of maps and forcing them to align entries was enough to put me off the entire idea of autoformatters.

Enforcing a code style where adding a single byte can result in an unlimited-number-of-lines block in a diff is pure idiocy.

It's bad enough having to review someone's changes when they're polluted with this garbage, but it also makes merges fail more often and pollutes `git blame`.

The idea that people will put up with this crap because they can't just unclench about a few spaces here and there I will never understand.

"But it minimizes diffs because it stops people committing simple spacing changes" - people shouldn't be adding those hunks to their commits in the first place and such changes need to be pulled out in review. This will also get people out of the habit of just blindly doing a `git add`.

edit: I'm certain that if slightly non-uniform formatting really sets off your OCD then this should be solvable to some degree at the editor level, but please keep your obsessions out of my repository. In return I'll keep mine out of yours.

Re:GitHub Super Linter: one linter to rule them all by KerryJones on Thursday June 18, 2020 @02:59PM (#23566411)
Yeah -- we use Python Black and it's a blessing. The entire purpose was to replace linting so that we could have something extremely opinionated so that people could stop arguing.

This seems like a cool tool, but I don't know if I would use it at this point. I would _pay_ for having autoformatters from Github -- it was a pain to set it up and would love to just enable on new projects.

Re:GitHub Super Linter: one linter to rule them all by BiteCode_dev on Thursday June 18, 2020 @01:10PM (#23565197)
> This is why we allow users to use any rules for the linter as they see fit for their repository.

So not like prettier/black/goftm.

You get to choose. It's more of a way to group things.

Which make sense. I don't mind being dictated code formatting, but linters will complain about branching, number of arguments, comments and so on. I change the settings of my linter for each project.

Those should not be fixed.

Re:GitHub Super Linter: one linter to rule them all by gtm1260 on Thursday June 18, 2020 @08:47PM (#23569831)
I really want to love Prettier, but I never want to spend the hours googling etc. on how to setup the frickin config files! Especially as someone who works on a wide variety of languages/file types, I really want to find a drop in formatter that works well enough in all situations.
Re:GitHub Super Linter: one linter to rule them all by CGamesPlay on Thursday June 18, 2020 @10:15PM (#23570344)
I think you might be thinking of ESLint? Prettier has, like, 10 options, and they are all listed on this page [0], and you aren't required to even have a config file because the defaults make sense.

I personally find ESLint to be a nightmare of configurability and silly defaults.

[0] https://prettier.io/docs/en/options.html

Re:GitHub Super Linter: one linter to rule them all by artursapek on Thursday June 18, 2020 @11:34PM (#23570685)
My first real software job I was subject to long, painful PRs full of semi-colon nitpicking. I fucking hated it and have made sure to use auto formatting on any project I work on from now on. gofmt paved the way, but rustfmt and Prettier are also great.
Re:GitHub Super Linter: one linter to rule them all by fizixer on Thursday June 18, 2020 @01:14PM (#23565230)
That's exactly the right way to do it and I've been advocating for this, as well as maximum use of parsing/tranformation/codegen technology (essentially compiler tech) for development productivity, long before LSP was a thing.
Re:GitHub Super Linter: one linter to rule them all by vorticalbox on Thursday June 18, 2020 @03:43PM (#23567010)
Out front end team use prettier on back team we use eslint and air bnb style.

But totally agree on forced lining.

Stopping things like reassign function parameters, no unused variables and the like really makes code far nicer.

I also love auto formatting in vscode saves a lot of time.

Re:GitHub Super Linter: one linter to rule them all by myko on Friday June 19, 2020 @09:53AM (#23574519)
Very frustrating working in Xcode because it doesn't support a code formatter out of the box. Some extensions do a passable job but randomly break when I have multiple versions of Xcode installed.
Re:GitHub Super Linter: one linter to rule them all by pezo1919 on Thursday June 18, 2020 @11:36PM (#23570689)
I'd like to see robust solutions for formatting personalisation: locally I'd like to use my own style, but in repo it might be canonical so an assistance for that might be easier to create.
Re:GitHub Super Linter: one linter to rule them all by z3t4 on Thursday June 18, 2020 @05:03PM (#23568018)
I don't like auto-formatters as they take away the personality, and sometimes even change the meaning of the code. I prefer intelligently formatted code over automatically formatted code.
Re:GitHub Super Linter: one linter to rule them all by microcolonel on Thursday June 18, 2020 @03:46PM (#23567051)
I think some mix should be reached with auto formatting. I like the automatic indentation I get in Emacs with clojure-mode, but for everything else, manual formatting is just better.
Re:GitHub Super Linter: one linter to rule them all by justatdotin on Thursday June 18, 2020 @08:43PM (#23569807)
when my co-worker moves a curly boy, I'll fight to the death. When a tool does it, I shrug and move on..
Re:GitHub Super Linter: one linter to rule them all by Insanity on Friday June 19, 2020 @07:51AM (#23573402)
Exactly what I love about Go and Gofmt.