Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6b492db
chore: limpar artefactos locais e ficheiros acidentais
VHugoDevIA Mar 14, 2026
8c31b1e
Merge pull request #1 from VHugoDevIA/codex/review-repository-code
VHugoDevIA Mar 14, 2026
8ed71c5
Merge pull request #3 from VHugoDevIA/codex/review-repository-code
VHugoDevIA Mar 14, 2026
a8a6524
feat: melhorar layout ajustável e ordenação real por tamanho
VHugoDevIA Mar 14, 2026
629bffa
Merge pull request #4 from VHugoDevIA/codex/review-repository-code-9r…
VHugoDevIA Mar 14, 2026
b6891b6
feat: adicionar mostrar/esconder filtros e expandir/encolher grupos
VHugoDevIA Mar 14, 2026
d5fbdcc
Merge branch 'main' into codex/review-repository-code-kf47vu
VHugoDevIA Mar 14, 2026
569da12
Merge pull request #5 from VHugoDevIA/codex/review-repository-code-kf…
VHugoDevIA Mar 14, 2026
c739836
fix: guardar config do utilizador fora do repositório
VHugoDevIA Mar 14, 2026
ece172b
fix: tornar migração de config não-destrutiva e resiliente
VHugoDevIA Mar 14, 2026
09127e2
refactor: isolar painel de filtros para facilitar resolução de conflitos
VHugoDevIA Mar 14, 2026
855768c
Merge branch 'main' into codex/review-repository-code-l1cd2s
VHugoDevIA Mar 14, 2026
b074415
Merge pull request #6 from VHugoDevIA/codex/review-repository-code-l1…
VHugoDevIA Mar 14, 2026
7302adf
chore: bloquear artefactos de merge em PRs
VHugoDevIA Mar 14, 2026
5ef6752
Merge branch 'main' into codex/review-repository-code-argiid
VHugoDevIA Mar 14, 2026
3c47d43
Merge pull request #7 from VHugoDevIA/codex/review-repository-code-ar…
VHugoDevIA Mar 14, 2026
66dd58b
chore: adicionar script para limpar artefactos de conflito
VHugoDevIA Mar 14, 2026
ba43317
Merge branch 'main' into codex/review-repository-code-hpjdax
VHugoDevIA Mar 14, 2026
96a8909
Remove redundant 'main' keywords from app.py
VHugoDevIA Mar 14, 2026
482064e
Merge pull request #10 from VHugoDevIA/VHugoDevIA-patch-1
VHugoDevIA Mar 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Validate

on:
pull_request:
push:
branches: [main]

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Run repository validation
run: python scripts/validate_repo.py
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ cd duplicate-file-cleaner
pip install -r requirements.txt
python main.py
```

## Resolução rápida de conflitos no `src/app.py`

Se após um `git pull` aparecer `IndentationError` com texto como `codex/review-repository-code-...`, usa:

```bash
python scripts/fix_conflict_artifacts.py src/app.py --write
python -m compileall main.py src
```

O script remove marcadores de conflito e artefactos de branch comuns e cria backup automático (`src/app.py.bak`).
68 changes: 68 additions & 0 deletions scripts/fix_conflict_artifacts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from __future__ import annotations

from pathlib import Path
import argparse
import shutil
import sys

CONFLICT_PREFIXES = ("<<<<<<<", "=======", ">>>>>>>")


def should_remove_line(raw_line: str) -> bool:
stripped = raw_line.strip()
if not stripped:
return False
if stripped.startswith(CONFLICT_PREFIXES):
return True
if stripped.startswith("codex/review-repository-code-"):
return True
if stripped == "main":
return True
return False


def sanitize_file(path: Path, write: bool) -> tuple[int, int]:
lines = path.read_text(encoding="utf-8", errors="ignore").splitlines()
cleaned: list[str] = []
removed = 0

for line in lines:
if should_remove_line(line):
removed += 1
continue
cleaned.append(line)

if write and removed:
backup = path.with_suffix(path.suffix + ".bak")
shutil.copy2(path, backup)
path.write_text("\n".join(cleaned) + "\n", encoding="utf-8")

return removed, len(lines)


def main() -> int:
parser = argparse.ArgumentParser(description="Remove artefactos de merge em ficheiros Python.")
parser.add_argument("path", nargs="?", default="src/app.py", help="Ficheiro alvo (default: src/app.py)")
parser.add_argument("--write", action="store_true", help="Aplicar alterações ao ficheiro")
args = parser.parse_args()

target = Path(args.path)
if not target.exists():
print(f"Ficheiro não encontrado: {target}")
return 1

removed, total = sanitize_file(target, write=args.write)
if args.write:
if removed:
print(f"Removidas {removed} linha(s) suspeita(s) de {total}. Backup criado em {target.with_suffix(target.suffix + '.bak')}")
else:
print("Nenhuma linha suspeita encontrada. Nada para alterar.")
else:
print(f"Pré-visualização: {removed} linha(s) suspeita(s) em {total}.")
print("Use --write para aplicar.")

return 0


if __name__ == "__main__":
sys.exit(main())
42 changes: 42 additions & 0 deletions scripts/validate_repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from __future__ import annotations

from pathlib import Path
import compileall
import sys

ROOT = Path(__file__).resolve().parents[1]
CONFLICT_TOKENS = ("<<<<<<<", "=======", ">>>>>>>")


def check_conflict_markers() -> list[str]:
problems: list[str] = []
targets = [ROOT / "main.py", *(ROOT / "src").rglob("*.py")]
for path in targets:
text = path.read_text(encoding="utf-8", errors="ignore")
for idx, line in enumerate(text.splitlines(), start=1):
if any(token in line for token in CONFLICT_TOKENS):
problems.append(f"{path.relative_to(ROOT)}:{idx}: marcador de conflito encontrado")
if line.strip().startswith("codex/review-repository-code-"):
problems.append(f"{path.relative_to(ROOT)}:{idx}: artefacto de branch encontrado")
return problems


def main() -> int:
marker_errors = check_conflict_markers()
if marker_errors:
for error in marker_errors:
print(error)
return 1

ok = compileall.compile_dir(str(ROOT / "src"), quiet=1)
ok_main = compileall.compile_file(str(ROOT / "main.py"), quiet=1)
if not ok or not ok_main:
print("Falha de compilação Python.")
return 1

print("Validação concluída com sucesso.")
return 0


if __name__ == "__main__":
sys.exit(main())
Loading
Loading