mirror of
https://github.com/adrienverge/yamllint.git
synced 2025-02-25 18:55:20 -06:00
style: silence bugbear warning
B904 Within an `except` clause, raise exceptions with
`raise ... from err` or `raise ... from None` to
distinguish them from errors in exception handling
This commit is contained in:
committed by
Adrien Vergé
parent
3e126942e9
commit
5969b4f29e
@@ -76,7 +76,7 @@ class YamlLintConfig:
|
|||||||
try:
|
try:
|
||||||
conf = yaml.safe_load(raw_content)
|
conf = yaml.safe_load(raw_content)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YamlLintConfigError(f'invalid config: {e}')
|
raise YamlLintConfigError(f'invalid config: {e}') from e
|
||||||
|
|
||||||
if not isinstance(conf, dict):
|
if not isinstance(conf, dict):
|
||||||
raise YamlLintConfigError('invalid config: not a dict')
|
raise YamlLintConfigError('invalid config: not a dict')
|
||||||
@@ -95,7 +95,7 @@ class YamlLintConfig:
|
|||||||
try:
|
try:
|
||||||
self.extend(base)
|
self.extend(base)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YamlLintConfigError(f'invalid config: {e}')
|
raise YamlLintConfigError(f'invalid config: {e}') from e
|
||||||
|
|
||||||
if 'ignore' in conf and 'ignore-from-file' in conf:
|
if 'ignore' in conf and 'ignore-from-file' in conf:
|
||||||
raise YamlLintConfigError(
|
raise YamlLintConfigError(
|
||||||
@@ -143,7 +143,7 @@ class YamlLintConfig:
|
|||||||
try:
|
try:
|
||||||
rule = yamllint.rules.get(id)
|
rule = yamllint.rules.get(id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YamlLintConfigError(f'invalid config: {e}')
|
raise YamlLintConfigError(f'invalid config: {e}') from e
|
||||||
|
|
||||||
self.rules[id] = validate_rule_conf(rule, self.rules[id])
|
self.rules[id] = validate_rule_conf(rule, self.rules[id])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user