Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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
def make_issue(self, error, filename):
if isinstance(error, Error):
return PyDocStyleIssue(
error.code,
error.short_desc,
filename,
error.line,
)
if isinstance(error, EnvironmentError):
return AccessIssue(error, filename)
if isinstance(error, (AllError, ParseError, SyntaxError)):
return ParseIssue(error, filename)
return UnknownIssue(error, filename)
# 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