Live data from Hacker News

Dockerfmt: A Dockerfile Formatter

github.com

51–60 of 67 posts

Re: Dockerfmt: A Dockerfile Formatter

#51
post #22

Earlier quoted context omitted.

I feel dumber after using reddit

The same is usually said about watching Spongebob Squarepants, but YMMV. :)

At least with Spongebob you feel dumb and happy. Feels like the whole world is dumb and angry now.

Re: Dockerfmt: A Dockerfile Formatter

#52
post #47

I'd love to indent the body of each stage in multi-stage dockerfiles, like: FROM foo ... FROM bar ... It's easy to see at glance what's going on.

This reminds me of SQL indentation “best practices” discussion [1]

I personally don’t find this particularly helpful but can see it helping some folks. You write enough dockerfiles, the formatting becomes irrelevant.

What pisses me off though is _inconsistency_. One code base uses "formatting practices 1b", then another code base uses "formatting practices 2x". Then the worst offender: a service owners that can’t make up their mind and each developer makes up their own "best practices".

[1] https://stackoverflow.com/questions/272210/sql-statement-ind...

Re: Dockerfmt: A Dockerfile Formatter

#53
It’s wild that this has to be a third party offering.

I wish projects would adopt/create their own formatters like go and rust.

The amount of time I have wasted discussing "best practices" with "senior" engineers is way too damn high.

In code bases such as go or rust, the discussion ends with the "the built in formatter and preferences is preferred"

Re: Dockerfmt: A Dockerfile Formatter

#54
post #20

waaaat? https://github.com/reteps/dockerfmt#:~:text=The%20RUN%20pars... I am firmly in the camp of RUN set -e ;\ export DEBIAN_FRONTEND=noninteractive ;\ etc etc so I guess this tool isn't for me

Is there any reason you prefer `set -e` over `&&`? I'm curious if this is a readability thing.

Readability is putting it mildly; do you write your shell scripts using that && style? No? Why not, is it for readability?

I also have a hard time reasoning about && with anything other than the most braindead sequence of commands because: $(thing && if other_thing; then inner_thing1 && thing2; fi && ohgawd)

And I just realized while typing that out that if its parser doesn't support ; then I guess one needs to

  RUN if conditional_thing \
      then good_luck && \
      fi && \
      echo "whew"

Re: Dockerfmt: A Dockerfile Formatter

#57

I had a chuckle when I looked at the source code and could not find a Dockerfile in there. I want to kick the tires on it and the easiest way would be to run it as a Docker container against an existing file and alas, I cannot.

I usually share the sentiment, but, come on, it's packaged as a single binary file...

Re: Dockerfmt: A Dockerfile Formatter

#59

You aren’t a real software engineer if your project doesn’t have 50 dot files in the root for your formatters, package mangers, linters, and ci. Who formats the formatter configs?

> Who formats the formatter configs?

Other formatters of course since the configs are often yaml, toml, ini or json.

Re: Dockerfmt: A Dockerfile Formatter

#60
post #54

Earlier quoted context omitted.

Is there any reason you prefer `set -e` over `&&`? I'm curious if this is a readability thing.

Readability is putting it mildly; do you write your shell scripts using that && style? No? Why not, is it for readability? I also have a hard time reasoning about && with anything other than the most braindead sequence of commands because: $(thing && if other_thing; then inner_thing1 && thing2; fi && ohgawd) And I just realized while typing that out that if its parser doesn't support ; then I guess one needs to RUN i…

This is a valid point -- I replied to why this is the way it is here: https://news.ycombinator.com/item?id=43629049. I understand it's not ideal for many, and I am open to PRs!
Post reply on HN