-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Code maintenance including unit testing, documentation, linter, etc. #201
Comments
Yes, unfortunately some files in animationdatasinglefile must use CRLF or the game engine crashes on trying to parse it, but editorconfig is still a good idea. I agree with the points brought up here, and since it lowers the bar for contribution I'm willing to adopt them, just that it may take some time. Unit test I think would be highest priority so that once refactoring begins we can ensure nothing breaks. |
Thanks for replying and agreeing with me. Yes all of them are time consuming. |
Progress ReportingAbout line breaks in
|
Expected behavior
Write the developer's intent in the comments.
It's often said that we can "see the code" without writing documentation above the function's signature, but at least we don't know the developer's intent." Why write it that way?" and "What do I have to pay attention to here?" It is useful to write. Of course, I also find it useful to write an overview of the function.
Writing unit tests
Although CI still ensures reproducibility of builds, the current code is already subject to software regression and is somewhat difficult to change. If the number of lines of code increases in the future, it may eventually become unmaintainable.
It would be nice if we could write unit tests, although this is only an ideal.
By the way, unlike Java, C# is not class-based and functions can be written by themselves, but like C++, it does not seem to perform file-by-file name mangling. (In Rust, names are separated by file units.)
Using .editerconfig
We can prevent encoding bugs (e.g. UTF8 and UTF16 files coming in and processing UTF16 incorrectly) and control line break rules.
One of the most common problems with git repository is the handling of newlines.
Windows ->
\r\n
CRLF),Linux ->
\n
(LF)MacOS ->
\r
(CR).The default git behavior on windows is LF on remote and CRLF automatically on local PC.
https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
It is convenient to use LF unless hkx template xml or some files must be CRLF. (It may be possible to push files on remote with CRLF by mistake, causing unchanged or uncommittable commits with mixed newline patterns. I have encountered this)
Using a linter
This was my first thought when I forked pandora. However, I did not send a pull request because the default linter settings did not match the naming conventions of this repository and for some reason the configuration changes could not be applied. (In pandora, private fields are camelCase, but not in linter)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers
We also have the option of using sonarlint. VS Studio or VS Code(requires JavaRuntime17) exists as an extension to.
https://www.reddit.com/r/dotnet/comments/okqky1/what_is_the_best_linter_for_c/
Using Code Spell Checker
Using VSCode extensions is an easy way to prevent misspellings.
https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker
If we create cspell.jsonc in the root dir of the repository and write
we can exclude words recognized as errors with a code action (
ctrl+.
) to exclude the words identified as errors.It may be more convenient to use
git stash
than to leave a comment in the code.git stash pop
: retrieve backup and remove backup.git stash apply
: just take out the backup.git stash -u
: do a backup of current changes (including unstaged ones)Writing CI
Builds must always be able to do this or the quality of the software will quickly degrade. Currently this is already done, so no need to worry.
And we can also write the test and linter runs to CI.
other
I really wish I could do it, but I am not very familiar with C# as the writer of this issue, so I have not been able to get it to work.
I'm not familiar with HavokEngine either, so I'm still learning both (I've only learned a little bit about binary data).
Others may be too busy implementing features, fixing bugs, or doing other work to get around to it.
I apologize for not being able to help you all.
The text was updated successfully, but these errors were encountered: