-
Notifications
You must be signed in to change notification settings - Fork 305
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
Programming exercises
: Add a warning for duplicated test cases in the problem statement
#7840
Programming exercises
: Add a warning for duplicated test cases in the problem statement
#7840
Conversation
Important Auto Review SkippedReview was skipped due to path filters WalkthroughThe recent update introduces functionality to detect and handle duplicated test cases in programming exercise instructions. A new condition checks for these duplicates, which are then displayed with their counts. The analysis component, service, and model are updated to support this feature, including a new array and enum type. The editing component now maps these findings to warnings, ensuring that duplicated test cases are flagged during the exercise creation process. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (3)
- src/main/webapp/i18n/de/programmingExercise.json
- src/main/webapp/i18n/en/programmingExercise.json
- src/test/javascript/spec/helpers/sample/problemStatement.json
Files selected for processing (7)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.html (2 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.ts (3 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.model.ts (1 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.service.ts (6 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/programming-exercise-editable-instruction.component.ts (1 hunks)
- src/test/javascript/spec/component/programming-exercise/programming-exercise-instruction-analysis.component.spec.ts (6 hunks)
- src/test/javascript/spec/service/programming-exercise-instruction-analysis.service.spec.ts (3 hunks)
Files skipped from review due to trivial changes (1)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.model.ts
Additional comments: 22
src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.html (2)
2-2: The condition in the
@if
block now checks for the length ofduplicatedTestCases
in addition toinvalidTestCases
andmissingTestCases
. This is a logical extension to include the new feature of detecting duplicated test cases.38-47: A new section has been added to display duplicated test cases. It is important to ensure that the translation key
artemisApp.programmingExercise.testCaseAnalysis.duplicatedTestCases
is properly set up in the translation files to display the correct message to the user.src/test/javascript/spec/service/programming-exercise-instruction-analysis.service.spec.ts (3)
2-2: The import statement for
problemStatementDuplicatedTestCases
has been added. It's good practice to ensure that only necessary imports are included to avoid bloating the test files.18-22: The
analyzeProblemStatement
method has been correctly updated to includeduplicatedTestCases
in its return object. This aligns with the new feature implementation.43-57: A new test case has been added to ensure that the analysis service correctly identifies duplicated test cases. This is a necessary addition to validate the new functionality.
src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.ts (3)
23-23: The
duplicatedTestCases
array has been added to the component's properties to store any duplicated test cases found during analysis. This is a necessary change to support the new feature.37-37: The
analyzeProblemStatement
method now correctly updates theduplicatedTestCases
property of the component, ensuring that the new feature's state is managed appropriately.66-69: The comment above the
analyzeTasks
method has been updated to include the detection of duplicated test cases. This is a good practice to keep the documentation in sync with the code changes.src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.service.ts (6)
13-13: The new constant
DUPLICATED_TEST_CASE_TRANSLATION
has been added for the translation of duplicated test case issues. It's important to ensure that this constant is used consistently throughout the service.34-37: The
analyzeProblemStatement
method has been updated to includeduplicatedTestCases
in the return object, which is necessary for the new feature to function correctly.60-60: The
analyzeTestCases
method now includes logic to detect duplicated test cases, which is a crucial part of the new feature. It's important to ensure that the logic correctly identifies duplicates without false positives.72-87: The logic to accumulate and analyze duplicated test cases has been added. This includes creating a map of test case occurrences and filtering out those with multiple line numbers to identify duplicates. It's important to ensure that this logic is robust and handles edge cases correctly.
123-124: The
getTranslationByIssueType
method has been updated to handle the newDUPLICATED_TEST_CASES
issue type. This ensures that the correct translation is used when reporting duplicated test cases.137-137: The
extractRegexFromTasks
method has been adjusted to handle the changes in theanalyzeTestCases
method. This ensures that the regex extraction logic is in line with the new feature requirements.src/test/javascript/spec/component/programming-exercise/programming-exercise-instruction-analysis.component.spec.ts (6)
77-77: The
duplicatedTestCases
array has been added to the test setup. This is necessary to test the component's handling of duplicated test cases.79-84: The
analyzeProblemStatementStub
mock has been updated to returnduplicatedTestCases
. This ensures that the component's behavior with duplicated test cases can be tested.98-98: The test now includes an assertion to check the
duplicatedTestCases
property, ensuring that the component correctly updates its state based on the analysis service's output.132-132: The
duplicatedTestCases
array has been added to the test setup for a new test case. This test case should verify the component's rendering behavior when duplicated test cases are present.146-162: The test case has been updated to include assertions for
duplicatedTestCases
. This ensures that the component's rendering behavior is correct when duplicated test cases are detected.179-179: The test includes an assertion to check the
duplicatedTestCases
property after rendering, ensuring that the component's internal state reflects the analysis service's output.src/main/webapp/app/exercises/programming/manage/instructions-editor/programming-exercise-editable-instruction.component.ts (2)
228-231: The
mapAnalysisToWarnings
method has been updated to handle a new parameterduplicatedTestCases
. Ensure that the method correctly processes the new parameter and that the annotations are set appropriately.234-245: The
mapIssuesToAnnotations
method now includes logic for handlingduplicatedTestCases
. Verify that the annotations for duplicated test cases are created correctly and that the warning message is appropriate and informative.
86ffb59
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (3)
- src/main/webapp/i18n/de/programmingExercise.json
- src/main/webapp/i18n/en/programmingExercise.json
- src/test/javascript/spec/helpers/sample/problemStatement.json
Files selected for processing (7)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.html (2 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.ts (3 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.model.ts (1 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.service.ts (6 hunks)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/programming-exercise-editable-instruction.component.ts (1 hunks)
- src/test/javascript/spec/component/programming-exercise/programming-exercise-instruction-analysis.component.spec.ts (6 hunks)
- src/test/javascript/spec/service/programming-exercise-instruction-analysis.service.spec.ts (3 hunks)
Additional comments: 23
src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.model.ts (2)
6-6: The addition of the
repeatedTestCases
property to theProblemStatementAnalysis
type aligns with the PR's objective to handle duplicated test cases. This change is consistent and correctly implemented.12-12: The new enum value
REPEATED_TEST_CASES
added toProblemStatementIssue
is consistent with the changes and the PR's objectives. It is correctly implemented.src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.html (2)
2-2: The new condition added to check for the presence of
repeatedTestCases
is consistent with the feature's requirements. It ensures that the warning for duplicated test cases will be displayed when necessary.38-47: The HTML segment added to display the repeated test cases and their count is correctly implemented. It uses Angular's structural directives and pipes as expected in the Angular framework, and it adheres to the PR's objectives.
src/test/javascript/spec/service/programming-exercise-instruction-analysis.service.spec.ts (4)
2-2: The import statement for
problemStatementRepeatedTestCases
is added to support the new test cases for duplicated test cases. This is a necessary change for the test setup.18-22: The test case 'should analyse problem statement without any issues correctly' now includes a check for
repeatedTestCases
. This is a necessary addition to ensure that the new functionality is covered by tests.35-41: The test case 'should analyse problem statement with issues correctly' has been updated to include
repeatedTestCases
. This ensures that the service's behavior is correctly tested when there are no duplicated test cases.43-57: The new test case 'should analyse problem statement with duplicated test cases' is correctly implemented to test the analysis of problem statements with duplicated test cases. It verifies that the service correctly identifies and returns the duplicated test cases.
src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.ts (3)
23-23: The addition of the
repeatedTestCases
array to store duplicated test cases is consistent with the feature's requirements and is correctly implemented.37-44: The modifications to the
ngOnInit
method to handlerepeatedTestCases
are correct. The method now properly updates the component's state with the results from the analysis service, including the new duplicated test cases feature.66-69: The comment block has been updated to include 'having duplicated test cases' as a possible error. This update is necessary for code clarity and maintainability.
src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.service.ts (5)
13-13: The addition of the
REPEATED_TEST_CASE_TRANSLATION
constant is necessary for the translation of the new repeated test cases issue type. This change is correctly implemented.34-37: The
analyzeProblemStatement
method has been updated to returnrepeatedTestCases
in addition to the existing return values. This change is necessary to support the new feature and is correctly implemented.69-90: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [44-87]
The
analyzeTestCases
method has been significantly modified to include the detection of duplicated test cases. The logic for identifying and handling repeated test cases is correctly implemented and aligns with the PR's objectives.
122-123: The
getTranslationForIssueType
method has been updated to handle the new issue typeREPEATED_TEST_CASES
. This change is necessary for the translation functionality to work with the new issue type.136-136: The removal of
uniq
from thecleanMatches
function is necessary to allow duplicates to be detected later in the analysis process. This change is correctly implemented.src/test/javascript/spec/component/programming-exercise/programming-exercise-instruction-analysis.component.spec.ts (5)
77-84: The addition of the
repeatedTestCases
array and its handling in the component's logic and tests is correctly implemented. This ensures that the new feature is properly tested.98-98: The test case now correctly checks for the presence of
repeatedTestCases
in the component's state, ensuring that the new feature works as expected.112-112: The test case correctly checks for the presence of
repeatedTestCases
after changes to the problem statement, ensuring that the component updates its state correctly.132-132: The addition of the
repeatedTestCases
array within theAnalysis service integration test
block is necessary for testing the integration with the analysis service.140-165: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [146-179]
The test case 'should render warnings on missing, invalid and repeated test cases' has been correctly updated to include the handling of
repeatedTestCases
. This ensures that the component's rendering logic is tested for the new feature.src/main/webapp/app/exercises/programming/manage/instructions-editor/programming-exercise-editable-instruction.component.ts (2)
229-231: The
mapAnalysisToWarnings
method has been updated to handle therepeatedTestCases
parameter. This change is necessary to map the new duplicated test cases analysis to warnings in the editor.234-245: The
mapIssuesToAnnotations
method has been correctly modified to accommodate therepeatedTestCases
parameter and add annotations for it. This ensures that the editor will display warnings for duplicated test cases.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.ts (3 hunks)
- src/test/javascript/spec/service/programming-exercise-instruction-analysis.service.spec.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.component.ts
- src/test/javascript/spec/service/programming-exercise-instruction-analysis.service.spec.ts
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (2)
- src/main/webapp/i18n/de/programmingExercise.json
- src/main/webapp/i18n/en/programmingExercise.json
Files selected for processing (1)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.service.ts (6 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/webapp/app/exercises/programming/manage/instructions-editor/analysis/programming-exercise-instruction-analysis.service.ts
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.
manually tested on legacy ts11, works as expected
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.
code
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.
Manually tested on ts11_Legacy. Works as expected!
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.
Manually tested on TS2_Legacy
Works as described 👍🏼
Feature
: Add a warning for duplicated test cases in the problem statementProgramming exercises
: Add a warning for duplicated test cases in the problem statement
Checklist
General
Client
Motivation and Context
There was a problem with duplicated test cases in the problem statement. #7736
The backend part was already implemented, but in the issue it was mentioned, that a warning in the problem statement should also be shown, that test cases are duplicated.
Steps for Testing
Prerequisites:
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Review Progress
Performance Review
Code Review
Manual Tests
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
duplicatedTestCases
field for better tracking and reporting.Tests