Esempio n. 1
0
# Add 'contrib' to sys.path to simulate installation of package 'flake8'
# and it's dependencies: 'pyflake', 'pep8', 'mccabe' and 'pep8-naming'
CONTRIB_PATH = os.path.join(os.path.dirname(__file__), 'contrib')
if CONTRIB_PATH not in sys.path:
    sys.path.insert(0, CONTRIB_PATH)

import ast
import mccabe
import pep8
import pep8ext_naming
import pyflakes.api
from pep257 import PEP257Checker
from pyflakes import checker as pyflakes_checker

from flake8._pyflakes import patch_pyflakes
patch_pyflakes()


if sys.platform.startswith('win'):
    DEFAULT_CONFIG_FILE = os.path.expanduser(r'~\.flake8')
else:
    DEFAULT_CONFIG_FILE = os.path.join(
        os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),
        'flake8'
    )
CONFIG_FILES = ('setup.cfg', 'tox.ini', '.pep8')


class Pep8Report(pep8.BaseReport):
    """
    Collect all check results.
Esempio n. 2
0
# Add 'contrib' to sys.path to simulate installation of package 'flake8'
# and it's dependencies: 'pyflake', 'pep8', 'mccabe' and 'pep8-naming'
CONTRIB_PATH = os.path.join(os.path.dirname(__file__), 'contrib')
if CONTRIB_PATH not in sys.path:
    sys.path.insert(0, CONTRIB_PATH)

import ast
import mccabe
import pep8
import pep8ext_naming
import pyflakes.api
from pep257 import PEP257Checker
from pyflakes import checker as pyflakes_checker

from flake8._pyflakes import patch_pyflakes
patch_pyflakes()

if sys.platform.startswith('win'):
    DEFAULT_CONFIG_FILE = os.path.expanduser(r'~\.flake8')
else:
    DEFAULT_CONFIG_FILE = os.path.join(
        os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),
        'flake8')
CONFIG_FILES = ('setup.cfg', 'tox.ini', '.pep8')


class Pep8Report(pep8.BaseReport):
    """
    Collect all check results.
    """
    def __init__(self, options):