NOTE: Insipired by original repository, thanks the original author and contributors of it!
We use just to make it easy to install, run and test:
just setup: Setup all enviroment withuvjust conan-install: Install all dependencies byconanjust configure: Do configure forCMakejust build: Build the whole projectjust run: Run the main problem get program. With no arguments it stays interactive; with arguments it runs the command directly.just test: Run tests for whole projectsjust cppcheck: Run cppcheckjust coverage: Configure with coverage enabled, build, test, and write reports undercoverage/just clean-all: Remove all generated filesjust ci: Build, run tests, and run cppcheck in order; stop on failure
Pass a problem id to work on one solution without building or running the others:
just build 57
just test 57
just coverage 57
just cppcheck 57
just ci 57Both 57 and 0057 select src/solution/s0057_*.cpp. Run just configure
once after updating the build configuration. Single-solution tests build their
own executable before running. Single-solution cppcheck uses the compilation
database with a file filter to analyze only the selected solution.
Single-solution coverage reports are written to
coverage/0057/ without processing other solutions' coverage data. Enabling
coverage changes compiler flags, so a later full build may rebuild other targets.
Omit the id to keep the existing whole-project behavior.
Run just configure before the first just ci. Both just ci and
just cppcheck return a nonzero exit code when cppcheck reports unsuppressed
findings. These local checks do not replace the remote CI's platform matrix
or other checks.
Commit messages must follow Conventional Commits with the following rules enforced by commitlint (see .commitlintrc.js):
<type>(<scope>): <subject>
solve- add a solution for a problemretry- retry a previously failed submission (see scope rules below)skip- skip a problemrefactor,docs,test,revert,perf,build,chore,fix,ci,style- conventional types
Problem-related types (solve, retry, skip) require a 4-digit problem id as scope (e.g. solve(0042)).
In addition, the retry type must also append the failure result code, separated by a comma:
WA- Wrong AnswerTLE- Time Limit ExceededOLE- Output Limit ExceededMLE- Memory Limit ExceededRE- Runtime ErrorPE- Presentation ErrorCE- Compile ErrorCREDIT
Example: retry(0001,WA)
Other types have no special scope validation.
- Header subject is limited to 50 characters (warning)
- Body lines are limited to 72 characters (warning)
- Subject case is not enforced (both
Do itanddo itare accepted)
- Remove all the solution .cpp
- Clean all files in src/solution
- Start your leetcode journey by typing
just runand then input the question id - Fetch a problem directly with
just run {question_id} - To solve a problem (we should start the problem first), use
just run solve {question_id}or entersolve {question_id}afterjust run - To passby cloudflare, please
cp .env.smaple .env, and setLEETCODE_COOKIEwith your cookie (could be find in Firefox or Chrome console)