How to use the prospector.tools.TOOLS.keys function in prospector

To help you get started, we’ve selected a few prospector 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 PyCQA / prospector / prospector / config / configuration.py View on Github external
manager.add(soc.BooleanSetting('member_warnings', default=None))
    manager.add(soc.BooleanSetting('full_pep8', default=None))
    manager.add(soc.IntegerSetting('max_line_length', default=None))

    manager.add(soc.BooleanSetting('messages_only', default=False))
    manager.add(soc.BooleanSetting('summary_only', default=False))
    manager.add(soc.ListSetting(
        'output_format',
        OutputChoice(sorted(FORMATTERS.keys())),
        default=None,
    ))
    manager.add(soc.BooleanSetting('absolute_paths', default=False))

    manager.add(soc.ListSetting(
        'tools',
        soc.Choice(sorted(TOOLS.keys())),
        default=None,
    ))
    manager.add(soc.ListSetting('with_tools', soc.String, default=[]))
    manager.add(soc.ListSetting('without_tools', soc.String, default=[]))
    manager.add(soc.ListSetting('profiles', soc.String, default=[]))
    manager.add(soc.ListSetting('profile_path', soc.String, default=[]))
    manager.add(soc.ChoiceSetting(
        'strictness',
        ['veryhigh', 'high', 'medium', 'low', 'verylow'],
        default=None,
    ))
    manager.add(soc.BooleanSetting('show_profile', default=False))

    manager.add(soc.BooleanSetting('no_external_config', default=False))
    manager.add(soc.StringSetting('pylint_config_file', default=None))
github PyCQA / prospector / prospector / config / __init__.py View on Github external
def _determine_tool_runners(self, config, profile):
        if config.tools is None:
            # we had no command line settings for an explicit list of
            # tools, so we use the defaults
            to_run = set(DEFAULT_TOOLS)
            # we can also use any that the profiles dictate
            for tool in tools.TOOLS.keys():
                if profile.is_tool_enabled(tool):
                    to_run.add(tool)
        else:
            to_run = set(config.tools)
            # profiles have no say in the list of tools run when
            # a command line is specified

        for tool in config.with_tools:
            to_run.add(tool)

        for tool in config.without_tools:
            if tool in to_run:
                to_run.remove(tool)

        if config.tools is None and len(config.with_tools) == 0 and len(config.without_tools) == 0:
            for tool in tools.TOOLS.keys():
github PyCQA / prospector / prospector / profiles / profile.py View on Github external
def _merge_profile_dict(priority, base):
    # copy the base dict into our output
    out = dict(base.items())

    for key, value in priority.items():
        if key in ('strictness', 'doc-warnings', 'test-warnings', 'member-warnings',
                   'output-format', 'autodetect', 'max-line-length',):
            # some keys are simple values which are overwritten
            out[key] = value
        elif key in ('ignore', 'ignore-patterns', 'ignore-paths', 'uses',
                     'requirements', 'python-targets'):
            # some keys should be appended
            out[key] = _ensure_list(value) + _ensure_list(base.get(key, []))
        elif key in TOOLS.keys():
            # this is tool config!
            out[key] = _merge_tool_config(value, base.get(key, {}))

    return out
github PyCQA / prospector / prospector / profiles / profile.py View on Github external
self.autodetect = profile_dict.get('autodetect')
        self.uses = [uses for uses in _ensure_list(profile_dict.get('uses', []))
                     if uses in ('django', 'celery', 'flask')]
        self.max_line_length = profile_dict.get('max-line-length')

        # informational shorthands
        self.strictness = profile_dict.get('strictness')
        self.test_warnings = profile_dict.get('test-warnings')
        self.doc_warnings = profile_dict.get('doc-warnings')
        self.member_warnings = profile_dict.get('member-warnings')

        # TODO: this is needed by Landscape but not by prospector; there is probably a better place for it
        self.requirements = _ensure_list(profile_dict.get('requirements', []))
        self.python_targets = _ensure_list(profile_dict.get('python-targets', []))

        for tool in TOOLS.keys():
            conf = {
                'disable': [],
                'enable': [],
                'run': None,
                'options': {}
            }
            conf.update(profile_dict.get(tool, {}))

            if self.max_line_length is not None and tool in ('pylint', 'pep8'):
                conf['options']['max-line-length'] = self.max_line_length

            setattr(self, tool, conf)
github PyCQA / prospector / prospector / config / configuration.py View on Github external
'with_tools': {
            'flags': ['-w', '--with-tool'],
            'help': 'A list of tools to run in addition to the default tools. '
                    'To specify all tools explicitly, use the --tool argument. '
                    'Possible values are %s.' % (
                        ', '.join(sorted(TOOLS.keys()))
                    ),

        },
        'without_tools': {
            'flags': ['-W', '--without-tool'],
            'help': 'A list of tools that should not be run. Useful to turn off '
                    'only a single tool from the defaults. '
                    'To specify all tools explicitly, use the --tool argument. '
                    'Possible values are %s.' % (
                        ', '.join(sorted(TOOLS.keys()))
                    ),

        },
        'profiles': {
            'flags': ['-P', '--profile'],
            'help': 'The list of profiles to load. A profile is a certain'
                    ' \'type\' of behaviour for prospector, and is represented'
                    ' by a YAML configuration file. Either a full path to the YAML'
                    ' file describing the profile must be provided, or it must be'
                    ' on the profile path (see --profile-path)',
        },
        'profile_path': {
            'flags': ['--profile-path'],
            'help': 'Additional paths to search for profile files. By default this'
                    ' is the path that prospector will check, and a directory '
                    ' called ".prospector" in the path that prospector will check.',