Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
edc7e2e
fix(scripts): return None from get_docx_document on missing template
immortal71 Mar 6, 2026
34d3910
style: run black formatter and update return type to Optional[Any]
immortal71 Mar 6, 2026
6a8ef05
test(coverage): add unit tests to raise coverage above 90%
immortal71 Mar 6, 2026
879d567
style: fix flake8 F841 unused variables ll and result in convert_utest
immortal71 Mar 6, 2026
ecb4357
test(copi): add tests to push Elixir COPI coverage above 90%
immortal71 Mar 6, 2026
299d536
test(copi): cover remaining 0.5% gap to reach 90% COPI coverage
immortal71 Mar 6, 2026
9595f2c
test(copi): add toggle_vote, toggle_continue_vote, format_capec and p…
immortal71 Mar 6, 2026
45d2071
test(copi): remove player-not-found redirect test that crashes LiveVi…
immortal71 Mar 6, 2026
4aab375
test(copi): remove 4 tests that mismodel runtime behaviour
immortal71 Mar 7, 2026
28b8ae8
ci: fix checkout fetch for pull_request_target workflow
immortal71 Mar 7, 2026
53fe8d8
ci: fix commentpr job checkout to use SHA not branch ref
immortal71 Mar 7, 2026
016b6bf
ci: remove unnecessary checkout from commentpr job
immortal71 Mar 7, 2026
508bd15
Update copi.owasp.org/test/copi_web/live/game_live/show_test.exs
immortal71 Mar 7, 2026
1ea5e89
Merge remote-tracking branch 'upstream/master' into fix/2490-docx-none
immortal71 Mar 13, 2026
b7f8722
Merge branch 'fix/2490-docx-none' of https://github.com/immortal71/co…
immortal71 Mar 13, 2026
a6135eb
style: fix flake8 and black issues in check_translations.py from upst…
immortal71 Mar 13, 2026
2728bc0
test(copi): add HealthController test to restore coverage above 90%
immortal71 Mar 13, 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
6 changes: 1 addition & 5 deletions .github/workflows/run-tests-generate-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
persist-credentials: false
# Set the pip environment up
- name: Get Python
Expand Down Expand Up @@ -170,10 +170,6 @@ jobs:
issues: write
needs: uploadoutputfiles
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Download translation check report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule CopiWeb.HealthControllerTest do
use CopiWeb.ConnCase

test "GET /health returns 200 when database is available", %{conn: conn} do
conn = get(conn, "/health")
assert conn.status == 200
assert conn.resp_body == "healthy\n"
end
end
30 changes: 25 additions & 5 deletions scripts/check_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,31 @@ def main() -> None:
sys.exit(1)

# Run checker
checker = TranslationChecker(source_dir,
excluded_tags=["T02330", "T02530",
"T03130", "T03150", "T03170", "T03190", "T03240", "T03260",
"T03350", "T03420", "T03470", "T03490", "T03540", "T03580",
"T03710", "T03730", "T03750", "T03770", "T03772", "T03774"])
checker = TranslationChecker(
source_dir,
excluded_tags=[
"T02330",
"T02530",
"T03130",
"T03150",
"T03170",
"T03190",
"T03240",
"T03260",
"T03350",
"T03420",
"T03470",
"T03490",
"T03540",
"T03580",
"T03710",
"T03730",
"T03750",
"T03770",
"T03772",
"T03774",
],
)
results = checker.check_translations()

# Generate report
Expand Down
14 changes: 8 additions & 6 deletions scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import zipfile
import xml.etree.ElementTree as ElTree
from defusedxml import ElementTree as DefusedElTree
from typing import Any, Dict, List, Tuple, cast
from typing import Any, Dict, List, Optional, Tuple, cast
from operator import itemgetter
from itertools import groupby
from pathlib import Path
Expand Down Expand Up @@ -291,9 +291,12 @@ def create_edition_from_template(
if file_extension == ".docx":
# Get the input (template) document
doc = get_docx_document(template_doc)
if doc:
if doc is not None:
doc = replace_docx_inline_text(doc, language_dict)
doc.save(output_file)
else:
logging.error("Cannot create output file: template document not found at %s", template_doc)
return
Comment on lines +294 to +299
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description lists only the changes to scripts/convert.py and tests/scripts/convert_utest.py, but the actual diff includes substantial additional changes: ~10 Elixir test files with new test coverage, CI workflow modifications (.github/workflows/run-tests-generate-output.yaml), and several new Python test classes beyond what's described (e.g., TestValidateFilePaths, TestValidateCommandArgs, TestConvertWithLibreOffice, TestConvertWithDocx2pdf, TestCleanupTempFile, etc.). Consider updating the PR description to reflect the full scope of changes.

Copilot uses AI. Check for mistakes.
else:
save_odt_file(template_doc, language_dict, output_file)

Expand Down Expand Up @@ -550,16 +553,15 @@ def get_document_paragraphs(doc: Any) -> List[Any]:
return paragraphs


def get_docx_document(docx_file: str) -> Any:
"""Open the file and return the docx document."""
def get_docx_document(docx_file: str) -> Optional[Any]:
"""Open the file and return the docx document, or None if the file is not found."""
import docx # type: ignore[import-untyped]

if os.path.isfile(docx_file):
return docx.Document(docx_file)
else:
logging.error("Could not find file at: %s", str(docx_file))
# Create a blank document if it fails
return docx.Document()
return None


def get_files_from_of_type(path: str, ext: str) -> List[str]:
Expand Down
Loading
Loading