mirror of
https://github.com/mandiant/capa.git
synced 2026-04-28 03:43:21 -07:00
ci: fix web rules failure (#3003)
* ci: fix web rules failure * address feedback * ruff cleanup
This commit is contained in:
7
.github/ruff.toml
vendored
7
.github/ruff.toml
vendored
@@ -1,6 +1,6 @@
|
||||
line-length = 120
|
||||
preview = true # Required to enable pre-release copyright header checks (CPY001)
|
||||
explicit-preview-rules = true
|
||||
lint.explicit-preview-rules = true
|
||||
|
||||
exclude = [
|
||||
# Exclude a variety of commonly ignored directories.
|
||||
@@ -28,7 +28,7 @@ exclude = [
|
||||
# protobuf generated files
|
||||
"*_pb2.py",
|
||||
"*_pb2.pyi",
|
||||
"rules"
|
||||
"../rules"
|
||||
]
|
||||
|
||||
lint.select = [
|
||||
@@ -40,12 +40,11 @@ lint.select = [
|
||||
"ISC", # flake8-implicit-str-concat (detect accidental multi-line string issues)
|
||||
"T20", # flake8-print (prevent leftover print/pprint statements)
|
||||
"SIM", # flake8-simplify (code simplification upgrades)
|
||||
"CPY", # flake8-copyright (header requirement enforcement)
|
||||
"CPY001", # flake8-copyright (header requirement enforcement)
|
||||
"G", # flake8-logging-format (logging statement validation)
|
||||
"TD", # flake8-todos (TODO formatting requirements)
|
||||
"PTH", # flake8-use-pathlib (migration from os.path to Pathlib)
|
||||
"UP", # pyupgrade (modern Python syntax upgrades)
|
||||
"CPY001", # flake8-copyright
|
||||
]
|
||||
|
||||
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
||||
|
||||
@@ -127,7 +127,11 @@ def render_rule(timestamps, path: Path) -> str:
|
||||
return html_content
|
||||
|
||||
|
||||
yaml_files = [str(p) for p in input_directory.glob("**/*.yml")]
|
||||
yaml_files = [
|
||||
str(p)
|
||||
for p in input_directory.glob("**/*.yml")
|
||||
if not any(part.startswith(".") for part in p.relative_to(input_directory).parts)
|
||||
]
|
||||
|
||||
timestamps = {}
|
||||
for line in txt_file_path.read_text(encoding="utf-8").splitlines():
|
||||
|
||||
@@ -29,9 +29,10 @@ assert start_dir.exists(), "start directory must exist"
|
||||
|
||||
def get_yml_files_and_dates(start_dir: Path):
|
||||
yml_files = []
|
||||
for root, _, files in os.walk(start_dir):
|
||||
for root, dirs, files in os.walk(start_dir):
|
||||
dirs[:] = [d for d in dirs if not d.startswith(".")]
|
||||
for file in files:
|
||||
if file.endswith(".yml") or file.endswith(".yaml"):
|
||||
if file.endswith(".yml"):
|
||||
file_path = Path(root) / file
|
||||
|
||||
proc = subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user