Style Guides
All of our repositories should follow similar code design patterns. This makes our code more digestible by both humans and machines. We accomplish this by using strict linting settings and asking all of our contributors to verse themselves on the de-facto standard style guides that apply to the type of project they are working with.
Below, you will find recommendations for style guides to abide by depending on the project type. Linting details are covered on the Linting page.
General
In general, you should take note of the style guides published by industry giants like Google. Some of these style guides, which includes style guides for multiple languages, are:
These style guide catalogs link to style guides to a plethora of languages that we do not focus on as well as auxilary style guides that should be paid attention to like Google's Markdown Style Guide.
Ansible
There are no widely accepted style guides available for Ansible. Instead, we recommend you look at our Android Studio role as an example. Take special note of the following:
- Comments in the task files are specially marked up
- Comments in the variable files are specially marked up
- The
main.yml
file references other files based on the operating system.
If you follow the format of the Android Studio role, our automated system will automatically generate documentation properly for the role. This leads to a better experience for internetizens who make use of the role.
Bash / Shell
The following style guides are recommended:
Combine the advice given by the style guides along with the recommendations given by the shellcheck
linter.
CSS / SASS / HTML
There is no shortage of CSS / SASS / HTML style guides. All of the following guides / information portals are recommended:
- Airbnb CSS / SASS Style Guide
- Airbnb CSS in JavaScript Guide
- Google HTML / CSS Style Guide
- BEM
- CSS Guidelines
- SASS Guidelines
- Khan Academy CSS Style Guide
Go
The following style guides are recommended:
Our Go projects are configured to use golangci-lint
with a handful of plugins. The configuration is stored in the .config/
folder.
PowerShell
The following PowerShell style guide is perhaps one of the more notable style guides available for PowerShell:
Python
Additionally, the Hitcherhiker's Guide to Python is a comprehensive documentation portal that could be invaluable to some.
Flake8, with a few plugins, is used in our Python projects. The configuration is stored in the .config/
folder.
Rust
TypeScript / JavaScript
- Airbnb JavaScript Style Guide
- Google TypeScript Style Guide
- Google JavaScript Style Guide
- Clean Code JavaScript
- Khan Academy JavaScript Style Guide
Additionally, JavaScript, The Right Way is a valuable resource that links to many useful resources.
Our projects are configured to use ESLint with a custom NPM module named eslint-config-strict-mode
that defines the ESLint settings / plugins. If you would like to change the settings, you should either create a pull request against eslint-config-strict-mode
or utilize the package.json
file to define project-specific linting overrides.
Angular
The official Angular website offers an official style guide: