Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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())
29 changes: 29 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def _migrate_legacy_config_if_needed():
if CONFIG_FILE.exists() or not LEGACY_CONFIG_FILE.exists():
return

codex/review-repository-code-argiid
try:
legacy_data = json.loads(LEGACY_CONFIG_FILE.read_text(encoding="utf-8"))
APP_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
Expand All @@ -44,6 +45,19 @@ def _migrate_legacy_config_if_needed():
def _read_json_file(path: Path):
"""Le JSON de um ficheiro devolvendo dict vazio em caso de erro."""
try:

try:
legacy_data = json.loads(LEGACY_CONFIG_FILE.read_text(encoding="utf-8"))
APP_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
CONFIG_FILE.write_text(json.dumps(legacy_data, indent=2, ensure_ascii=False), encoding="utf-8")
except Exception:
pass


def _read_json_file(path: Path):
"""Le JSON de um ficheiro devolvendo dict vazio em caso de erro."""
try:
main
if path.exists():
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
Expand Down Expand Up @@ -122,13 +136,17 @@ def __init__(self):
self.config = load_config()
self.scan_paths = []
self._selection_loaded = False
codex/review-repository-code-argiid
self.filters_panel_visible = True

codex/review-repository-code-l1cd2s
self.filters_panel_visible = True

codex/review-repository-code-kf47vu
self.filters_panel_visible = True

main
> main

self.setWindowTitle("Duplicate File Cleaner")
self.setMinimumSize(900, 620)
Expand Down Expand Up @@ -389,6 +407,16 @@ def _build_scan_tab(self):
self.scan_mode.currentIndexChanged.connect(self._on_mode_change)
mode_layout.addWidget(self.scan_mode)
mode_layout.addStretch()
codex/review-repository-code-argiid

self.toggle_filters_btn = QPushButton("Esconder Selecao")
self.toggle_filters_btn.clicked.connect(self._toggle_filters_panel)
mode_layout.addWidget(self.toggle_filters_btn)
filter_layout.addLayout(mode_layout)

self.filters_panel_widget = self._build_filters_panel()
filter_layout.addWidget(self.filters_panel_widget, 1)

codex/review-repository-code-l1cd2s

self.toggle_filters_btn = QPushButton("Esconder Selecao")
Expand Down Expand Up @@ -450,6 +478,7 @@ def _build_scan_tab(self):
filter_layout.addLayout(custom_layout)
main

main
main
scan_splitter.addWidget(filter_group)

Expand Down
Loading