Commit Graph

17 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
cd36469f49
test: remove unstable clangtidy test
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-03-01 20:49:18 -05:00
144c705887
fix: add missing submodule back
Some checks failed
submodules sync / sync (push) Successful in 39s
build / build (push) Failing after 1m14s
build / trigger-build-image (push) Has been skipped
2024-11-03 01:47:51 -05:00
c642f04aef
test(cpplint): simpler test
Some checks failed
submodules sync / sync (push) Failing after 8s
build / build (push) Failing after 1m0s
build / trigger-build-image (push) Has been skipped
2024-11-03 01:45:02 -05:00
f0349a461b
fix(parser/cppcheck): backward compatibility
Some checks failed
submodules sync / sync (push) Successful in 43s
build / build (push) Failing after 1m28s
build / trigger-build-image (push) Has been skipped
2024-11-03 01:20:50 -05:00
555760bf1f
test(cppcheck): remove unstable test case
All checks were successful
submodules sync / sync (push) Successful in 42s
build / build (push) Successful in 1m30s
build / trigger-build-image (push) Successful in 9s
2024-10-23 04:31:34 -04:00
4c601d8ef7
test(keyword/script): add
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
2024-10-23 04:09:25 -04:00
a9a829da3f
feat: rename module
Some checks failed
build-image / create-empty-commit (push) Failing after 4s
checks / build (push) Successful in 1m20s
2024-09-30 17:38:40 -04:00
5a860f1203 feat: repo health check (#16) (#17)
- repo size
- forbidden files
- meta files
- ascii character in files
- integrity check
- ascii character in the commit message
- release tag check

Co-authored-by: Boming Zhang <bomingzh@sjtu.edu.cn>
Co-authored-by: zzjc1234 <2359047351@qq.com>
Co-authored-by: Hydraallen <wangruiallen@gmail.com>
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pulls/17
Co-authored-by: 周赵嘉程521432910016 <zzjc123@sjtu.edu.cn>
Co-committed-by: 周赵嘉程521432910016 <zzjc123@sjtu.edu.cn>
2024-09-11 20:09:27 +08:00
zzjc1234
fdf84546da
chore: gitmodules 2024-09-11 05:12:08 -04:00
2928e6321f
chore: rename dummy -> sample 2024-09-10 22:03:25 -04:00
5ac760814d feat: cppcheck parser (#28)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: zjc_he <zjc_he@sjtu.edu.cn>
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pulls/28
Reviewed-by: 张泊明518370910136 <bomingzh@sjtu.edu.cn>
Co-authored-by: 张佳澈520370910044 <zjc_he@sjtu.edu.cn>
Co-committed-by: 张佳澈520370910044 <zjc_he@sjtu.edu.cn>
2024-05-30 11:12:30 +08:00
a042ac01ea feat: clang-tidy parser (#26)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: zjc_he <zjc_he@sjtu.edu.cn>
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pulls/26
Reviewed-by: 张泊明518370910136 <bomingzh@sjtu.edu.cn>
Co-authored-by: 张佳澈520370910044 <zjc_he@sjtu.edu.cn>
Co-committed-by: 张佳澈520370910044 <zjc_he@sjtu.edu.cn>
2024-05-18 02:50:13 +08:00
16a59a7fc2
chore: add examples/keyword/clang-tidy
Some checks failed
continuous-integration/drone/push Build is failing
2024-05-02 20:30:57 -04:00
39a720afa2
chore: rename examples
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-02 19:07:33 -04:00
2854fd7c91 feat: keyword parser (#23) (#24)
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pulls/24
2024-04-28 03:52:07 +08:00
51539c1e7c feat: cpplint parser (#22)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Boming Zhang <bomingzh@sjtu.edu.cn>
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pulls/22
2024-04-04 07:29:00 +08:00