Enable rules with given names, and disable everything else. :param names: name or list of rule names to enable. :param ignoreInvalid: ignore errors when rule not found :raises: KeyError if name not found and not ignoreInvalid :return: list of found rule names
(
self, names: str | Iterable[str], ignoreInvalid: bool = False
)
| 213 | return result |
| 214 | |
| 215 | def enableOnly( |
| 216 | self, names: str | Iterable[str], ignoreInvalid: bool = False |
| 217 | ) -> list[str]: |
| 218 | """Enable rules with given names, and disable everything else. |
| 219 | |
| 220 | :param names: name or list of rule names to enable. |
| 221 | :param ignoreInvalid: ignore errors when rule not found |
| 222 | :raises: KeyError if name not found and not ignoreInvalid |
| 223 | :return: list of found rule names |
| 224 | """ |
| 225 | if isinstance(names, str): |
| 226 | names = [names] |
| 227 | for rule in self.__rules__: |
| 228 | rule.enabled = False |
| 229 | return self.enable(names, ignoreInvalid) |
| 230 | |
| 231 | def disable( |
| 232 | self, names: str | Iterable[str], ignoreInvalid: bool = False |
no test coverage detected