From 965952aa37d99a372315bc7b7319712e9f8152f8 Mon Sep 17 00:00:00 2001 From: Zeecka Date: Sat, 10 Jan 2026 05:12:03 +0100 Subject: [PATCH 1/4] Refactoring folders --- .dockerignore | 6 --- .pre-commit-config.yaml | 40 ------------------ CONTRIBUTING.md | 90 ++++++++++++++++++++++++++++++++++------- lint.sh | 21 ++++++++++ pyproject.toml | 47 +++++++++++++++++++++ 5 files changed, 144 insertions(+), 60 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .pre-commit-config.yaml create mode 100755 lint.sh create mode 100644 pyproject.toml diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index a809789..0000000 --- a/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -.git -__pycache__ -*.pyc -tests -docs -exemples diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index eda0da9..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,40 +0,0 @@ -repos: -- repo: https://github.com/psf/black - rev: 25.12.0 - hooks: - - id: black - args: ['--line-length', '100'] -- repo: https://github.com/pycqa/isort - rev: 7.0.0 - hooks: - - id: isort - args: ['--profile', 'black'] -- repo: https://github.com/PyCQA/flake8 - rev: 7.3.0 - hooks: - - id: flake8 - args: ['--extend-ignore','E203,E501,W503'] -- repo: https://github.com/pylint-dev/pylint - rev: v4.0.4 - hooks: - - id: pylint - args: ['--disable', 'W0511,W0718,R0801,R0903,R0914'] - language: system -- repo: local - hooks: - - id: mypy - name: mypy - entry: mypy - types: [python] - language: system - pass_filenames: true - args: - [ - "--disallow-any-generics", - "--disallow-untyped-def", - "--follow-imports", - "skip", - "--ignore-missing-imports", - "--disable-error-code", - "unused-awaitable", - ] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 029a156..e348e91 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,9 @@ This project enforces: - **Pylint** : ignoring W0511, W0718, R0801, R0903, R0914 - **Mypy** : ignoring unused-awaitable -See [.pre-commit-config.yaml](.pre-commit-config.yaml) for the exact configuration. +> [!TIP] +> All tool configurations (Black, Isort, Flake8, Mypy, Pylint) are centralized in pyproject.toml. +> You can run each tool directly and it will automatically pick up the configuration. ### Setup @@ -79,35 +81,95 @@ See [.pre-commit-config.yaml](.pre-commit-config.yaml) for the exact configurati ```bash # Create & activate a virtual environment python3 -m venv .venv -source .venv/bin/activate # Linux/macOS -# .venv\Scripts\activate # Windows +source .venv/bin/activate -# Install dev dependencies -pip install -r aperisolve/requirements-dev.txt +# Install dependencies pip install -r aperisolve/requirements.txt +pip install -r aperisolve/requirements-dev.txt ``` ### Running Tools Manually -Install pre-commit hooks to automatically check your code before commits: +**Option 1 - Bash script (no pre-commit file needed)** + +Run this script [lint.sh](lint.sh) at the project root folder. + +``` +🖤 Running Black... +All done! ✨ 🍰 ✨ +25 files left unchanged. +📦 Running Isort... +Skipped 2 files +🐍 Running Flake8... +🔍 Running Mypy... +Success: no issues found in 25 source files +⚡ Running Pylint... + +------------------------------------ +Your code has been rated at 10.00/10 + +✅ All checks passed! +``` + +**Option 2 - Pre-Commit hook** + +Create a pre-commit hooks file [.pre-commit-config.yaml](#) at the project root folder. + +```bash +repos: +- repo: https://github.com/psf/black + rev: 25.12.0 + hooks: + - id: black + args: ['--line-length', '100'] +- repo: https://github.com/pycqa/isort + rev: 7.0.0 + hooks: + - id: isort + args: ['--profile', 'black'] +- repo: https://github.com/PyCQA/flake8 + rev: 7.3.0 + hooks: + - id: flake8 + args: ['--extend-ignore','E203,E501,W503'] +- repo: https://github.com/pylint-dev/pylint + rev: v4.0.4 + hooks: + - id: pylint + args: ['--disable', 'W0511,W0718,R0801,R0903,R0914'] + language: system +- repo: local + hooks: + - id: mypy + name: mypy + entry: mypy + types: [python] + language: system + pass_filenames: true + args: + [ + "--disallow-any-generics", + "--disallow-untyped-def", + "--follow-imports", + "skip", + "--ignore-missing-imports", + "--disable-error-code", + "unused-awaitable", + ] +``` + +Then run the following command so each staged files will be checked while commited. ```bash pre-commit install ``` -Check for issues: +You can also do a manual pass on all files before commiting: ```bash pre-commit run --all-files ``` -Format code: - -```bash -black . --line-length 100 -isort . --profile black -``` - > [!NOTE] > Continuous Integration (CI) runs all checks on every PR. Ensure your code passes before submitting. diff --git a/lint.sh b/lint.sh new file mode 100755 index 0000000..bda4320 --- /dev/null +++ b/lint.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# lint.sh - Run all formatters, linters, and type checks according to pyproject.toml + +set -euo pipefail + +echo "🖤 Running Black..." +black . + +echo "📦 Running Isort..." +isort . + +echo "🐍 Running Flake8..." +flake8 --max-line-length 100 --extend-ignore=E203,E501,W503 . + +echo "🔍 Running Mypy..." +mypy . + +echo "⚡ Running Pylint..." +pylint aperisolve/ + +echo "✅ All checks passed!" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4714ae4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +# Minimal Python project configuration for linters and type checkers. +# This file centralizes config for black, isort, flake8, mypy, pylint. + +[project] +name = "aperisolve" +version = "3.1.1" +description = "Open-source steganalysis web platform for automated image analysis and steganography detection" +readme = "README.md" +requires-python = ">=3.12" +license = {text = "MIT"} +authors = [ + {name = "Zeecka"} +] + +[tool.black] +line-length = 100 +target-version = ["py312"] + +[tool.isort] +profile = "black" + +[tool.flake8] +extend-ignore = ["E203", "E501", "W503"] +max-line-length = 100 + +[tool.mypy] +disallow_any_generics = true +disallow_untyped_defs = true +follow_imports = "skip" +ignore_missing_imports = true +disable_error_code = ["unused-awaitable"] + +[tool.pylint] +disable = ["W0511", "W0718", "R0801", "R0903", "R0914"] + +[tool.pre-commit] +skip = true + +[tool.doc] +description = """ +Linting and type checking configuration for this project. +- Black: code formatting +- Isort: import sorting +- Flake8: code style +- Mypy: static typing +- Pylint: code quality +""" From f1c8d186dfc39ac936bdd0627f9b9a047a929a10 Mon Sep 17 00:00:00 2001 From: Zeecka Date: Sat, 10 Jan 2026 05:16:40 +0100 Subject: [PATCH 2/4] Add "few" badges --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 692ae85..4c322bc 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,18 @@ # Aperi'Solve -![CI](https://github.com/Zeecka/AperiSolve/actions/workflows/release.yml/badge.svg) +[![Website](https://img.shields.io/website?url=https%3A%2F%2Faperisolve.com)](https://aperisolve.com/) +![License](https://img.shields.io/github/license/Zeecka/AperiSolve) +![Docker](https://img.shields.io/badge/docker-compose-blue?logo=docker) +![Python Version](https://img.shields.io/badge/python-3.12%2B-blue) ![Lint](https://github.com/Zeecka/AperiSolve/actions/workflows/lint.yml/badge.svg) ![Black Code Style](https://img.shields.io/badge/code%20style-black-000000.svg) -[![Website](https://img.shields.io/website?url=https%3A%2F%2Faperisolve.com)](https://aperisolve.com/) +![CI](https://github.com/Zeecka/AperiSolve/actions/workflows/release.yml/badge.svg) +![GitHub Stars](https://img.shields.io/github/stars/Zeecka/AperiSolve?style=social) +![GitHub Forks](https://img.shields.io/github/forks/Zeecka/AperiSolve?style=social) +![GitHub Issues](https://img.shields.io/github/issues/Zeecka/AperiSolve) +![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Zeecka/AperiSolve) +![Last Commit](https://img.shields.io/github/last-commit/Zeecka/AperiSolve) +![Contributors](https://img.shields.io/github/contributors/Zeecka/AperiSolve) [![Rawsec's CyberSecurity Inventory](https://inventory.raw.pm/img/badges/Rawsec-inventoried-FF5050_flat.svg)](https://inventory.raw.pm/tools.html#Aperi'Solve)

From 4ba15b5d7f1bc7ee965ad71dfffd17b66adce414 Mon Sep 17 00:00:00 2001 From: Zeecka Date: Sat, 10 Jan 2026 05:20:33 +0100 Subject: [PATCH 3/4] remove useless badges --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4c322bc..1374fb0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Aperi'Solve [![Website](https://img.shields.io/website?url=https%3A%2F%2Faperisolve.com)](https://aperisolve.com/) -![License](https://img.shields.io/github/license/Zeecka/AperiSolve) +![CI](https://github.com/Zeecka/AperiSolve/actions/workflows/release.yml/badge.svg) +![Lint](https://github.com/Zeecka/AperiSolve/actions/workflows/lint.yml/badge.svg) ![Docker](https://img.shields.io/badge/docker-compose-blue?logo=docker) ![Python Version](https://img.shields.io/badge/python-3.12%2B-blue) -![Lint](https://github.com/Zeecka/AperiSolve/actions/workflows/lint.yml/badge.svg) ![Black Code Style](https://img.shields.io/badge/code%20style-black-000000.svg) -![CI](https://github.com/Zeecka/AperiSolve/actions/workflows/release.yml/badge.svg) -![GitHub Stars](https://img.shields.io/github/stars/Zeecka/AperiSolve?style=social) -![GitHub Forks](https://img.shields.io/github/forks/Zeecka/AperiSolve?style=social) + +![License](https://img.shields.io/github/license/Zeecka/AperiSolve) ![GitHub Issues](https://img.shields.io/github/issues/Zeecka/AperiSolve) ![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Zeecka/AperiSolve) ![Last Commit](https://img.shields.io/github/last-commit/Zeecka/AperiSolve) From ab1a8147760a81d6e95e024594a783bd343ab3bd Mon Sep 17 00:00:00 2001 From: Zeecka Date: Sat, 10 Jan 2026 05:22:05 +0100 Subject: [PATCH 4/4] remove linebreak --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 1374fb0..4dd9263 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ ![Docker](https://img.shields.io/badge/docker-compose-blue?logo=docker) ![Python Version](https://img.shields.io/badge/python-3.12%2B-blue) ![Black Code Style](https://img.shields.io/badge/code%20style-black-000000.svg) - ![License](https://img.shields.io/github/license/Zeecka/AperiSolve) ![GitHub Issues](https://img.shields.io/github/issues/Zeecka/AperiSolve) ![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Zeecka/AperiSolve)