d2iq-archive / kubernetes-mesos

A Kubernetes Framework for Apache Mesos
634 stars 92 forks source link

Define shell scripting style guide #429

Open tsenart opened 9 years ago

tsenart commented 9 years ago

In order to have consistent, predictable and correct shell scripts, we should all follow the same guidelines. At the moment we have none, so let's take inspiration in the following guidelines and agree on something that makes sense to us.

https://google-styleguide.googlecode.com/svn/trunk/shell.xml https://github.com/bahamas10/bash-style-guide

/cc @jdef @karlkfi @sttts

sttts commented 9 years ago

What are the ones that k8s upstream uses? it seems they have a number of rules, compare the review comments of the docker-compose branch.

tsenart commented 9 years ago

We could look at what they're doing, but I'd like us to apply this style guide to every shell script we write, not just the ones related to Kubernetes. I'm not sure where such meta-issues would fit.

sttts commented 9 years ago

Yes, but in the k8s repo we are bound to their style. Which other shell scripts do we have (other than some small Makefile snippets)?

tsenart commented 9 years ago

We got the DCOS image scripts, or did we completely get rid of those? On Fri 7 Aug 2015 at 17:11 Dr. Stefan Schimanski notifications@github.com wrote:

Yes, but in the k8s repo we are bound to their style. Which other shell scripts do we have (other than some small Makefile snippets)?

— Reply to this email directly or view it on GitHub https://github.com/mesosphere/kubernetes-mesos/issues/429#issuecomment-128726526 .

sttts commented 9 years ago

No, not completely, but reduced a lot. Maybe we should spend more time in porting those to Go than to make them nice and tidy.

tsenart commented 9 years ago

+1 for Go.

karlkfi commented 9 years ago

bahamas10's style guide conflicts not only with the k8s conventions but with google's guide and my own sense of style.

Personally, I think if it's not automated then it's a waste of time enforcing it strictly. That said, it's worth being consistent. It should be required to be consistent within a file and encouraged to be consistent with existing files. Style can always be improved later. So it shouldn't hold up a review too long, unless it's unreadable or inconsistent.

tsenart commented 9 years ago

@karlkfi: I suggested the style guides for inspiration only. We should pick the things that make sense to us and write up our own style guide. Enforcement can be done at review time and will be less time consuming once everyone is used to it. In another issue, I also suggested we use http://shellcheck.net/about.html