Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import re
import os
import sys
from setoptconf.datatype import Choice
class OutputChoice(Choice):
def sanitize(self, value):
parsed = re.split(r'[;:]', value)
output_format, output_targets = parsed[0], parsed[1:]
checked_targets = []
for i, target in enumerate(output_targets):
if sys.platform.startswith('win') and target.startswith((os.path.sep, os.path.altsep)):
checked_targets[-1] += ':'+target
else:
checked_targets.append(target)
validated_format = super(OutputChoice, self).sanitize(output_format)
return (validated_format, checked_targets)
def build_manager():
manager = soc.ConfigurationManager('prospector')
manager.add(soc.BooleanSetting('zero_exit', default=False))
manager.add(soc.BooleanSetting('autodetect', default=True))
manager.add(soc.ListSetting('uses', soc.String, default=[]))
manager.add(soc.BooleanSetting('blending', default=True))
manager.add(soc.BooleanSetting('doc_warnings', default=None))
manager.add(soc.BooleanSetting('test_warnings', default=None))
manager.add(soc.BooleanSetting('no_style_warnings', default=None))
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',
'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))
manager.add(soc.StringSetting('path', default=None))
manager.add(soc.ListSetting('ignore_patterns', soc.String, default=[]))
manager.add(soc.ListSetting('ignore_paths', soc.String, default=[]))
manager.add(soc.BooleanSetting('die_on_tool_error', default=False))
manager.add(soc.BooleanSetting('include_tool_stdout', default=False))
manager.add(soc.BooleanSetting('direct_tool_stdout', default=False))
return manager
manager.add(soc.BooleanSetting('zero_exit', default=False))
manager.add(soc.BooleanSetting('autodetect', default=True))
manager.add(soc.ListSetting('uses', soc.String, default=[]))
manager.add(soc.BooleanSetting('blending', default=True))
manager.add(soc.BooleanSetting('doc_warnings', default=None))
manager.add(soc.BooleanSetting('test_warnings', default=None))
manager.add(soc.BooleanSetting('no_style_warnings', default=None))
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.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))
manager.add(soc.StringSetting('path', default=None))
manager.add(soc.ListSetting('ignore_patterns', soc.String, default=[]))
manager.add(soc.ListSetting('ignore_paths', soc.String, default=[]))
manager.add(soc.BooleanSetting('die_on_tool_error', default=False))
manager.add(soc.BooleanSetting('include_tool_stdout', default=False))
manager.add(soc.BooleanSetting('direct_tool_stdout', default=False))
return manager
['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))
manager.add(soc.StringSetting('path', default=None))
manager.add(soc.ListSetting('ignore_patterns', soc.String, default=[]))
manager.add(soc.ListSetting('ignore_paths', soc.String, default=[]))
manager.add(soc.BooleanSetting('die_on_tool_error', default=False))
manager.add(soc.BooleanSetting('include_tool_stdout', default=False))
manager.add(soc.BooleanSetting('direct_tool_stdout', default=False))
return manager
manager.add(soc.BooleanSetting('doc_warnings', default=None))
manager.add(soc.BooleanSetting('test_warnings', default=None))
manager.add(soc.BooleanSetting('no_style_warnings', default=None))
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))
def build_manager():
manager = soc.ConfigurationManager('prospector')
manager.add(soc.BooleanSetting('zero_exit', default=False))
manager.add(soc.BooleanSetting('autodetect', default=True))
manager.add(soc.ListSetting('uses', soc.String, default=[]))
manager.add(soc.BooleanSetting('blending', default=True))
manager.add(soc.BooleanSetting('doc_warnings', default=None))
manager.add(soc.BooleanSetting('test_warnings', default=None))
manager.add(soc.BooleanSetting('no_style_warnings', default=None))
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.BooleanSetting('zero_exit', default=False))
manager.add(soc.BooleanSetting('autodetect', default=True))
manager.add(soc.ListSetting('uses', soc.String, default=[]))
manager.add(soc.BooleanSetting('blending', default=True))
manager.add(soc.BooleanSetting('doc_warnings', default=None))
manager.add(soc.BooleanSetting('test_warnings', default=None))
manager.add(soc.BooleanSetting('no_style_warnings', default=None))
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.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))
manager.add(soc.StringSetting('path', default=None))
manager.add(soc.ListSetting('ignore_patterns', soc.String, default=[]))
manager.add(soc.ListSetting('ignore_paths', soc.String, default=[]))
manager.add(soc.BooleanSetting('die_on_tool_error', default=False))
manager.add(soc.BooleanSetting('include_tool_stdout', default=False))
manager.add(soc.BooleanSetting('direct_tool_stdout', default=False))
return manager