Skip to content

163 implement alternative strategy in meal plan generator#169

Merged
Adish-Singh merged 3 commits intomainfrom
163-implement-alternative-strategy-in-meal-plan-generator
Dec 2, 2025
Merged

163 implement alternative strategy in meal plan generator#169
Adish-Singh merged 3 commits intomainfrom
163-implement-alternative-strategy-in-meal-plan-generator

Conversation

@matthew-SG
Copy link
Copy Markdown
Owner

Implemented an alternative strategy for meal plan generator

@matthew-SG matthew-SG linked an issue Dec 2, 2025 that may be closed by this pull request
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

checkstyle

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'mealPlanInputData' declaration and its first usage is 18, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

MealPlanInputData mealPlanInputData = new MealPlanInputData("1", "1", "1", "1", "default");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'mealPlanInputData' should be declared final.

MealPlanInputData mealPlanInputData = new MealPlanInputData("1", "1", "1", "1", "default");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'mealPlanInputData' declaration and its first usage is 31, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

MealPlanInputData mealPlanInputData = new MealPlanInputData("50", "50", "50", "50", "default");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'mealPlanInputData' should be declared final.

MealPlanInputData mealPlanInputData = new MealPlanInputData("50", "50", "50", "50", "default");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck> reported by reviewdog 🐶
NCSS for this method is 58 (max allowed is 50).


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.ExecutableStatementCountCheck> reported by reviewdog 🐶
Executable statement count is 50 (max allowed is 30).


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'mealPlanInputData' declaration and its first usage is 31, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

MealPlanInputData mealPlanInputData = new MealPlanInputData("50", "50", "50", "50", "calories");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'mealPlanInputData' should be declared final.

MealPlanInputData mealPlanInputData = new MealPlanInputData("50", "50", "50", "50", "calories");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'ingredients' should be declared final.

List<Ingredient> ingredients = new ArrayList<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'nutritionalInfo1' should be declared final.

Map<String, Double> nutritionalInfo1 = new HashMap<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'nutritionalInfo2' should be declared final.

Map<String, Double> nutritionalInfo2 = new HashMap<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'nutritionalInfo3' should be declared final.

Map<String, Double> nutritionalInfo3 = new HashMap<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'nutritionalInfo4' should be declared final.

Map<String, Double> nutritionalInfo4 = new HashMap<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'recipe1' should be declared final.

Recipe recipe1 = new Recipe(1234, "spaghetti", "idontexist.jpg", ingredients,


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'recipe2' should be declared final.

Recipe recipe2 = new Recipe(1324, "linguini", "idontexist.jpg", ingredients,


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'recipe3' should be declared final.

Recipe recipe3 = new Recipe(3124, "fettuccine", "idontexist.jpg", ingredients,


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'recipe4' should be declared final.

Recipe recipe4 = new Recipe(5678, "tortellini", "iDOexist.jpg", ingredients,


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'likedRecipes' should be declared final.

List<Recipe> likedRecipes = userRepository.getSavedRecipes();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'expectedNames' declaration and its first usage is 8, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

String[] expectedNames = {"spaghetti", "linguini", "fettuccine"};


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'expectedNames' should be declared final.

String[] expectedNames = {"spaghetti", "linguini", "fettuccine"};


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'expectedImages' declaration and its first usage is 8, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

String[] expectedImages = {"idontexist.jpg", "idontexist.jpg", "idontexist.jpg"};


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'expectedImages' should be declared final.

String[] expectedImages = {"idontexist.jpg", "idontexist.jpg", "idontexist.jpg"};


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'expectedIngredients' should be declared final.

List<List<String[]>> expectedIngredients = new ArrayList<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'nestedIngredients' should be declared final.

List<String[]> nestedIngredients = new ArrayList<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck> reported by reviewdog 🐶
',' is not followed by whitespace.

nestedIngredients.add(new String[]{"salt","100.0","kg"});


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck> reported by reviewdog 🐶
',' is not followed by whitespace.

nestedIngredients.add(new String[]{"salt","100.0","kg"});


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'expectedNutritionalInfo' should be declared final.

List<Map<String, Double>> expectedNutritionalInfo = new ArrayList<>();


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'presenter' should be declared final.

MealPlanOutputBoundary presenter = new MealPlanOutputBoundary() {


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'interactor' should be declared final.

MealPlanInputBoundary interactor = new MealPlanInteractor(userRepository, presenter);


🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck> reported by reviewdog 🐶
Name 'use_case.meal_plan' must match pattern '^[a-z]+(.[a-zA-Z_]\w*)*$'.

// Create DAO and user for the purposes of the test
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
// Create DAO and user for the purposes of the test, api key doesn't matter
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

// Temp DAO for testing, api key doesn't matter
FakeRecipeDAO fakeDAO = new FakeRecipeDAO();
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

FakeRecipeDAO fakeDAO = new FakeRecipeDAO();
fakeDAO.recipesToReturn = new ArrayList<>();
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

FakeRecipeDAO fakeDAO = new FakeRecipeDAO();
fakeDAO.exceptionToThrow = new RuntimeException("Simulated API failure");
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("a");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

FakeRecipeDAO fakeDAO = new FakeRecipeDAO();
fakeDAO.recipesToReturn = null; // ← key difference
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject("");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'userRepository' should be declared final.

MealPlanInputData inputData4 = new MealPlanInputData("1", "2", "3", "-1");
InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
MealPlanInputData inputData1 = new MealPlanInputData("-1", "1", "2", "3", "default");
MealPlanInputData inputData2 = new MealPlanInputData("1", "-1", "2", "3", "default");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'inputData2' should be declared final.

InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
MealPlanInputData inputData1 = new MealPlanInputData("-1", "1", "2", "3", "default");
MealPlanInputData inputData2 = new MealPlanInputData("1", "-1", "2", "3", "default");
MealPlanInputData inputData3 = new MealPlanInputData("1", "2", "-1", "3", "default");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'inputData3' declaration and its first usage is 8, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

InMemoryUserDataAccessObject userRepository = new InMemoryUserDataAccessObject();
MealPlanInputData inputData1 = new MealPlanInputData("-1", "1", "2", "3", "default");
MealPlanInputData inputData2 = new MealPlanInputData("1", "-1", "2", "3", "default");
MealPlanInputData inputData3 = new MealPlanInputData("1", "2", "-1", "3", "default");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'inputData3' should be declared final.

MealPlanInputData inputData1 = new MealPlanInputData("-1", "1", "2", "3", "default");
MealPlanInputData inputData2 = new MealPlanInputData("1", "-1", "2", "3", "default");
MealPlanInputData inputData3 = new MealPlanInputData("1", "2", "-1", "3", "default");
MealPlanInputData inputData4 = new MealPlanInputData("1", "2", "3", "-1", "default");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck> reported by reviewdog 🐶
Distance between variable 'inputData4' declaration and its first usage is 9, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

MealPlanInputData inputData1 = new MealPlanInputData("-1", "1", "2", "3", "default");
MealPlanInputData inputData2 = new MealPlanInputData("1", "-1", "2", "3", "default");
MealPlanInputData inputData3 = new MealPlanInputData("1", "2", "-1", "3", "default");
MealPlanInputData inputData4 = new MealPlanInputData("1", "2", "3", "-1", "default");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'inputData4' should be declared final.

Copy link
Copy Markdown
Collaborator

@Adish-Singh Adish-Singh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

@Adish-Singh Adish-Singh merged commit 2ae7038 into main Dec 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement alternative strategy in meal plan generator.

2 participants