コード例 #1
0
ファイル: test_codebase.py プロジェクト: Priya22/tweedr
def test_pyflakes():
    '''Running pyflakes checks recursively in %s''' % tweedr.root
    from pyflakes import api as pyflakes
    total_errors = 0
    for filepath in walk(tweedr.root, not_egg, not_git, is_python):
        total_errors += pyflakes.checkPath(filepath)

    assert total_errors == 0, 'Codebase does not pass pyflakes (%d errors)' % total_errors
コード例 #2
0
def test_pyflakes():
    '''Running pyflakes checks recursively in %s''' % tweedr.root
    from pyflakes import api as pyflakes
    total_errors = 0
    for filepath in walk(tweedr.root, not_egg, not_git, is_python):
        total_errors += pyflakes.checkPath(filepath)

    assert total_errors == 0, 'Codebase does not pass pyflakes (%d errors)' % total_errors
コード例 #3
0
ファイル: test_codebase.py プロジェクト: Priya22/tweedr
def test_mysql_credentials_no_ci():
    names = ['MYSQL_PASS', 'MYSQL_HOST']
    values = [os.environ[name] for name in names]

    for filepath in walk(tweedr.root):
        with open(filepath) as fp:
            contents = fp.read()
            for value in values:
                assert value not in contents, 'Found a blacklisted credential (%s) in %s' % (value, filepath)
コード例 #4
0
def test_mysql_credentials_no_ci():
    names = ['MYSQL_PASS', 'MYSQL_HOST']
    values = [os.environ[name] for name in names]

    for filepath in walk(tweedr.root):
        with open(filepath) as fp:
            contents = fp.read()
            for value in values:
                assert value not in contents, 'Found a blacklisted credential (%s) in %s' % (
                    value, filepath)
コード例 #5
0
ファイル: test_codebase.py プロジェクト: Priya22/tweedr
def test_trailing_whitespace():
    '''Running trailing whitespace checks recursively in %s''' % tweedr.root
    total_errors = 0
    for filepath in walk(tweedr.root, not_egg, not_git, not_static, is_source):
        with open(filepath) as fp:
            for line_i, raw in enumerate(fp):
                line = raw.rstrip('\n')
                if line.endswith((' ', '\t')):
                    print >> sys.stdout, '%s:%d: trailing whitespace' % (filepath, line_i + 1)
                    total_errors += 1

    assert total_errors == 0, 'Codebase has trailing whitespace (%d errors)' % total_errors
コード例 #6
0
ファイル: test_codebase.py プロジェクト: Priya22/tweedr
def test_pep8():
    '''Running PEP-8 checks recursively in %s''' % tweedr.root
    import pep8
    ignore = [
        'E128',  # E128 continuation line under-indented for visual indent
        'E501',  # E501 line too long (?? > 79 characters)
    ]
    total_errors = 0
    pep8style = pep8.StyleGuide(ignore=ignore)
    for filepath in walk(tweedr.root, not_egg, not_git, is_python):
        total_errors += pep8style.check_files([filepath]).total_errors

    assert total_errors == 0, 'Codebase does not pass PEP-8 (%d errors)' % total_errors
コード例 #7
0
def test_trailing_whitespace():
    '''Running trailing whitespace checks recursively in %s''' % tweedr.root
    total_errors = 0
    for filepath in walk(tweedr.root, not_egg, not_git, not_static, is_source):
        with open(filepath) as fp:
            for line_i, raw in enumerate(fp):
                line = raw.rstrip('\n')
                if line.endswith((' ', '\t')):
                    print >> sys.stdout, '%s:%d: trailing whitespace' % (
                        filepath, line_i + 1)
                    total_errors += 1

    assert total_errors == 0, 'Codebase has trailing whitespace (%d errors)' % total_errors
コード例 #8
0
def test_pep8():
    '''Running PEP-8 checks recursively in %s''' % tweedr.root
    import pep8
    ignore = [
        'E128',  # E128 continuation line under-indented for visual indent
        'E501',  # E501 line too long (?? > 79 characters)
    ]
    total_errors = 0
    pep8style = pep8.StyleGuide(ignore=ignore)
    for filepath in walk(tweedr.root, not_egg, not_git, is_python):
        total_errors += pep8style.check_files([filepath]).total_errors

    assert total_errors == 0, 'Codebase does not pass PEP-8 (%d errors)' % total_errors