Code style enforcement for bash programs.
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.zuul.d add python 3.6 unit test job Sep 10, 2018
bashate Switch to pep8 output format Jul 18, 2018
doc/source Address new pypi requirements on README.rst Jul 19, 2018
playbooks/legacy/bashate-devstack Stop using slave_scripts/install-distro-packages.sh Apr 20, 2018
releasenotes Switch to pep8 output format Jul 18, 2018
.coveragerc Update .coveragerc after the removal of openstack directory Oct 21, 2016
.gitignore Import fresh cookiecut bash8 project Apr 23, 2014
.gitreview Fix .gitreview project path Jul 16, 2014
.mailmap Import fresh cookiecut bash8 project Apr 23, 2014
.pre-commit-hooks.yaml Enable bashate use with pre-commit Jul 4, 2018
.testr.conf Import fresh cookiecut bash8 project Apr 23, 2014
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 Address new pypi requirements on README.rst Jul 19, 2018
babel.cfg Import fresh cookiecut bash8 project Apr 23, 2014
bindep.txt Add bindep.txt file Apr 20, 2018
openstack-common.conf the great rename of bash8 -> bashate Jun 20, 2014
pylintrc Add Pylint testenv environment Oct 13, 2014
requirements.txt Update to openstackdocstheme Jul 21, 2017
setup.cfg Change openstack-dev to openstack-discuss Dec 4, 2018
setup.py Update requirements Jan 5, 2016
test-requirements.txt Update to openstackdocstheme Jul 21, 2017
tox.ini Update min tox version to 2.0 Nov 2, 2018

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