-
Notifications
You must be signed in to change notification settings - Fork 0
dev 02 #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
base: master
Are you sure you want to change the base?
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.
No issues found across 7 files
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.
No issues found across 9 files
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.
1 issue found across 12 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/db/foodrepository.cpp">
<violation number="1" location="src/db/foodrepository.cpp:152">
P2: This function accesses `m_rdas` without first calling `ensureCacheLoaded()`. If `getFoodNutrients()` is called before the cache is loaded, `m_rdas` will be empty and all RDA percentages will incorrectly be 0.0. Consider adding `ensureCacheLoaded()` at the start of this function, similar to how `searchFoods()` does.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
5 issues found across 31 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/db/mealrepository.cpp">
<violation number="1" location="src/db/mealrepository.cpp:151">
P2: Missing error handling for `query.exec()`. Unlike `addFoodLog()` and `clearDailyLogs()` which log errors on failure, this will fail silently if the delete operation fails, leaving users unaware that the entry wasn't removed.</violation>
</file>
<file name="src/db/foodrepository.cpp">
<violation number="1" location="src/db/foodrepository.cpp:251">
P2: The return value of `query.prepare()` is not checked before calling `bindValue()` and `exec()`. If prepare fails (e.g., table doesn't exist), the error won't be properly handled. This is inconsistent with other functions in this file that check the prepare result.</violation>
</file>
<file name="src/db/databasemanager.cpp">
<violation number="1" location="src/db/databasemanager.cpp:20">
P2: Resource leak: `m_userDb` is opened in `initUserDatabase()` but never closed in the destructor. Add cleanup for the user database connection.</violation>
<violation number="2" location="src/db/databasemanager.cpp:76">
P1: Missing directory creation: The `~/.nutra/` directory may not exist on first run. SQLite cannot create parent directories, causing `m_userDb.open()` to fail. Use `QDir().mkpath()` to ensure the directory exists.</violation>
</file>
<file name="CMakeLists.txt">
<violation number="1" location="CMakeLists.txt:16">
P2: `file(GLOB_RECURSE ...)` won’t trigger reconfiguration when new files are added unless `CONFIGURE_DEPENDS` is specified, so new sources can be silently omitted from builds. Add `CONFIGURE_DEPENDS` or list sources explicitly.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
4 issues found across 11 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name=".github/workflows/version-bump.yml">
<violation number="1" location=".github/workflows/version-bump.yml:99">
P1: `${{ env.NEW_TAG }}` will be empty because environment variables set via `$GITHUB_ENV` are only available in subsequent steps, not the current step. Use the shell variable `$NEW_TAG` directly instead.</violation>
</file>
<file name="src/widgets/searchwidget.cpp">
<violation number="1" location="src/widgets/searchwidget.cpp:102">
P2: The description column is no longer populated, so descItem is null and double-click/context menu actions will no-op. Add the description item back when populating the row.</violation>
</file>
<file name="src/db/mealrepository.cpp">
<violation number="1" location="src/db/mealrepository.cpp:151">
P2: The query has one placeholder, but the new line binds a second parameter. This can break execution with a parameter count mismatch. Remove the extra bind.</violation>
</file>
<file name="src/widgets/dailylogwidget.cpp">
<violation number="1" location="src/widgets/dailylogwidget.cpp:153">
P2: Progress bar color is never reset after exceeding 100%. Once any bar turns purple (when pct > 100), it remains purple even when the percentage later drops below 100%, because the else branch is commented out. The bars should be reset to their original colors when below 100%.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
4 issues found across 13 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/db/mealrepository.cpp">
<violation number="1" location="src/db/mealrepository.cpp:151">
P2: Binding the same parameter twice for a single placeholder supplies too many bound values, which can make the DELETE fail or behave unexpectedly. Only bind the value once.</violation>
</file>
<file name="src/widgets/dailylogwidget.cpp">
<violation number="1" location="src/widgets/dailylogwidget.cpp:155">
P2: Progress bar color is never reset after exceeding 100%. When `pct` drops back below 100%, the bar remains purple because the style reset is commented out. Consider storing original colors and setting the appropriate color on each update.</violation>
</file>
<file name=".github/workflows/release.yml">
<violation number="1" location=".github/workflows/release.yml:170">
P1: Release step points to artifact paths that don’t include the download directory. The files are downloaded under `artifacts/<name>/...`, so the current paths will fail to resolve and the release will not attach the artifacts.</violation>
</file>
<file name="src/widgets/searchwidget.cpp">
<violation number="1" location="src/widgets/searchwidget.cpp:102">
P2: The Description column is no longer populated; the new block never sets column 1, so search results will show empty descriptions.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
5 issues found across 13 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/widgets/dailylogwidget.cpp">
<violation number="1" location="src/widgets/dailylogwidget.cpp:153">
P2: Progress bar color is never reset after exceeding 100%. Once `pct > 100` turns the bar purple, it stays purple even when the value drops back below 100% because the reset logic is commented out. The original color should be restored in the else branch.</violation>
</file>
<file name="src/db/mealrepository.cpp">
<violation number="1" location="src/db/mealrepository.cpp:151">
P2: The query only has one placeholder, but you now bind two values. This can cause parameter count mismatch errors or ignore the intended value. Remove the extra bind.</violation>
</file>
<file name=".github/workflows/version-bump.yml">
<violation number="1" location=".github/workflows/version-bump.yml:99">
P0: Environment variable `env.NEW_TAG` is not available in the same step where it's set. Variables written to `$GITHUB_ENV` are only available in subsequent steps. Use the shell variable `$NEW_TAG` directly instead.</violation>
</file>
<file name=".github/workflows/release.yml">
<violation number="1" location=".github/workflows/release.yml:169">
P2: Release assets are referenced without the `artifacts/` prefix even though `download-artifact` extracts under that directory. The release step will not find the files.</violation>
</file>
<file name="src/widgets/searchwidget.cpp">
<violation number="1" location="src/widgets/searchwidget.cpp:102">
P2: The Description column is no longer populated because the new logic omits setting column 1. This leaves the Description column blank in the results table.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
6 issues found across 19 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/widgets/profilesettingswidget.cpp">
<violation number="1" location="src/widgets/profilesettingswidget.cpp:64">
P2: Activity label initial text "2 (Lightly Active)" doesn't match the slider's default value. QSlider defaults to its minimum (1) after `setRange(1, 5)`, so if no profile is loaded, the UI shows inconsistent state. Initialize the slider to 2 or set the label to "1 (Sedentary)".</violation>
</file>
<file name="src/db/databasemanager.cpp">
<violation number="1" location="src/db/databasemanager.cpp:149">
P2: Fallback schema path `/usr/share/nutra/sql/tables.sql` is not verified to exist before calling applySchema. If neither path exists, database initialization silently fails.</violation>
<violation number="2" location="src/db/databasemanager.cpp:179">
P2: Return values of PRAGMA exec calls are not checked. If these fail silently, the database version remains 0, causing schema re-initialization on every startup.</violation>
</file>
<file name="tests/test_databasemanager.cpp">
<violation number="1" location="tests/test_databasemanager.cpp:40">
P2: Remove the named connection after closing to avoid lingering QSqlDatabase connections and file lock issues during cleanup.</violation>
</file>
<file name="src/widgets/searchwidget.cpp">
<violation number="1" location="src/widgets/searchwidget.cpp:248">
P2: Duplicate search triggered when selecting from history completer. `setText()` triggers `textChanged` which starts the debounce timer, then `performSearch()` is called immediately. When the timer fires, the search executes again. Stop the timer after setting the text to prevent the duplicate.</violation>
</file>
<file name="src/main.cpp">
<violation number="1" location="src/main.cpp:21">
P2: The lock file is created in the shared temp directory, so one user can prevent other users from starting the app. Use a per-user location (e.g., `RuntimeLocation`) or include user-specific data in the lock file path.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
4 issues found across 16 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="tests/test_databasemanager.cpp">
<violation number="1" location="tests/test_databasemanager.cpp:34">
P2: Call removeDatabase only after the `QSqlDatabase` object is destroyed; otherwise Qt warns that the connection is still in use. Clear `db` before removing the connection.</violation>
<violation number="2" location="tests/test_databasemanager.cpp:51">
P2: Call removeDatabase only after the `QSqlDatabase` object is destroyed; otherwise the connection remains in use. Reset `db` before removing the connection.</violation>
</file>
<file name="src/db/reciperepository.cpp">
<violation number="1" location="src/db/reciperepository.cpp:40">
P2: Missing error logging on query failure, inconsistent with other methods in this repository that log SQL errors.</violation>
</file>
<file name="src/widgets/recipewidget.cpp">
<violation number="1" location="src/widgets/recipewidget.cpp:280">
P2: Potential null pointer dereference. `ingredientsTable->item(row, 0)` can return `nullptr`. Add a null check before accessing the item's text.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="CMakeLists.txt">
<violation number="1" location="CMakeLists.txt:92">
P2: The `appimage` target doesn’t depend on `nutra`, so invoking it can run before the executable is built. `cmake --install` won’t build targets, which can make AppImage generation fail. Add a dependency on `nutra` so the binary is built first.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Summary by cubic
Adds a database picker with recent files and a context menu to add foods to a meal from search results. Adds RDA and Profile settings, a Daily Log with macro progress bars, a Preferences dialog with usage stats and database sizes, and a recipe builder to create and manage recipes.
New Features
Refactors
Written for commit 3f165c8. Summary will update on new commits.