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: #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>
77 lines
3.2 KiB
Plaintext
77 lines
3.2 KiB
Plaintext
[submodule "examples/diff/basic"]
|
|
path = examples/diff/basic
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = diff/basic
|
|
[submodule "examples/diff/complex"]
|
|
path = examples/diff/complex
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = diff/complex
|
|
[submodule "examples/compile/success"]
|
|
path = examples/compile/success
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = compile/success
|
|
[submodule "examples/compile/error"]
|
|
path = examples/compile/error
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = compile/error
|
|
[submodule "examples/sample/success"]
|
|
path = examples/sample/success
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = sample/success
|
|
[submodule "examples/sample/error"]
|
|
path = examples/sample/error
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = sample/error
|
|
[submodule "examples/keyword/cpplint/sillycode"]
|
|
path = examples/keyword/cpplint/sillycode
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = keyword/cpplint/sillycode
|
|
[submodule "examples/keyword/clangtidy/sillycode"]
|
|
path = examples/keyword/clangtidy/sillycode
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = keyword/clangtidy/sillycode
|
|
[submodule "examples/healthcheck/asciifile"]
|
|
path = examples/healthcheck/asciifile
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/asciifile
|
|
[submodule "examples/healthcheck/asciimsg"]
|
|
path = examples/healthcheck/asciimsg
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/asciimsg
|
|
[submodule "examples/healthcheck/forbiddenfile"]
|
|
path = examples/healthcheck/forbiddenfile
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/forbiddenfile
|
|
[submodule "examples/healthcheck/meta"]
|
|
path = examples/healthcheck/meta
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/meta
|
|
[submodule "examples/healthcheck/release"]
|
|
path = examples/healthcheck/release
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/release
|
|
[submodule "examples/healthcheck/reposize"]
|
|
path = examples/healthcheck/reposize
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/reposize
|
|
[submodule "examples/healthcheck/repoverify"]
|
|
path = examples/healthcheck/repoverify
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/repoverify
|
|
[submodule "examples/keyword/script"]
|
|
path = examples/keyword/script
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = keyword/script
|
|
[submodule "examples/cppcheck/simple"]
|
|
path = examples/cppcheck/simple
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = cppcheck/simple
|
|
[submodule "examples/cpplint/simple"]
|
|
path = examples/cpplint/simple
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = cpplint/simple
|
|
[submodule "examples/healthcheck/whitelistedchars-success"]
|
|
path = examples/healthcheck/whitelistedchars-success
|
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/JOJ/JOJ3-examples.git
|
|
branch = healthcheck/whitelistedchars-success
|