style: fix clang-format violations and re-enable clang-format check#26
style: fix clang-format violations and re-enable clang-format check#26
Conversation
Change-Id: I8e650dfc8e9922b8e48d970ff206539ab6250dd0
Change-Id: I53b36719394c9c1c3dacdcc9678e9742aa879cce
Summary of ChangesHello @kkkapu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on improving code style consistency by resolving existing Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes clang-format violations. The changes are stylistic and correct. I've added a couple of suggestions to improve test readability by encapsulating the RAII-based file creation logic into helper functions. This would make the test setup more explicit and easier to understand.
| { | ||
| BufferObject writer(test_path_ + "_new", 512); | ||
| } | ||
| { BufferObject writer(test_path_ + "_new", 512); } |
There was a problem hiding this comment.
While this single-line scope is functionally correct, its purpose of leveraging RAII to create and immediately close a file can be made more explicit. Encapsulating this setup logic in a helper function within the BufferObjectTest fixture would improve test readability.
For example, you could add a helper like this to BufferObjectTest:
static void CreateTestFile(const std::string& path, size_t size) {
BufferObject writer(path, size);
}And then use it in the test:
CreateTestFile(test_path_ + "_new", 512);
BufferObject reader(test_path_ + "_new");This makes the test's 'Arrange' step more self-documenting.
There was a problem hiding this comment.
the suggestion here makes it more readable - its hard to understand why we're doing this one line throwaway without knowing internal details, so wrapping in a function makes it more obvious. Can add a comment to the code in the function saying the BufferObject constructor will create the file, and its destructor will close (without deleting)
| { | ||
| BufferObject writable_buffer(test_path_, initial_size); | ||
| } | ||
| { BufferObject writable_buffer(test_path_, initial_size); } |
There was a problem hiding this comment.
Similar to my other comment, this RAII pattern for file creation could be made more explicit by using a helper function. This would improve the readability of the test setup.
Using the same helper function idea:
static void CreateTestFile(const std::string& path, size_t size) {
BufferObject writer(path, size);
}The test setup would then become:
CreateTestFile(test_path_, initial_size);
ASSERT_EQ(std::filesystem::file_size(test_path_), initial_size);This makes the intent of the setup clearer.
Change-Id: I4f9bef76fa5658a2399009cc0f1c1dc6650369ce
Change-Id: I9c7a4861acbe82a7df5d1d196618536e26420859
) Fix clang-format in build #2
| ruff format --check . | ||
|
|
||
| - name: Lint with clang-format | ||
| if: false # TODO(#2): fix this then re-enable |
There was a problem hiding this comment.
this is the clang-format check, only the coverage check was re-enabled
| --gcov-ignore-parse-errors negative_hits.warn \ | ||
| --gcov-ignore-parse-errors suspicious_hits.warn | ||
| --gcov-ignore-parse-errors suspicious_hits.warn \ | ||
| --gcov-ignore-errors=no_working_dir_found |
There was a problem hiding this comment.
is it actually working with these settings?
Fix clang-format in build #2