News for hackers. Stuff that matters.
Re:How to Make Your Code Reviewer Fall in Love with You by Seb-C on Monday December 07, 2020 @09:09PM (#25340783)
I agree with automating it, but I also have seen automated styles going too far, more often than not.

Automated styling should be kept minimal, like checking names and indentation. Absolute rules does not work because then you cannot deviate from it even if it is appropriate in the right situation.

The standard JavaScript checkers nowadays are ridiculously strict and forces me to spend time writing a less readable code. For example yesterday my code was invalid because I did not write properties of an object alphabetically. So I had to convert this:

    {
        host: ,
        port: ,

        key: ,

        username: ,
        password: ,
    }
Into this mess:

    {
        host: ,
        key: ,
        password: ,
        port: ,
        username: ,
    }
With tslint I cannot even execute my code if the formatting is invalid. So if I write a console.log or forget to add a space between the slash and the code I commented, the compilation crashes.
Re:How to Make Your Code Reviewer Fall in Love with You by ericmcer on Tuesday December 08, 2020 @09:52AM (#25345891)
It is consistent though, do you have a better generic system for grouping object keys than alphabetization? It’s pretty handy to approach a codebase knowing that it has enforced this convention.
Re:How to Make Your Code Reviewer Fall in Love with You by wool_gather on Saturday December 12, 2020 @04:47PM (#25402033)
The point is that it's not generic: there is meaning conveyed by the grouping that can't be expressed as an easy script (which is why there's a human writing the code in the first place).
Re:How to Make Your Code Reviewer Fall in Love with You by Seb-C on Tuesday December 08, 2020 @08:41PM (#25354323)
My point is that having rules on this kind of detail is more harmful than beneficial, so there should not be one in the first place.
Re:How to Make Your Code Reviewer Fall in Love with You by heavenlyblue on Tuesday December 08, 2020 @06:16AM (#25343924)
Maybe that should not be an object then, but a URL or just several objects.
Re:How to Make Your Code Reviewer Fall in Love with You by Seb-C on Tuesday December 08, 2020 @09:51AM (#25345864)
This is a very common pattern for a lot of third party packages.

And it is just an example to show that there are perfectly legitimate cases that are more readable when not alphabetically sorted.