Skip to content
Code style enforcement for bash programs.
Python Shell
Branch: master
Clone or download
Latest commit 949a320 Aug 30, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.zuul.d Add Python 3 Train unit tests Jul 15, 2019
bashate Add --version option Jun 27, 2019
doc/source Address new pypi requirements on README.rst Jul 19, 2018
playbooks/legacy/bashate-devstack OpenDev Migration Patch Apr 19, 2019
releasenotes Switch to pep8 output format Jul 18, 2018
.coveragerc Update .coveragerc after the removal of openstack directory Oct 21, 2016
.gitignore
.gitreview
.mailmap Import fresh cookiecut bash8 project Apr 23, 2014
.pre-commit-hooks.yaml Enable bashate use with pre-commit Jul 4, 2018
.stestr.conf
CONTRIBUTING.rst Fix formatting of contributor page Jul 21, 2017
HACKING.rst the great rename of bash8 -> bashate Jun 20, 2014
LICENSE Import fresh cookiecut bash8 project Apr 23, 2014
README.rst
babel.cfg
bindep.txt
openstack-common.conf the great rename of bash8 -> bashate Jun 20, 2014
requirements.txt Update to openstackdocstheme Jul 21, 2017
setup.cfg
setup.py Update requirements Jan 5, 2016
test-requirements.txt Use stestr as a test runner Jun 24, 2019
tox.ini Add Python 3 Train unit tests Jul 15, 2019

README.rst

bashate

A pep8 equivalent for bash scripts

This program attempts to be an automated style checker for bash scripts to fill the same part of code review that pep8 does in most OpenStack projects. It started from humble beginnings in the DevStack project, and will continue to evolve over time.

The output format aims to follow pycodestyle (pep8) default output format.

Currently Supported Checks

Errors

Basic white space errors, for consistent indenting

  • E001: check that lines do not end with trailing whitespace
  • E002: ensure that indents are only spaces, and not hard tabs
  • E003: ensure all indents are a multiple of 4 spaces
  • E004: file did not end with a newline
  • E005: file does not begin with #! or have a .sh prefix
  • E006: check for lines longer than 79 columns

Structure Errors

A set of rules that help keep things consistent in control blocks. These are ignored on long lines that have a continuation, because unrolling that is kind of "interesting"

  • E010: do not on the same line as for
  • E011: then not on the same line as if or elif
  • E012: heredoc didn't end before EOF
  • E020: Function declaration not in format ^function name {$

Obsolete, deprecated or unsafe syntax

Rules to identify obsolete, deprecated or unsafe syntax that should not be used

  • E040: Syntax errors reported by bash -n
  • E041: Usage of $[ for arithmetic is deprecated for $((
  • E042: local declaration hides errors
  • E043: arithmetic compound has inconsistent return semantics
  • E044: Use [[ for =~,<,> comparisions
You can’t perform that action at this time.