Skip to content

Style Guide

This page contains style guidelines for various aspects of ASKCOS development. The guidelines listed here should be followed for all new code. When modifying existing code, aligning with the existing code style is ok, although updating major style deviations to align with this guide is also a good option.

Python Code Style

In general, Python code should adhere to PEP-8 whenever possible. For situations not specified in PEP-8, the Google Python Style Guide should be used for reference. In particular, docstrings should follow Google style (as opposed to NumPy style).

JavaScript Code Style

JavaScript code should adhere to the ESLint configuration specified in askcos_vue. In addition, the Vue style guide should also be followed as appropriate, especially the Priority A and B rules.

Git Style

Author details

Make sure to update your author details (name and email) before making commits. It is highly recommended to use a consistent name and email across all computers (and GitLab) to ensure that all commits are property attributed.

bash
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

Branch naming

Git branch names should be short but descriptive, written in all lowercase with words separated by hyphens or underscores. It's recommended to include a prefix indicating the main category of the change, e.g. feature/, bug/, documentation/ etc.

Commit message

Commit messages are very important. Please review the [Commit Message Format](Commit Message Format) before submitting any merge request.

Git history

The history of feature branches should be linear and based off of the current dev branch. The dev branch should never be merged into feature branches; instead, feature branches should be rebased onto the dev branch.

To rebase a branch:

bash
$ git fetch origin dev
$ git rebase origin/dev

Released under the MIT License.