From 781afc9c65482dc0321e9db2e6fdabda42a2f6f8 Mon Sep 17 00:00:00 2001 From: Marshall Hallenbeck Date: Fri, 13 Oct 2023 15:27:34 -0400 Subject: [PATCH] ruff: add flake8-raise (RSE) and auto-run --- nxc/modules/add_computer.py | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nxc/modules/add_computer.py b/nxc/modules/add_computer.py index d12d0ba5..60e35e6a 100644 --- a/nxc/modules/add_computer.py +++ b/nxc/modules/add_computer.py @@ -136,7 +136,7 @@ class NXCModule: context.log.highlight("Available domain(s):") for domain in domains: context.log.highlight(f" * {domain['Name']}") - raise Exception() + raise Exception else: selected_domain = domain[0]["Name"] else: @@ -179,7 +179,7 @@ class NXCModule: samr.hSamrLookupNamesInDomain(dce, domain_handle, [self.__computerName]) self.noLDAPRequired = True context.log.highlight("{}".format('Computer account already exists with the name: "' + self.__computerName + '"')) - raise Exception() + raise Exception except samr.DCERPCSessionError as e: if e.error_code != 0xC0000073: raise diff --git a/pyproject.toml b/pyproject.toml index cabfb7a8..4cae3b26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,7 @@ build-backend = "poetry.core.masonry.api" # Ruff doesn't enable pycodestyle warnings (`W`) or # McCabe complexity (`C901`) by default. # Other options: pep8-naming (N), flake8-annotations (ANN), flake8-blind-except (BLE), flake8-commas (COM), flake8-pyi (PYI), flake8-pytest-style (PT), etc -select = ["E", "F", "D", "UP", "YTT", "ASYNC", "B", "A", "C4", "ISC", "ICN", "PIE", "PT", "Q"] +select = ["E", "F", "D", "UP", "YTT", "ASYNC", "B", "A", "C4", "ISC", "ICN", "PIE", "PT", "Q", "RSE"] ignore = [ "E501", "F405", "F841", "D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107", "D203", "D204", "D205", "D212", "D213", "D400", "D401", "D415", "D417", "D419"] # Allow autofix for all enabled rules (when `--fix`) is provided.