Check source code with pycodestyle

def check_with_pep8(source_code, filename=None):
    """Check source code with pycodestyle"""
    try:
        args = get_checker_executable('pycodestyle')
        results = check(args, source_code, filename=filename, options=['-r'])
    except Exception:
        # Never return None to avoid lock in spyder/widgets/editor.py
        # See Issue 1547
        results = []
        if DEBUG_EDITOR:
            traceback.print_exc()  # Print exception in internal console
    return results