How to use the bashate.messages._Message function in bashate

To help you get started, we’ve selected a few bashate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / bashate / bashate / messages.py View on Github external
"""
        [ is the POSIX test operator, while [[ is the bash keyword
        comparision operator.  Comparisons such as =~, < and > require
        the use of [[.
        """,
        'default': 'E',
    },
}

MESSAGES = {}

_default_errors = []
_default_warnings = []

for k, v in _messages.items():
    MESSAGES[k] = _Message(k, v['msg'], v['long_msg'], v['default'])

    if v['default'] == 'E':
        _default_errors.append(k)
    if v['default'] == 'W':
        _default_warnings.append(k)

# convert this to the regex strings.  This looks a bit weird
# but it fits the current model of error/warning/ignore checking
# easily.
_default_errors = '^(' + '|'.join(_default_errors) + ')'
_default_warnings = '^(' + '|'.join(_default_warnings) + ')'


def is_default_error(error):
    return re.search(_default_errors, error)

bashate

A pep8 equivalent for bash scripts

Apache-2.0
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis

Similar packages