A new admin-only solve page, /p/<name>/solve, edits a problem's code in
C++ or Python (a dropdown switches between them), runs it on custom
input or against the saved tests with per-test verdicts (AC, WA, RE,
TLE, unchecked) and compile errors, marks lint diagnostics in the
editor, and saves the code back as a commit ("Edit <name>"). Drafts
stay in the browser per problem and language until saved. LeetCode
problems are C++ only, since their tests run through driver.h.
Code never runs in the site, which holds the Claude, Gitea and S3
secrets. A separate runner service (cmd/usacorunner, Dockerfile.runner)
does it in a container meant to have no environment, an internal-only
network, a read-only root apart from /tmp, and memory, CPU and pids
limits, with tini to reap orphans. Runs copy the CLI: the same g++
flags with -DLOCAL and the repo's headers, <io>.in on disk and on
stdin, <io>.out or stdout as the output, and usaco test's comparison.
Unlike the CLI they have CPU, memory, file and wall-clock limits.
C++ lint is g++'s warnings plus clang-tidy with a new .clang-tidy
(bugprone, performance and a few readability checks; template.cpp is
clean). Python lint is a syntax check plus ruff. template.py is the
Python starter, with a stdio() helper like template.rs's.
CI builds, smoke-tests and rolls out the runner image before the site.
The web_server stack needs a usaco-runner service before that rollout
can succeed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.3 KiB
YAML
31 lines
1.3 KiB
YAML
# clang-tidy checks for this repo's competitive-programming C++.
|
|
#
|
|
# Kept byte-for-byte identical in two places, and a test in
|
|
# site/internal/runner checks that they match:
|
|
# .clang-tidy (repo root) for editors and clangd
|
|
# site/internal/runner/clang-tidy.yaml embedded in the solve page's linter
|
|
#
|
|
# bugprone and performance catch real mistakes (int overflow before
|
|
# widening, copies in hot loops, chained comparisons) without opinions on
|
|
# style. Turned off are the checks that fire on the template itself or on
|
|
# idioms that are normal in contest code:
|
|
# macro-parentheses the template's F(i, L, R), takeI(n) etc.
|
|
# easily-swappable-... every f(int a, int b)
|
|
# narrowing-conversions int i = v.size() and friends, everywhere
|
|
# switch-missing-default switches over a char read from input
|
|
# avoid-endl interactive problems need the flush
|
|
# enum-size an enum's base type never matters here
|
|
# Compiler errors are left to g++, which the linter also runs.
|
|
Checks: >-
|
|
-*,
|
|
bugprone-*,
|
|
performance-*,
|
|
readability-misleading-indentation,
|
|
readability-redundant-*,
|
|
-bugprone-easily-swappable-parameters,
|
|
-bugprone-narrowing-conversions,
|
|
-bugprone-macro-parentheses,
|
|
-bugprone-switch-missing-default-case,
|
|
-performance-avoid-endl,
|
|
-performance-enum-size
|