def open(self):
        name_checker = get_checker(self.linter, ForeignKeyStringsChecker)
        # pylint command should not run with modules from both cms and (lms, common) at once
        cms_module = False
        lms_module = False
        common_module = False
        for arg in self.linter.cmdline_parser.largs:
            if arg.startswith('cms'):
                cms_module = True
            elif arg.startswith('lms'):
                lms_module = True
            elif arg.startswith('common'):
                common_module = True

        if cms_module and (lms_module or common_module):
            # when cms module is present in pylint command, it can't be parired with (lms, common)
            # as common and lms gives error with cms test settings
            raise ArgumentCompatibilityError(
                "Modules from both common and lms can't be paired with cms while running pylint"
            )
        elif cms_module:
            # If a module from cms is present in pylint command arguments
            # and ony other module from (openedx, pavelib) is present
            # than test setting of cms is used
            name_checker.config.django_settings_module = 'cms.envs.test'
        else:
            # If any module form (lms, common, openedx, pavelib) is present in
            # pylint command arguments than test setting of lms is used
            name_checker.config.django_settings_module = 'lms.envs.test'
Ejemplo n.º 2
0
def load_configuration(linter):
    """
    Amend existing checker config.
    """
    name_checker = get_checker(linter, NameChecker)
    name_checker.config.good_names += ('qs', 'urlpatterns', 'register', 'app_name', 'handler500')

    # we don't care about South migrations
    linter.config.black_list += ('migrations', 'south_migrations')
Ejemplo n.º 3
0
def register(linter):
    # this method is meant for registering additional checkers, however
    # we will also use it to amend existing checker config
    name_checker = get_checker(linter, NameChecker)
    name_checker.config.good_names += ('qs',)
    const_rgx = '(%s|urls|urlpatterns|register)' % name_checker.config.const_rgx.pattern
    name_checker.config.const_rgx = re.compile(const_rgx)

    # we don't care about South migrations
    linter.config.black_list += ('migrations', 'south_migrations')

    # add all of the checkers
    register_checkers(linter)

    # register any checking fiddlers
    apply_augmentations(linter)
Ejemplo n.º 4
0
def register(linter):
    """
    Registering additional checkers.

    However, we will also use it to amend existing checker config.
    """
    name_checker = get_checker(linter, NameChecker)
    name_checker.config.good_names += ('qs', 'urlpatterns', 'register', 'app_name', 'handler500')

    # we don't care about South migrations
    linter.config.black_list += ('migrations', 'south_migrations')

    # add all of the checkers
    register_checkers(linter)

    # register any checking fiddlers
    apply_augmentations(linter)
Ejemplo n.º 5
0
def register(linter):
    """Registering additional checkers.

    However, we will also use it to amend existing checker config.
    """
    name_checker = get_checker(linter, NameChecker)
    name_checker.config.good_names += ('qs',)
    # Default pylint.checkers.base.CONST_NAME_RGX = re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$').
    const_rgx = '%s|(urls|urlpatterns|register)%s' % (name_checker.config.const_rgx.pattern[:-2], name_checker.config.const_rgx.pattern[-2:])
    name_checker.config.const_rgx = re.compile(const_rgx)

    # we don't care about South migrations
    linter.config.black_list += ('migrations', 'south_migrations')

    # add all of the checkers
    register_checkers(linter)

    # register any checking fiddlers
    apply_augmentations(linter)
Ejemplo n.º 6
0
def register(linter):
    """Registering additional checkers.

    However, we will also use it to amend existing checker config.
    """
    name_checker = get_checker(linter, NameChecker)
    name_checker.config.good_names += ('qs', )
    # Default pylint.checkers.base.CONST_NAME_RGX = re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$').
    const_rgx = '%s|(urls|urlpatterns|register)%s' % (
        name_checker.config.const_rgx.pattern[:-2],
        name_checker.config.const_rgx.pattern[-2:])
    name_checker.config.const_rgx = re.compile(const_rgx)

    # we don't care about South migrations
    linter.config.black_list += ('migrations', 'south_migrations')

    # add all of the checkers
    register_checkers(linter)

    # register any checking fiddlers
    apply_augmentations(linter)
Ejemplo n.º 7
0
def register(linter):
    """
    Registering additional checkers.

    However, we will also use it to amend existing checker config.
    """
    name_checker = get_checker(linter, NameChecker)
    name_checker.config.good_names += ('qs', 'urlpatterns', 'register', 'app_name', 'handler500')

    # we don't care about South migrations
    linter.config.black_list += ('migrations', 'south_migrations')

    # add all of the checkers
    register_checkers(linter)

    # register any checking fiddlers
    try:
        from pylint_django.augmentations import apply_augmentations
        apply_augmentations(linter)
    except ModuleNotFoundError:
        # probably trying to execute pylint_django when Django isn't installed
        # in this case the django-not-installed checker will kick-in
        pass
Ejemplo n.º 8
0
def register(linter):
    apply_augmentations(linter)

    format_checker = get_checker(linter, FormatChecker)
    format_checker.set_option("max-line-length", 160)
Ejemplo n.º 9
0
def register(linter):
    apply_augmentations(linter)

    format_checker = get_checker(linter, FormatChecker)
    format_checker.set_option('max-line-length', 160)