Commit Graph

11 Commits

Author SHA1 Message Date
04ae1c8674 feat: add whitelist char support to nonascii check (#100)
All checks were successful
submodules sync / sync (push) Successful in 4m27s
build / build (push) Successful in 6m32s
build / trigger-build-image (push) Successful in 23s
This commit brings support of whitelisted characters during repo healthcheck/non-ascii file check. Supported by an extra switch to `repo-health-checker`, `-whitelistedChars`. The argument takes a comma-separated list of non-ASCII characters and ignores them during repo healthcheck. Illegal cmdline input is logged by the logger.

Co-Authored-By: GitHub Copilot <noreply@microsoft.com>
<details>
<summary>Copilot Prompt</summary>
<br>
This is a repo for an online judge orchestrator system «JOJ3». Under `cmd/` lies a source directory for a Go command, `repo-health-checker`. You tell from its name that it checks the repo for stuff like repo size, commit message, non-ASCII character usage, etc. before sending the work to the actual judging and grading system.

Now, I want the non-ASCII character checking function of the repo health checker to be flexible - it shall accept a list of non-ASCII characters and deem them acceptable.

## Your task

- Accept this new cmdline arg. In `cmd/repo-health-checker/main.go`, accept a new command line flag `-whitelisted-chars`, which shall take exactly one string of comma-separated non-ASCII characters. This string shall be passed to the actual healthcheck package.
- Respect this list while scanning the files. In `pkg/healthcheck/nonascii.go`, function `getNonASCII()`, we utilize a bufio *Scanner* to scan through all files for non-ASCII characters. We would like the list of acceptable chars to be passed from the cmdline to here, and modify the scanner logic to actually accept the corresponding characters.
- Error handling and reporting. This command line arg, `-whitelisted-chars`, could be completely abscent; in which case, no characters shall be escaped by default. The comma-separated list passed to the command may contain ASCII characters or multiple characters that are not properly separated; in which case, ignore that element, and report the incident via the SLog logging framework used in this project.
- Test your work. Create new testcases under `examples/healthcheck/` to reflect this change. Reflect to `examples/healthcheck/asciifile/` to learn about how to configure the repo health checker. Integrate your work to the Go test framework such that it could be invoked by running `make test` at the terminal.
  - Note: Use `git init` to init your testcase directory and make a initial commit - this project, JOJ3, only runs in Git repos.

## Notes
- Directory structure. `cmd/` for invokable commands, `pkg/` for the actual logic, `internal` - something you don't need to worry about.
- JOJ3 vs. Health Check. `joj3` is a separate executable; in this session we are only working on the `repo-health-checker`.
- Extras. Make sure to read `README.md` and the directory structure before you go; also, create To-do before you execute your plan.
</details>

Reviewed-on: https://focs.ji.sjtu.edu.cn/git/JOJ/JOJ3/pulls/100
Reviewed-by: 张泊明518370910136 <bomingzh@sjtu.edu.cn>
Co-authored-by: Mack Wang <mac-wang@sjtu.edu.cn>
Co-committed-by: Mack Wang <mac-wang@sjtu.edu.cn>
2026-04-26 08:23:33 +08:00
e7b0a0f1fd
feat(healthcheck): check actor csv for email
All checks were successful
submodules sync / sync (push) Successful in 41s
build / build (push) Successful in 2m36s
build / trigger-build-image (push) Successful in 11s
2025-07-01 22:13:28 -04:00
6643644865
feat(healthcheck): git lfs fsck --pointers
Some checks failed
build / trigger-build-image (push) Blocked by required conditions
build / build (push) Has been cancelled
submodules sync / sync (push) Has been cancelled
2025-06-28 08:29:03 -04:00
9cf640dee5
feat(healthcheck): check commit author email
Some checks failed
build / trigger-build-image (push) Blocked by required conditions
submodules sync / sync (push) Has been cancelled
build / build (push) Has been cancelled
2025-06-04 06:05:11 -04:00
015ff49021 feat(healthcheck): succeed msg (#88)
Some checks failed
build / trigger-build-image (push) Blocked by required conditions
build / build (push) Has been cancelled
submodules sync / sync (push) Has been cancelled
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/JOJ/JOJ3/pulls/88
Co-authored-by: BoYanZh <boyanzh233@gmail.com>
Co-committed-by: BoYanZh <boyanzh233@gmail.com>
2025-05-31 06:20:34 +08:00
4c15ac48d9 feat(healthcheck): support score
Some checks failed
build / build (push) Successful in 2m16s
build / trigger-build-image (push) Successful in 13s
submodules sync / sync (push) Has been cancelled
2025-05-29 00:06:06 -04:00
f99ad5eae4
style: more linters 2025-03-28 05:53:30 -04:00
1150cc4697
docs: better packages docs 2025-02-18 06:21:17 -05:00
1bbc589897
feat(healthcheck): remove joj3-check
All checks were successful
submodules sync / sync (push) Successful in 32s
build / build (push) Successful in 1m11s
build / trigger-build-image (push) Successful in 6s
2025-02-01 04:59:25 -05:00
3d828b6168
feat(healthcheck): run joj3-check-env
All checks were successful
submodules sync / sync (push) Successful in 51s
build / build (push) Successful in 1m48s
build / trigger-build-image (push) Successful in 8s
2025-01-31 19:23:05 -05:00
0f5ccf8af2
feat(healthcheck): add teapot-checker to repo-health-checker
All checks were successful
submodules sync / sync (push) Successful in 44s
build / build (push) Successful in 1m28s
build / trigger-build-image (push) Successful in 8s
2024-12-05 12:05:22 -05:00