From 16a527180b3652b51096c2c285a958bd7555a87e Mon Sep 17 00:00:00 2001 From: pegasust Date: Fri, 4 Oct 2024 01:44:43 -0700 Subject: [PATCH] fix: bonehead on lowercase and list to use --- scripts/doxless.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/doxless.py b/scripts/doxless.py index 0554494..5c3a23f 100644 --- a/scripts/doxless.py +++ b/scripts/doxless.py @@ -3,6 +3,7 @@ import pathlib import os import time +import sys def in_content(needle: str, pathlike: str): content = "" @@ -17,13 +18,14 @@ def in_content(needle: str, pathlike: str): def gitignore_patterns(gitignore_f: str | None = None): with open(gitignore_f, 'r') as f: - return [line for line in (line.strip() for line in f) if not line.startswith('#') and line] + return {line for line in (line.strip() for line in f) if not line.startswith('#') and line} def main(): begin_stopwatch_s = time.perf_counter() # if OSError, too bad, user probably knows why, so just throw xD username = os.getlogin() ignore_patterns = gitignore_patterns(os.getenv("IGNORE_FILE", ".gitignore")) + ignore_patterns.add(".git") print(f"{ignore_patterns=}") # NB: impure pattern due to walk being costly @@ -51,15 +53,16 @@ def main(): username_in_content.extend( absfname for absfname, _ in files - if in_content(username, absfname) + if in_content(user_lower, absfname) ) + print(f"Checked batch {[rel for _, rel in files + absdirs]} in {root}", file=sys.stderr) nl = "\n" if username_in_file != []: print(f"Doxxed by username in file path:\n{nl.join(f'- {e}' for e in username_in_file)}") if username_in_content != []: - print(f"Doxxed by username in file content:\n{nl.join(f'- {e}' for e in username_in_file)}") + print(f"Doxxed by username in file content:\n{nl.join(f'- {e}' for e in username_in_content)}") stop_stopwatch_s = time.perf_counter() print(f"done analyzing in {(stop_stopwatch_s - begin_stopwatch_s):.04}s")