project: Fix assert-false (B011)
Derived from flake8-bugbear, see https://docs.astral.sh/ruff/rules/assert-false/ Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
8127067c63
commit
e05251a797
|
@ -920,7 +920,7 @@ class Alias(WestCommand):
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def do_run(self, args, ignored):
|
def do_run(self, args, ignored):
|
||||||
assert False
|
raise AssertionError("Alias command can't run directly")
|
||||||
|
|
||||||
class WestHelpAction(argparse.Action):
|
class WestHelpAction(argparse.Action):
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ class Configuration:
|
||||||
self._system.set(option, value)
|
self._system.set(option, value)
|
||||||
else:
|
else:
|
||||||
# Shouldn't happen.
|
# Shouldn't happen.
|
||||||
assert False, configfile
|
raise AssertionError(configfile)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _create(path: Path) -> _InternalCF:
|
def _create(path: Path) -> _InternalCF:
|
||||||
|
|
|
@ -464,11 +464,12 @@ def _update_disabled_groups(disabled_groups: set[str],
|
||||||
else:
|
else:
|
||||||
# We should never get here. This private helper is only
|
# We should never get here. This private helper is only
|
||||||
# meant to be invoked on valid data.
|
# meant to be invoked on valid data.
|
||||||
assert False, \
|
raise AssertionError(
|
||||||
(f"Unexpected group filter item {item}. "
|
f"Unexpected group filter item {item}. "
|
||||||
"This is a west bug. Please report it to the developers "
|
"This is a west bug. Please report it to the developers "
|
||||||
"along with as much information as you can, such as the "
|
"along with as much information as you can, such as the "
|
||||||
"stack trace that preceded this message.")
|
"stack trace that preceded this message."
|
||||||
|
)
|
||||||
|
|
||||||
def _is_submodule_dict_ok(subm: Any) -> bool:
|
def _is_submodule_dict_ok(subm: Any) -> bool:
|
||||||
# Check whether subm is a dict that contains the expected
|
# Check whether subm is a dict that contains the expected
|
||||||
|
|
|
@ -546,7 +546,7 @@ def test_update_tag_to_tag(west_init_tmpdir):
|
||||||
p.revision = 'v2.0'
|
p.revision = 'v2.0'
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
assert False, 'no tagged_repo'
|
raise AssertionError('no tagged_repo')
|
||||||
with open(west_init_tmpdir / 'zephyr' / 'west.yml', 'w') as f:
|
with open(west_init_tmpdir / 'zephyr' / 'west.yml', 'w') as f:
|
||||||
f.write(manifest.as_yaml()) # NOT as_frozen_yaml().
|
f.write(manifest.as_yaml()) # NOT as_frozen_yaml().
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue