Modern coding with formatters and linters 2022.07.26

Many developers nowadays use code auto-formatters and linters. Modern languages like Rust even have these tools built in with their environments (cargo fmt, cargo clippy).

You may write a piece of Python code like

if a:
    something_long(that_should_be_split, to_several_lines, because_we_dont, like_horizontal_scrolling)
else:
    if b:
        c()
    else:
        d()

And then click a button to auto-format it to:

if a:
    something_long(
        that_should_be_split,
        to_several_lines,
        because_we_dont,
        like_horizontal_scrolling,
    )
else:
    if b:
        c()
    else:
        d()

Afterwards you may handle linter suggestions from a tool such as sourcery to turn it to:

if a:
    something_long(
        that_should_be_split,
        to_several_lines,
        because_we_dont,
        like_horizontal_scrolling,
    )
elif b:
    c()
else:
    d()

This is certainly an improvement over eras when those suggestions came from manual code reviewers work in pull requests.

But I can't help but notice how many steps are in the programming process:

Programmer State Machine

Wouldn't it be awesome if this was a non-issue? I think it would, and that's how it works in Lamdu:

For more info on Lamdu's approach see the demo in this video:

Notes