-
Notifications
You must be signed in to change notification settings - Fork 0
Lint and document code #2
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds comprehensive documentation and addresses linting issues across the MinUI codebase. The changes focus on documenting C code with detailed function-level and file-level comments, particularly for platform-specific implementations and hardware abstraction layers.
Key Changes:
- Added detailed file and function documentation throughout the codebase
- Fixed minor linting issues (unused variables, missing return statements, format specifiers)
- Consolidated utility headers from multiple files into a single utils.h
- Removed interactive TTY flags from Docker commands in makefile
Reviewed Changes
Copilot reviewed 65 out of 85 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| workspace/rg35xx/platform/ion.h | Added comprehensive ION memory allocator documentation |
| workspace/rg35xx/platform/ion-owl.h | Documented OWL SoC-specific ION extensions |
| workspace/rg35xx/platform/de_atm7059.h | Documented ATM7059 display engine registers |
| workspace/rg35xx/keymon/keymon.c | Documented button monitoring daemon |
| workspace/my355/platform/platform.* | Documented MY355 platform with HDMI and Hall sensor support |
| workspace/my282/platform/platform.* | Documented MY282 platform with analog stick support |
| workspace/miyoomini/platform/platform.* | Documented Miyoo Mini with MI_GFX hardware acceleration |
| workspace/magicmini/platform/platform.* | Documented Magic Mini platform |
| workspace/macos/platform/* | Documented macOS development platform |
| workspace/m17/platform/* | Documented M17 platform |
| workspace/gkdpixel/platform/* | Documented GKD Pixel platform |
| workspace/all/common/utils.* | Consolidated utility headers into single file |
| workspace/all/syncsettings/syncsettings.c | Documented settings sync utility |
| workspace/all/say/say.c | Documented message display utility |
| workspace/all/minput/minput.c | Documented input tester utility |
| makefile.toolchain | Removed interactive TTY flags from Docker commands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
workspace/my355/keymon/keymon.c
Outdated
| static void* watchPorts(void *arg) { | ||
| int has_jack,had_jack; | ||
| had_jack = had_jack = JACK_enabled(); | ||
| has_jack = had_jack = JACK_enabled(); |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Assignment chain has_jack = had_jack = JACK_enabled() should be written as two separate assignments for clarity: had_jack = JACK_enabled(); has_jack = had_jack;
| has_jack = had_jack = JACK_enabled(); | |
| had_jack = JACK_enabled(); | |
| has_jack = had_jack; |
|
|
||
| p = (uint32_t *)(&mem[0xc00 + 0x258]); | ||
| printf("%d\n", (*p & 0xff)); fflush(stdout); | ||
| printf("%u\n", (*p & 0xff)); fflush(stdout); |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using %u format specifier for uint32_t is not portable. Use PRIu32 from <inttypes.h> or cast to unsigned int for guaranteed correctness.
| else if (t == T_SWAP) { | ||
| return ret_state(swap_val[0], swap_val[1]); | ||
| } | ||
| return S_DISABLED; // Should never reach here |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment states 'Should never reach here' but function can reach this return statement when neither swap_val condition is true. Either remove the comment or add an assertion to validate the assumption.
| int i; | ||
| int p; |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Variables i and p are declared but not initialized. While they are assigned before use, initializing to 0 would make the code more defensive.
| int i; | |
| int p; | |
| int i = 0; | |
| int p = 0; |
| * @param argv Argument vector - argv[1] contains the message text | ||
| * @return EXIT_SUCCESS on normal exit | ||
| */ | ||
| int main(int argc, const char* argv[]) { |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter 'argc' is declared but never used in the function body. No bounds checking is performed on argv before accessing argv[1], which could cause a crash if the program is called without arguments.
| int main(int argc, const char* argv[]) { | |
| int main(int argc, const char* argv[]) { | |
| if (argc < 2) { | |
| fprintf(stderr, "Usage: %s <message>\n", argv[0]); | |
| return EXIT_FAILURE; | |
| } |
| * @param str2 Second string to compare | ||
| * @return 1 if strings are identical, 0 otherwise | ||
| */ | ||
| int exactMatch(const char* str1, const char* str2); |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function signature in header uses 'const char*' but implementation may use 'char*'. Ensure consistency between declaration and definition.
|
|
||
| all: $(INIT_IF_NECESSARY) | ||
| docker run -it --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) $(PLATFORM)-toolchain /bin/bash | ||
| docker run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) $(PLATFORM)-toolchain /bin/bash |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Removed -it flags from docker run commands. These flags enable interactive terminal mode which is useful for debugging. Consider documenting why non-interactive mode is preferred or provide a separate target for interactive debugging.
Address common linting issues and thoroughly document all the C code.