Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif settings.get('select'):
args.append('--select=' + ','.join(settings['select']))
elif settings.get('ignore'):
args.append('--ignore=' + ','.join(settings['ignore']))
log.info("Using pydocstyle args: %s", args)
conf = pydocstyle.config.ConfigurationParser()
with _patch_sys_argv(args):
# TODO(gatesn): We can add more pydocstyle args here from our pyls config
conf.parse()
# Will only yield a single filename, the document path
diags = []
for filename, checked_codes, ignore_decorators in conf.get_files_to_check():
errors = pydocstyle.checker.ConventionChecker().check_source(
document.source, filename, ignore_decorators=ignore_decorators
)
try:
for error in errors:
if error.code not in checked_codes:
continue
diags.append(_parse_diagnostic(document, error))
except pydocstyle.parser.ParseError:
# In the case we cannot parse the Python file, just continue
pass
log.debug("Got pydocstyle errors: %s", diags)
return diags
elif settings.get("select"):
args.append("--select=" + ",".join(settings["select"]))
elif settings.get("ignore"):
args.append("--ignore=" + ",".join(settings["ignore"]))
log.info("Using pydocstyle args: %s", args)
conf = pydocstyle.config.ConfigurationParser()
with _patch_sys_argv(args):
# TODO(gatesn): We can add more pydocstyle args here from our pyls config
conf.parse()
# Will only yield a single filename, the document path
diags = []
for filename, checked_codes, ignore_decorators in conf.get_files_to_check():
errors = pydocstyle.checker.ConventionChecker().check_source(
document.source, filename, ignore_decorators=ignore_decorators
)
try:
for error in errors:
if error.code not in checked_codes:
continue
diags.append(_parse_diagnostic(document, error))
except pydocstyle.parser.ParseError:
# In the case we cannot parse the Python file, just continue
pass
log.debug("Got pydocstyle errors: %s", diags)
return diags