diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..8011d30291 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: +- repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - id: check-merge-conflict + - id: check-added-large-files + exclude: '(README.md)' + args: + - --maxkb=120 + - --enforce-all \ No newline at end of file diff --git a/lib/__init__.py b/src/lib/__init__.py similarity index 100% rename from lib/__init__.py rename to src/lib/__init__.py diff --git a/lib/colors.py b/src/lib/colors.py similarity index 98% rename from lib/colors.py rename to src/lib/colors.py index 904765aaff..b1b75d24ae 100644 --- a/lib/colors.py +++ b/src/lib/colors.py @@ -1,10 +1,8 @@ def red(skk): return "\033[91m{}\033[00m" .format(skk) - def green(skk): return "\033[92m{}\033[00m" .format(skk) - def yellow(skk): return "\033[93m{}\033[00m" .format(skk) diff --git a/lib/DownloadWorker.py b/src/lib/download_worker.py similarity index 100% rename from lib/DownloadWorker.py rename to src/lib/download_worker.py diff --git a/lib/logger.py b/src/lib/logger.py similarity index 100% rename from lib/logger.py rename to src/lib/logger.py index afe271f8f1..5fbeeeee43 100644 --- a/lib/logger.py +++ b/src/lib/logger.py @@ -1,5 +1,5 @@ - import logging + logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) diff --git a/src/lib/parsers/__init__.py b/src/lib/parsers/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/parsers/edge-cases.yaml b/src/lib/parsers/edge-cases.yaml similarity index 100% rename from lib/parsers/edge-cases.yaml rename to src/lib/parsers/edge-cases.yaml diff --git a/lib/parsers/ParserInterface.py b/src/lib/parsers/parser_interface.py similarity index 100% rename from lib/parsers/ParserInterface.py rename to src/lib/parsers/parser_interface.py diff --git a/lib/parsers/WordfenceAPIParser.py b/src/lib/parsers/wordfence_api_parser.py similarity index 99% rename from lib/parsers/WordfenceAPIParser.py rename to src/lib/parsers/wordfence_api_parser.py index a33a5e771b..7bbec03c5e 100644 --- a/lib/parsers/WordfenceAPIParser.py +++ b/src/lib/parsers/wordfence_api_parser.py @@ -7,7 +7,7 @@ import re from yaml import safe_load -from lib.parsers.ParserInterface import ParserInterface +from lib.parsers.parser_interface import ParserInterface class WordfenceAPIParser(ParserInterface): @@ -281,7 +281,7 @@ def determine_severity(self, title, initial_rating, description) -> str: score = SEVERITY_MEDIUM if "Authenticated" in title or "authenticated" in title: - if not "Unauthenticated" in title and not "unauthenticated" in title: + if "Unauthenticated" not in title and "unauthenticated" not in title: # Down-scale the score to Low if it's an "Authenticated" vulnerability score = SEVERITY_LOW diff --git a/lib/parsers/WordfenceParser.py b/src/lib/parsers/wordfence_parser.py similarity index 100% rename from lib/parsers/WordfenceParser.py rename to src/lib/parsers/wordfence_parser.py diff --git a/lib/template-main-without-references.yaml.template b/src/lib/template-main-without-references.yaml.template similarity index 100% rename from lib/template-main-without-references.yaml.template rename to src/lib/template-main-without-references.yaml.template diff --git a/lib/template-main.yaml.template b/src/lib/template-main.yaml.template similarity index 100% rename from lib/template-main.yaml.template rename to src/lib/template-main.yaml.template diff --git a/lib/template-wp-core-without-references.yaml.template b/src/lib/template-wp-core-without-references.yaml.template similarity index 100% rename from lib/template-wp-core-without-references.yaml.template rename to src/lib/template-wp-core-without-references.yaml.template diff --git a/lib/template-wp-core.yaml.template b/src/lib/template-wp-core.yaml.template similarity index 100% rename from lib/template-wp-core.yaml.template rename to src/lib/template-wp-core.yaml.template diff --git a/main.py b/src/main.py similarity index 100% rename from main.py rename to src/main.py diff --git a/scripts/__init__.py b/src/scripts/__init__.py similarity index 100% rename from scripts/__init__.py rename to src/scripts/__init__.py diff --git a/scripts/parse.readme.py b/src/scripts/parse.readme.py similarity index 99% rename from scripts/parse.readme.py rename to src/scripts/parse.readme.py index 186dad220e..302bedf68d 100644 --- a/scripts/parse.readme.py +++ b/src/scripts/parse.readme.py @@ -1,7 +1,6 @@ -import glob import re +import glob -import os plugins = 0 themes = 0 diff --git a/tests/TestWordfenceAPIParser.py b/tests/test_wordfence_api_parser.py similarity index 100% rename from tests/TestWordfenceAPIParser.py rename to tests/test_wordfence_api_parser.py