Merge pull request #156 from Zeecka/refactoring_folders

Refactoring folders
This commit is contained in:
Zeecka
2026-01-10 05:24:21 +01:00
committed by GitHub
6 changed files with 152 additions and 61 deletions
-6
View File
@@ -1,6 +0,0 @@
.git
__pycache__
*.pyc
tests
docs
exemples
-40
View File
@@ -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",
]
+76 -14
View File
@@ -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.
+8 -1
View File
@@ -1,9 +1,16 @@
# Aperi'Solve
[![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)
![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)
![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/)
![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)
![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)
<p align="center">
Executable
+21
View File
@@ -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!"
+47
View File
@@ -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
"""