projectsyn / documentation

The Project Syn main documentation repository
https://docs.syn.tools/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Establish style guide #40

Closed corvus-ch closed 3 years ago

corvus-ch commented 4 years ago

Require all jsonnet code to be compliant with jsonnetfmt using the default options. For CI/CD pipelines, the command jsonnetfmt --test **/*.jsonnet can be used, while autoformatting can be done using jsonnetfmt -i **/*.jsonnet.

jsonnetfmt is documented at https://jsonnet.org/learning/tools.html.

For YAML files, we should use yamllint For CI/CD pipelines, the command yamllint -f parsable --no-warnings **/*.yml can be used. For checking before commiting, yamllint **/*.yml will do the trick.

Rule wise, we might opt to make line-length a warning instead an error and or increase the character count from 80 to something like 120. Subject to be discussed.

corvus-ch commented 4 years ago

In a discussion with @simu we figured that there is already a mess with naming of exported things in libraries:

I suggest to follow the lead of Jsonnet and take camelCase as the standard for exported functions and variables.

corvus-ch commented 4 years ago

Consider to also use https://editorconfig.org/. While we can check for this in CI/CD, having an editor config file results in a better developer experience.

srueg commented 4 years ago

Possible ideas: https://github.com/databricks/jsonnet-style-guide

corvus-ch commented 3 years ago

Closed by #88.