Skip to content

Commit c774464

Browse files
committed
updated
1 parent b373915 commit c774464

3 files changed

Lines changed: 73 additions & 10 deletions

File tree

.github/codeql/codeql-config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: tailwind-css-forge-codeql
2+
3+
paths:
4+
- backend
5+
- desktop
6+
- frontend
7+
- scripts
8+
9+
paths-ignore:
10+
- backend/.venv/**
11+
- build/**
12+
- desktop/src-tauri/target/**
13+
- desktop/src-tauri/vendor/**
14+
- frontend/node_modules/**
15+
- runtime/**

.github/workflows/codeql.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: codeql
2+
3+
on:
4+
push:
5+
branches: ["main", "master"]
6+
pull_request:
7+
branches: ["main", "master"]
8+
schedule:
9+
- cron: "24 4 * * 1"
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
analyze:
18+
name: Analyze (${{ matrix.language }})
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- language: python
25+
build-mode: none
26+
- language: javascript-typescript
27+
build-mode: none
28+
- language: rust
29+
build-mode: autobuild
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: ${{ matrix.language }}
39+
build-mode: ${{ matrix.build-mode }}
40+
config-file: ./.github/codeql/codeql-config.yml
41+
42+
- name: Autobuild
43+
if: matrix.build-mode == 'autobuild'
44+
uses: github/codeql-action/autobuild@v3
45+
46+
- name: Analyze
47+
uses: github/codeql-action/analyze@v3

scripts/validate_installer_bundle.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ def main() -> int:
1515
args = parse_args()
1616
bundle_dir = args.bundle.resolve()
1717
validate_bundle(bundle_dir)
18-
print(f"Bundle válido: {bundle_dir}")
18+
print(f"Bundle valid: {bundle_dir}")
1919
return 0
2020

2121

2222
def parse_args() -> Namespace:
23-
parser = ArgumentParser(description="Valida o bundle installer-ready do Tailwind CSS Forge.")
23+
parser = ArgumentParser(description="Validates the installer-ready bundle of Tailwind CSS Forge.")
2424
parser.add_argument(
2525
"--bundle",
2626
type=Path,
2727
default=DEFAULT_BUNDLE,
28-
help="Diretório do bundle staged para validar.",
28+
help="Directory of the staged bundle to validate.",
2929
)
3030
return parser.parse_args()
3131

@@ -54,14 +54,14 @@ def validate_bundle(bundle_dir: Path) -> None:
5454
missing = [str(path) for path in required_files if not path.exists()]
5555
if missing:
5656
missing_list = "\n".join(f"- {path}" for path in missing)
57-
raise SystemExit(f"Bundle incompleto. Arquivos ausentes:\n{missing_list}")
57+
raise SystemExit(f"Incomplete bundle. Missing files:\n{missing_list}")
5858

5959
manifest = json.loads((bundle_dir / "installer-manifest.json").read_text(encoding="utf-8"))
6060
metadata = json.loads((bundle_dir / "forge-product.json").read_text(encoding="utf-8"))
6161
if manifest.get("app_name") != "Tailwind CSS Forge":
62-
raise SystemExit("Manifesto inválido: app_name incorreto.")
62+
raise SystemExit("Invalid manifest: incorrect app_name.")
6363
if manifest.get("version") != metadata.get("version"):
64-
raise SystemExit("Manifesto inválido: versão divergente do metadata do produto.")
64+
raise SystemExit("Invalid manifest: version mismatch with product metadata.")
6565

6666
forbidden_paths = [
6767
bundle_dir / "app" / "backend" / "tests",
@@ -73,7 +73,8 @@ def validate_bundle(bundle_dir: Path) -> None:
7373
]
7474
forbidden_found = [str(path) for path in forbidden_paths if path.exists()]
7575
if forbidden_found:
76-
raise SystemExit(f"Bundle contém conteúdo indevido: {forbidden_found}")
76+
forbidden_list = "\n".join(f"- {path}" for path in forbidden_found)
77+
raise SystemExit(f"Bundle contains unexpected content:\n{forbidden_list}")
7778

7879
_validate_launcher_self_check(bundle_dir)
7980

@@ -95,15 +96,15 @@ def _validate_launcher_self_check(bundle_dir: Path) -> None:
9596
)
9697
if completed.returncode != 0:
9798
raise SystemExit(
98-
"Launcher self-check falhou: "
99+
"Launcher self-check failed: "
99100
f"{completed.stderr.strip() or completed.stdout.strip()}",
100101
)
101102

102103
report = json.loads(completed.stdout)
103104
if not report.get("installed_layout"):
104-
raise SystemExit("Launcher self-check inválido: o bundle staged não foi reconhecido como layout instalado.")
105+
raise SystemExit("Invalid launcher self-check: staged bundle was not recognized as an installed layout.")
105106
if not report.get("ready"):
106-
raise SystemExit("Launcher self-check inválido: o bundle staged não foi marcado como pronto.")
107+
raise SystemExit("Invalid launcher self-check: staged bundle was not marked as ready.")
107108

108109

109110
if __name__ == "__main__":

0 commit comments

Comments
 (0)