-
Notifications
You must be signed in to change notification settings - Fork 294
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 C++ programming language template
#9261
Conversation
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
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.
I'll just leave my comments here as the author of the original exercise:
I think for easier reviewing of the actual exercise file, it might make sense to rewrite the history a bit, and introduce an initial commit based on the C language test scripts, and then add the changes from the C++ language again. Then reviewers can take a look only at the commits after the initial one to see what was changed.
src/main/resources/templates/c_plus_plus/exercise/.clang-format
Outdated
Show resolved
Hide resolved
src/main/resources/templates/c_plus_plus/exercise/CMakeLists.txt
Outdated
Show resolved
Hide resolved
69a009c
to
bfdb0e6
Compare
bfdb0e6
to
1c44ee2
Compare
I rewrote the history to be easier to compare to the C template |
WalkthroughThis pull request introduces several modifications across multiple files, primarily focusing on enhancing support for the C++ programming language in the plagiarism detection system. Changes include updates to dependency management in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🧰 Additional context used🔇 Additional comments (5)
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 63
Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Files ignored due to path filters (2)
src/main/resources/config/application.yml
is excluded by!**/*.yml
src/main/resources/templates/aeolus/c_plus_plus/default.yaml
is excluded by!**/*.yaml
Files selected for processing (48)
- build.gradle (1 hunks)
- docs/user/exercises/programming-exercise-features.inc (2 hunks)
- src/main/java/de/tum/cit/aet/artemis/plagiarism/service/ProgrammingPlagiarismDetectionService.java (2 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingLanguage.java (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/TemplateUpgradePolicyService.java (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/ci/ContinuousIntegrationService.java (2 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/gitlabci/GitLabCIProgrammingLanguageFeatureService.java (2 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/JenkinsProgrammingLanguageFeatureService.java (2 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/build_plan/JenkinsBuildPlanService.java (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java (2 hunks)
- src/main/resources/templates/aeolus/c_plus_plus/default.sh (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/.clang-format (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/.gitattributes (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/.gitignore (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/CMakeLists.txt (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/include/sort.hpp (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/src/main.cpp (1 hunks)
- src/main/resources/templates/c_plus_plus/exercise/src/sort.cpp (1 hunks)
- src/main/resources/templates/c_plus_plus/readme (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/.clang-format (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/.gitattributes (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/.gitignore (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/CMakeLists.txt (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/include/sort.hpp (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/src/main.cpp (1 hunks)
- src/main/resources/templates/c_plus_plus/solution/src/sort.cpp (1 hunks)
- src/main/resources/templates/c_plus_plus/test/.clang-format (1 hunks)
- src/main/resources/templates/c_plus_plus/test/.gitattributes (1 hunks)
- src/main/resources/templates/c_plus_plus/test/.gitignore (1 hunks)
- src/main/resources/templates/c_plus_plus/test/CMakeLists.txt (1 hunks)
- src/main/resources/templates/c_plus_plus/test/Tests.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/src/sort-test.cpp (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/AbstractProgramTest.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/AbstractTest.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/TestFailedError.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/Tester.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/Utils.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/junit/Junit.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/junit/TestCase.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/testUtils/junit/TestSuite.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/tests/TestCatch2.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/tests/TestClangFormat.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/tests/TestCompile.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/tests/TestConfigure.py (1 hunks)
- src/main/resources/templates/c_plus_plus/test/tests/TestOutput.py (1 hunks)
- src/main/resources/templates/gitlabci/c_plus_plus/regularRuns/.gitlab-ci.yml (1 hunks)
- src/main/resources/templates/jenkins/c_plus_plus/regularRuns/pipeline.groovy (1 hunks)
- src/main/webapp/app/entities/programming/programming-exercise.model.ts (1 hunks)
Additional context used
Path-based instructions (9)
src/main/java/de/tum/cit/aet/artemis/plagiarism/service/ProgrammingPlagiarismDetectionService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingLanguage.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/TemplateUpgradePolicyService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/ci/ContinuousIntegrationService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/gitlabci/GitLabCIProgrammingLanguageFeatureService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/JenkinsProgrammingLanguageFeatureService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/build_plan/JenkinsBuildPlanService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/webapp/app/entities/programming/programming-exercise.model.ts (1)
Learnings (3)
src/main/java/de/tum/cit/aet/artemis/programming/service/TemplateUpgradePolicyService.java (1)
Learnt from: magaupp PR: ls1intum/Artemis#9074 File: src/main/java/de/tum/in/www1/artemis/service/programming/TemplateUpgradePolicyService.java:35-35 Timestamp: 2024-07-16T20:00:50.653Z Learning: The `defaultRepositoryUpgradeService` in the `TemplateUpgradePolicyService` is used as a default for all non-JAVA languages, with specialized services added based on testing outcomes if necessary.
src/main/java/de/tum/cit/aet/artemis/programming/service/gitlabci/GitLabCIProgrammingLanguageFeatureService.java (1)
Learnt from: magaupp PR: ls1intum/Artemis#8802 File: src/main/java/de/tum/in/www1/artemis/service/connectors/gitlabci/GitLabCIProgrammingLanguageFeatureService.java:24-24 Timestamp: 2024-06-29T14:49:34.001Z Learning: Static code analysis for Rust in GitLab CI will be added in a follow-up PR.
src/main/resources/templates/jenkins/c_plus_plus/regularRuns/pipeline.groovy (1)
Learnt from: magaupp PR: ls1intum/Artemis#8802 File: src/main/resources/templates/jenkins/rust/regularRuns/pipeline.groovy:18-20 Timestamp: 2024-07-01T10:47:44.484Z Learning: In the Artemis project, Docker operation failures within the `testRunner` function have not been reported, indicating a stable implementation.
Shellcheck
src/main/resources/templates/aeolus/c_plus_plus/default.sh
[info] 37-37: Not following: /venv/bin/activate was not specified as input (see shellcheck -x).
(SC1091)
cppcheck
src/main/resources/templates/c_plus_plus/exercise/src/sort.cpp
[style] 5-5: The function 'selection_sort' is never used.
(unusedFunction)
[style] 10-10: The function 'insertion_sort' is never used.
(unusedFunction)
[style] 15-15: The function 'quicksort' is never used.
(unusedFunction)
[style] 20-20: The function 'mergesort' is never used.
(unusedFunction)
[style] 25-25: The function 'mergesort_inplace' is never used.
(unusedFunction)
[style] 30-30: The function 'heapsort' is never used.
(unusedFunction)
[style] 35-35: The function 'heapsort_explicit' is never used.
(unusedFunction)
[style] 40-40: The function 'bogosort' is never used.
(unusedFunction)
src/main/resources/templates/c_plus_plus/solution/src/sort.cpp
[style] 7-7: The function 'selection_sort' is never used.
(unusedFunction)
[style] 16-16: The function 'insertion_sort' is never used.
(unusedFunction)
[style] 62-62: The function 'heapsort' is never used.
(unusedFunction)
[style] 68-68: The function 'heapsort_explicit' is never used.
(unusedFunction)
[style] 77-77: The function 'bogosort' is never used.
(unusedFunction)
Ruff
src/main/resources/templates/c_plus_plus/test/Tests.py
10-10: Missing return type annotation for public function
main
Add return type annotation:
None
(ANN201)
src/main/resources/templates/c_plus_plus/test/testUtils/AbstractProgramTest.py
23-23: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
23-23: Missing type annotation for
self
in method(ANN101)
23-23: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
24-24: Use
super()
instead ofsuper(__class__, self)
Remove
__super__
parameters(UP008)
29-29: Missing return type annotation for private function
_onTimeout
Add return type annotation:
None
(ANN202)
29-29: Missing type annotation for
self
in method(ANN101)
32-32: Missing return type annotation for private function
_onFailed
Add return type annotation:
None
(ANN202)
32-32: Missing type annotation for
self
in method(ANN101)
35-35: Missing return type annotation for private function
_terminateProgramm
Add return type annotation:
None
(ANN202)
35-35: Missing type annotation for
self
in method(ANN101)
41-41: Missing return type annotation for private function
_progTerminatedUnexpectedly
Add return type annotation:
None
(ANN202)
41-41: Missing type annotation for
self
in method(ANN101)
src/main/resources/templates/c_plus_plus/test/testUtils/AbstractTest.py
36-36: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
36-36: Missing type annotation for
self
in method(ANN101)
36-36: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
51-51: Unnecessary
list
call (rewrite as a literal)Rewrite as a literal
(C408)
56-56: Missing return type annotation for public function
start
Add return type annotation:
None
(ANN201)
56-56: Missing type annotation for
self
in method(ANN101)
75-75: Use explicit conversion flag
Replace with conversion flag
(RUF010)
76-76: Use explicit conversion flag
Replace with conversion flag
(RUF010)
84-84:
datetime.datetime.now()
called without atz
argument(DTZ005)
97-97: Do not catch blind exception:
Exception
(BLE001)
98-98: Use explicit conversion flag
Replace with conversion flag
(RUF010)
107-107: Do not catch blind exception:
Exception
(BLE001)
108-108: Use explicit conversion flag
Replace with conversion flag
(RUF010)
112-112:
datetime.datetime.now()
called without atz
argument(DTZ005)
115-115: Missing return type annotation for private function
__checkTestRequirements
(ANN202)
115-115: Missing type annotation for
self
in method(ANN101)
123-123: Missing return type annotation for private function
__timeout
(ANN202)
123-123: Missing type annotation for
self
in method(ANN101)
135-135: Missing return type annotation for private function
__raiseTimeout
Add return type annotation:
NoReturn
(ANN202)
135-135: Missing type annotation for
self
in method(ANN101)
135-135: Unused method argument:
sigNum
(ARG002)
135-135: Missing type annotation for function argument
frame
(ANN001)
135-135: Unused method argument:
frame
(ARG002)
139-139: Missing return type annotation for private function
_failWith
Add return type annotation:
NoReturn
(ANN202)
139-139: Missing type annotation for
self
in method(ANN101)
147-147: Avoid specifying long messages outside the exception class
(TRY003)
149-149: Missing return type annotation for private function
__markAsFailed
Add return type annotation:
None
(ANN202)
149-149: Missing type annotation for
self
in method(ANN101)
160-160: Missing return type annotation for private function
_timeout
Add return type annotation:
None
(ANN202)
160-160: Missing type annotation for
self
in method(ANN101)
172-172: Missing return type annotation for private function
__loadFileContent
(ANN202)
172-172: Missing type annotation for
self
in method(ANN101)
177-177: Unnecessary open mode parameters
Remove open mode parameters
(UP015)
177-177: Use a context manager for opening files
(SIM115)
183-183: Missing return type annotation for private function
_loadFullStdout
(ANN202)
183-183: Missing type annotation for
self
in method(ANN101)
190-190: Missing return type annotation for private function
_loadFullStderr
(ANN202)
190-190: Missing type annotation for
self
in method(ANN101)
198-198: Missing return type annotation for private function
_initOutputDirectory
Add return type annotation:
None
(ANN202)
198-198: Missing type annotation for
self
in method(ANN101)
207-207: Missing return type annotation for private function
_getOutputPath
(ANN202)
207-207: Missing type annotation for
self
in method(ANN101)
212-212: Probable insecure usage of temporary file or directory: "/tmp"
(S108)
214-214: Missing return type annotation for private function
_getStdoutFilePath
(ANN202)
214-214: Missing type annotation for
self
in method(ANN101)
221-221: Missing return type annotation for private function
_getStderrFilePath
(ANN202)
221-221: Missing type annotation for
self
in method(ANN101)
228-228: Missing return type annotation for private function
_createPWrap
(ANN202)
228-228: Missing type annotation for
self
in method(ANN101)
235-235: Missing return type annotation for private function
_startPWrap
Add return type annotation:
None
(ANN202)
235-235: Missing type annotation for
self
in method(ANN101)
254-254: Missing return type annotation for private function
_run
(ANN202)
254-254: Missing type annotation for
self
in method(ANN101)
258-258: Unnecessary
pass
statementRemove unnecessary
pass
(PIE790)
261-261: Missing return type annotation for private function
_onTimeout
(ANN202)
261-261: Missing type annotation for
self
in method(ANN101)
266-266: Unnecessary
pass
statementRemove unnecessary
pass
(PIE790)
269-269: Missing return type annotation for private function
_onFailed
(ANN202)
269-269: Missing type annotation for
self
in method(ANN101)
274-274: Unnecessary
pass
statementRemove unnecessary
pass
(PIE790)
src/main/resources/templates/c_plus_plus/test/testUtils/TestFailedError.py
6-6: Unnecessary
pass
statementRemove unnecessary
pass
(PIE790)
src/main/resources/templates/c_plus_plus/test/testUtils/Tester.py
17-17: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
17-17: Missing type annotation for
self
in method(ANN101)
21-21: Unnecessary
dict
call (rewrite as a literal)Rewrite as a literal
(C408)
23-23: Missing return type annotation for public function
run
Add return type annotation:
None
(ANN201)
23-23: Missing type annotation for
self
in method(ANN101)
33-33: Unnecessary
dict
call (rewrite as a literal)Rewrite as a literal
(C408)
57-57: Missing return type annotation for public function
addTest
Add return type annotation:
None
(ANN201)
57-57: Missing type annotation for
self
in method(ANN101)
63-63: Avoid specifying long messages outside the exception class
(TRY003)
66-66: Missing return type annotation for private function
__printResult
Add return type annotation:
None
(ANN202)
66-66: Missing type annotation for
self
in method(ANN101)
75-75: Missing return type annotation for public function
exportResult
Add return type annotation:
None
(ANN201)
75-75: Missing type annotation for
self
in method(ANN101)
src/main/resources/templates/c_plus_plus/test/testUtils/Utils.py
15-15: Missing return type annotation for public function
studSaveStrComp
(ANN201)
15-15: Boolean-typed positional argument in function definition
(FBT001)
15-15: Boolean default positional argument in function definition
(FBT002)
15-15: Boolean-typed positional argument in function definition
(FBT001)
15-15: Boolean default positional argument in function definition
(FBT002)
15-15: Boolean default positional argument in function definition
(FBT002)
15-15: Missing type annotation for function argument
ignoreNonAlNum
(ANN001)
40-40: Missing return type annotation for public function
recursive_chmod
Add return type annotation:
None
(ANN201)
62-62: Missing return type annotation for public function
resetStdoutLimit
Add return type annotation:
None
(ANN201)
70-70: Missing return type annotation for public function
setStdoutLimitEnabled
Add return type annotation:
None
(ANN201)
70-70: Boolean-typed positional argument in function definition
(FBT001)
79-79: Missing return type annotation for private function
__printStdout
Add return type annotation:
None
(ANN202)
100-100: Unnecessary
list
call (rewrite as a literal)Rewrite as a literal
(C408)
103-103: Missing return type annotation for public function
clearTesterOutputCache
Add return type annotation:
None
(ANN201)
110-110: Missing return type annotation for public function
getTesterOutput
(ANN201)
117-117:
datetime.datetime.now()
called without atz
argument(DTZ005)
120-120: Missing return type annotation for private function
__getCurSeconds
(ANN202)
124-124:
datetime.datetime.now()
called without atz
argument(DTZ005)
128-128: Missing return type annotation for private function
__getCurDateTimeStr
(ANN202)
132-132:
datetime.datetime.now()
called without atz
argument(DTZ005)
135-135: Missing return type annotation for public function
printTester
Add return type annotation:
None
(ANN201)
135-135: Boolean-typed positional argument in function definition
(FBT001)
135-135: Boolean default positional argument in function definition
(FBT002)
147-147: Missing return type annotation for public function
printProg
Add return type annotation:
None
(ANN201)
147-147: Boolean-typed positional argument in function definition
(FBT001)
147-147: Boolean default positional argument in function definition
(FBT002)
159-159: Missing return type annotation for public function
shortenText
(ANN201)
168-168: Ambiguous variable name:
l
(E741)
171-171: Unnecessary
else
afterreturn
statementRemove unnecessary
else
(RET505)
172-172: Boolean positional value in function call
(FBT003)
189-189: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
189-189: Missing type annotation for
self
in method(ANN101)
192-192: Use a context manager for opening files
(SIM115)
199-199: Missing return type annotation for public function
fileno
(ANN201)
199-199: Missing type annotation for
self
in method(ANN101)
202-202: Missing return type annotation for public function
join
Add return type annotation:
None
(ANN201)
202-202: Missing type annotation for
self
in method(ANN101)
202-202: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
214-214: Missing return type annotation for staticmethod
__isFdValid
Add return type annotation:
bool
(ANN205)
222-222: Missing return type annotation for staticmethod
__decode
(ANN205)
239-239: Missing return type annotation for public function
run
Add return type annotation:
None
(ANN201)
239-239: Missing type annotation for
self
in method(ANN101)
263-263: Missing return type annotation for public function
canReadLine
(ANN201)
263-263: Missing type annotation for
self
in method(ANN101)
266-266: Missing return type annotation for private function
__cache
Add return type annotation:
None
(ANN202)
266-266: Missing type annotation for
self
in method(ANN101)
267-267: Boolean positional value in function call
(FBT003)
269-269: Missing return type annotation for public function
readLine
(ANN201)
269-269: Missing type annotation for
self
in method(ANN101)
292-292: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
292-292: Missing type annotation for
self
in method(ANN101)
292-292: Probable insecure usage of temporary file or directory: "/tmp/stdout.txt"
(S108)
292-292: Probable insecure usage of temporary file or directory: "/tmp/stderr.txt"
(S108)
296-296: Use a context manager for opening files
(SIM115)
297-297: Use a context manager for opening files
(SIM115)
304-304: Missing return type annotation for special method
__del__
Add return type annotation:
None
(ANN204)
304-304: Missing type annotation for
self
in method(ANN101)
318-318: Missing return type annotation for public function
start
Add return type annotation:
None
(ANN201)
318-318: Missing type annotation for
self
in method(ANN101)
350-350:
subprocess
call: check for execution of untrusted input(S603)
362-362:
subprocess
call: check for execution of untrusted input(S603)
372-372: Missing return type annotation for private function
__demote
(ANN202)
372-372: Missing type annotation for
self
in method(ANN101)
377-377: Missing return type annotation for private function
result
Add return type annotation:
None
(ANN202)
386-386: Missing return type annotation for staticmethod
__checkForRootPrivileges
Add return type annotation:
None
(ANN205)
392-392: Avoid specifying long messages outside the exception class
(TRY003)
394-394: Missing return type annotation for private function
__printIds
Add return type annotation:
None
(ANN202)
394-394: Missing type annotation for
self
in method(ANN101)
397-397: Missing return type annotation for private function
__readLine
(ANN202)
397-397: Missing type annotation for
self
in method(ANN101)
397-397: Boolean-typed positional argument in function definition
(FBT001)
417-417: Missing return type annotation for public function
readLineStdout
(ANN201)
417-417: Missing type annotation for
self
in method(ANN101)
417-417: Boolean-typed positional argument in function definition
(FBT001)
417-417: Boolean default positional argument in function definition
(FBT002)
428-428: Missing return type annotation for public function
canReadLineStdout
(ANN201)
428-428: Missing type annotation for
self
in method(ANN101)
434-434: Missing return type annotation for public function
readLineStderr
(ANN201)
434-434: Missing type annotation for
self
in method(ANN101)
434-434: Boolean-typed positional argument in function definition
(FBT001)
434-434: Boolean default positional argument in function definition
(FBT002)
445-445: Missing return type annotation for public function
canReadLineStderr
(ANN201)
445-445: Missing type annotation for
self
in method(ANN101)
451-451: Missing return type annotation for public function
writeStdin
Add return type annotation:
None
(ANN201)
451-451: Missing type annotation for
self
in method(ANN101)
458-458: Missing return type annotation for public function
hasTerminated
Add return type annotation:
bool
(ANN201)
458-458: Missing type annotation for
self
in method(ANN101)
467-467: Unnecessary
elif
afterreturn
statementRemove unnecessary
elif
(RET505)
469-469:
datetime.datetime.now()
called without atz
argument(DTZ005)
472-472:
datetime.datetime.now()
called without atz
argument(DTZ005)
475-475: Missing return type annotation for public function
getReturnCode
(ANN201)
475-475: Missing type annotation for
self
in method(ANN101)
481-481: Missing return type annotation for public function
waitUntilTerminationReading
Add return type annotation:
Optional[bool]
(ANN201)
481-481: Missing type annotation for
self
in method(ANN101)
494-494:
datetime.datetime.now()
called without atz
argument(DTZ005)
498-498: Unnecessary
elif
afterreturn
statementRemove unnecessary
elif
(RET505)
498-498:
datetime.datetime.now()
called without atz
argument(DTZ005)
500-500: Boolean positional value in function call
(FBT003)
503-503: Missing return type annotation for public function
kill
Add return type annotation:
bool
(ANN201)
503-503: Missing type annotation for
self
in method(ANN101)
517-517: Consider moving this statement to an
else
block(TRY300)
522-522: Missing return type annotation for public function
cleanup
Add return type annotation:
None
(ANN201)
522-522: Missing type annotation for
self
in method(ANN101)
531-531: Missing return type annotation for public function
getPID
(ANN201)
531-531: Missing type annotation for
self
in method(ANN101)
src/main/resources/templates/c_plus_plus/test/testUtils/junit/Junit.py
13-13: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
13-13: Missing type annotation for
self
in method(ANN101)
17-17: Missing return type annotation for public function
toXml
Add return type annotation:
None
(ANN201)
17-17: Missing type annotation for
self
in method(ANN101)
29-29: Missing return type annotation for staticmethod
createOutputPath
Add return type annotation:
None
(ANN205)
src/main/resources/templates/c_plus_plus/test/testUtils/junit/TestCase.py
25-25: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
25-25: Missing type annotation for
self
in method(ANN101)
35-35: Missing return type annotation for public function
toXml
Add return type annotation:
None
(ANN201)
35-35: Missing type annotation for
self
in method(ANN101)
35-35: Missing type annotation for function argument
maxCharsPerOutput
(ANN001)
52-52: Missing return type annotation for public function
genErrFailureMessage
(ANN201)
52-52: Missing type annotation for
self
in method(ANN101)
52-52: Missing type annotation for function argument
maxChars
(ANN001)
src/main/resources/templates/c_plus_plus/test/testUtils/junit/TestSuite.py
19-19: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
19-19: Missing type annotation for
self
in method(ANN101)
22-22: Unnecessary
dict
call (rewrite as a literal)Rewrite as a literal
(C408)
30-30: Missing return type annotation for public function
addCase
Add return type annotation:
None
(ANN201)
30-30: Missing type annotation for
self
in method(ANN101)
44-44: Missing return type annotation for public function
toXml
(ANN201)
44-44: Missing type annotation for
self
in method(ANN101)
src/main/resources/templates/c_plus_plus/test/tests/TestCatch2.py
10-10: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
10-10: Missing type annotation for
self
in method(ANN101)
10-10: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
11-11: Use
super()
instead ofsuper(__class__, self)
Remove
__super__
parameters(UP008)
13-13: Missing return type annotation for private function
_run
Add return type annotation:
None
(ANN202)
13-13: Missing type annotation for
self
in method(ANN101)
23-23: Using
xml
to parse untrusted data is known to be vulnerable to XML attacks; usedefusedxml
equivalents(S314)
27-27: Do not catch blind exception:
Exception
(BLE001)
28-28: Use explicit conversion flag
Replace with conversion flag
(RUF010)
29-29: Unnecessary
pass
statementRemove unnecessary
pass
(PIE790)
33-33: Trailing comma missing
Add trailing comma
(COM812)
src/main/resources/templates/c_plus_plus/test/tests/TestClangFormat.py
16-16: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
17-17: Missing type annotation for
self
in method(ANN101)
20-20: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
23-23: Use
super()
instead ofsuper(__class__, self)
Remove
__super__
parameters(UP008)
24-24: Trailing comma missing
Add trailing comma
(COM812)
29-29: Missing return type annotation for private function
_run
Add return type annotation:
None
(ANN202)
29-29: Missing type annotation for
self
in method(ANN101)
31-31: Trailing comma missing
Add trailing comma
(COM812)
40-40: Trailing comma missing
Add trailing comma
(COM812)
44-44: Use a context manager for opening files
(SIM115)
52-52: Trailing comma missing
Add trailing comma
(COM812)
src/main/resources/templates/c_plus_plus/test/tests/TestCompile.py
14-14: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
15-15: Missing type annotation for
self
in method(ANN101)
18-18: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
21-21: Use
super()
instead ofsuper(__class__, self)
Remove
__super__
parameters(UP008)
22-22: Trailing comma missing
Add trailing comma
(COM812)
26-26: Missing return type annotation for private function
_run
Add return type annotation:
None
(ANN202)
26-26: Missing type annotation for
self
in method(ANN101)
36-36: Use explicit conversion flag
Replace with conversion flag
(RUF010)
36-36: Trailing comma missing
Add trailing comma
(COM812)
src/main/resources/templates/c_plus_plus/test/tests/TestConfigure.py
16-16: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
17-17: Missing type annotation for
self
in method(ANN101)
20-20: Do not use mutable data structures for argument defaults
Replace with
None
; initialize within function(B006)
21-21: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
24-24: Use
super()
instead ofsuper(__class__, self)
Remove
__super__
parameters(UP008)
25-25: Trailing comma missing
Add trailing comma
(COM812)
30-30: Missing return type annotation for private function
_run
Add return type annotation:
None
(ANN202)
30-30: Missing type annotation for
self
in method(ANN101)
35-36: Consider iterable unpacking instead of concatenation
Replace with iterable unpacking
(RUF005)
36-36: Trailing comma missing
Add trailing comma
(COM812)
45-45: Use explicit conversion flag
Replace with conversion flag
(RUF010)
45-45: Trailing comma missing
Add trailing comma
(COM812)
src/main/resources/templates/c_plus_plus/test/tests/TestOutput.py
9-9: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
9-9: Missing type annotation for
self
in method(ANN101)
9-9: PEP 484 prohibits implicit
Optional
Convert to
Optional[T]
(RUF013)
10-10: Use
super()
instead ofsuper(__class__, self)
Remove
__super__
parameters(UP008)
12-12: Missing return type annotation for private function
_run
Add return type annotation:
None
(ANN202)
12-12: Missing type annotation for
self
in method(ANN101)
28-28: Unnecessary
else
afterbreak
statementRemove unnecessary
else
(RET508)
Additional comments not posted (92)
src/main/resources/templates/c_plus_plus/exercise/.gitignore (1)
1-4
: LGTM!The
.gitignore
file is set up correctly for a C++ project using CMake. It ignores the appropriate build output and IDE-specific directories.src/main/resources/templates/c_plus_plus/solution/.gitignore (1)
1-4
: LGTM!The
.gitignore
file looks good for a basic C++ project using CMake. It correctly ignores the CMake build output directories and IDE-specific directories.src/main/resources/templates/c_plus_plus/exercise/.clang-format (1)
1-4
: Configuration looks good based on the previous discussion.The choice of the Google style with the preservation of include blocks is a reasonable configuration for the project's C++ code. It provides a consistent and widely recognized style while handling
.hpp
includes correctly.src/main/resources/templates/c_plus_plus/solution/.clang-format (1)
1-4
: LGTM!The clang-format configuration is valid and follows best practices:
- Using the Google C++ style guide as the base style helps maintain consistency with the widely-used convention.
- Preserving the order of
#include
blocks is generally recommended to avoid potential issues with header file ordering.The configuration is straightforward and should help maintain a consistent code style for the C++ template.
src/main/resources/templates/c_plus_plus/test/.clang-format (1)
1-4
: LGTM!The clang-format configuration looks good:
- Using the Google C++ style guide as the base style ensures consistency with a well-established and widely used style guide in the C++ community.
- Preserving the #include block formatting maintains the existing structure of the #include statements.
This configuration will help maintain a consistent code formatting style across the C++ codebase, improving readability and maintainability.
src/main/resources/templates/c_plus_plus/exercise/src/main.cpp (1)
1-2
: LGTM!The include statement is correct and follows the C++ syntax.
src/main/resources/templates/c_plus_plus/test/.gitignore (1)
1-10
: LGTM!The
.gitignore
file contains standard patterns for excluding common directories and files in a C++ project. This helps keep the repository clean and avoids unnecessary conflicts.The patterns cover:
- Build directories (
assignment
,test-reports
,build
,cmake-build-*
)- IDE-specific directories (
.vscode
,.idea
)- Python cache directory (
__pycache__
)These exclusions ensure that only the necessary source files are version controlled.
src/main/resources/templates/c_plus_plus/exercise/CMakeLists.txt (1)
1-11
: LGTM!The CMake configuration follows best practices and is well-structured. The use of C++20 and the separation of library and executable targets are commendable.
The past review comments regarding the newline issue have been addressed, as confirmed by the author's comment.
src/main/resources/templates/c_plus_plus/solution/CMakeLists.txt (4)
1-2
: LGTM!Setting the minimum CMake version and project name is a good practice. It ensures compatibility and provides a default name for build artifacts.
4-5
: Verify if C++20 features are required.Using C++20 is fine if the project requires its features. However, consider the following:
- Ensure that all developers have access to a compiler that supports C++20.
- Verify if the project's dependencies are compatible with C++20.
- Consider using an older standard if C++20 features are not necessary, to improve compatibility.
7-8
: LGTM!Defining a library target and adding the "include" directory to its include path is a good practice. It promotes code reuse and modularity.
10-11
: LGTM!Defining an executable target and linking it with the "assignment" library is a good practice. It allows creating a runnable program that uses the library's functionality.
src/main/resources/templates/c_plus_plus/test/CMakeLists.txt (4)
1-4
: Great job setting up the CMake project!
- Specifying the minimum CMake version ensures compatibility across different environments.
- Setting C++20 as the required standard allows utilizing modern C++ features.
- The project name "ArtemisTest" clearly conveys the purpose of this configuration.
6-8
: Excellent integration of testing!
- Including CTest allows running tests through CMake, streamlining the testing process.
- Requiring Catch2 sets it up as the testing framework, enabling the creation and execution of tests.
10-10
: Good separation of concerns!Adding the
assignment
subdirectory keeps the implementation code separate from the test code, promoting a clean project structure.
12-14
: Excellent setup for the test executable!
- Creating the
sort-test
executable allows focused testing of specific functionality.- Linking
sort-test
with theassignment
library enables testing the assignment code.- Linking
sort-test
with Catch2 provides the necessary testing framework capabilities.- Adding
sort-test
as a CTest integrates it seamlessly into the CMake testing system.src/main/resources/templates/c_plus_plus/exercise/.gitattributes (1)
1-39
: LGTM!The
.gitattributes
file is well-structured and follows the standard conventions for C++ projects. It covers all the necessary file types and specifies the appropriate attributes for diffing and marking binary files.The file is sourced from a reliable location and is up to date (01.09.2024).
Great job!
src/main/resources/templates/c_plus_plus/solution/.gitattributes (1)
1-39
: LGTM!The
.gitattributes
file follows best practices for C++ projects by:
- Treating source files as text to enable proper version control.
- Treating compiled files as binary to avoid unnecessary diffs and merging issues.
- Providing a comprehensive set of file extensions for C++ projects.
- Sourcing the configuration from a reputable template repository.
The file is well-structured and covers all the necessary file types for a typical C++ project.
src/main/resources/templates/c_plus_plus/test/.gitattributes (1)
1-39
: LGTM!The
.gitattributes
file is well-structured and follows best practices for C++ projects:
- It properly sets
text diff=cpp
for C++ source files to ensure correct diffing and merging.- It marks compiled artifacts as binary files to prevent Git from attempting to merge them as text.
- It credits the source of the configuration, which is a good practice for attribution.
Great job!
src/main/resources/templates/c_plus_plus/exercise/include/sort.hpp (8)
1-2
: Good usage of#pragma once
.The
#pragma once
directive is used appropriately as an include guard to prevent multiple inclusions of the header file during compilation. This is a common and recommended practice in C++ projects.
3-4
: Appropriate inclusion of<vector>
header.The
<vector>
header file is correctly included, which is necessary for using thestd::vector
container class in the code. This is a standard practice when working with vectors in C++.
5-6
: Proper declaration ofselection_sort
function.The
selection_sort
function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within astd::vector<int>
container. The use of iterators provides flexibility in specifying the sorting range. The function declaration adheres to C++ syntax and follows appropriate naming conventions.
8-9
: Proper declaration ofinsertion_sort
function.The
insertion_sort
function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within astd::vector<int>
container. The use of iterators provides flexibility in specifying the sorting range. The function declaration adheres to C++ syntax and follows appropriate naming conventions.
11-12
: Proper declaration ofquicksort
function.The
quicksort
function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within astd::vector<int>
container. The use of iterators provides flexibility in specifying the sorting range. The function declaration adheres to C++ syntax and follows appropriate naming conventions.
14-15
: Proper declaration ofmergesort
function.The
mergesort
function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within astd::vector<int>
container. The use of iterators provides flexibility in specifying the sorting range. The function declaration adheres to C++ syntax and follows appropriate naming conventions.
17-18
: Proper declaration ofmergesort_inplace
function.The
mergesort_inplace
function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within astd::vector<int>
container. The use of iterators provides flexibility in specifying the sorting range. The function declaration adheres to C++ syntax and follows appropriate naming conventions.The name
mergesort_inplace
suggests that this function performs an in-place merge sort, potentially optimizing space complexity compared to the regularmergesort
function. This is a good practice for providing an alternative implementation that considers space efficiency.
20-25
: Proper declaration ofheapsort
,heapsort_explicit
, andbogosort
functions.The
heapsort
,heapsort_explicit
, andbogosort
functions are declared correctly, taking two iterators as parameters to define the range of elements to be sorted within astd::vector<int>
container. The use of iterators provides flexibility in specifying the sorting range. The function declarations adhere to C++ syntax and follow appropriate naming conventions.The name
heapsort_explicit
suggests that it may provide an explicit implementation of the heapsort algorithm, possibly for educational or demonstrative purposes. This can be useful for understanding the inner workings of the algorithm.The name
bogosort
suggests that it may be an implementation of the bogosort algorithm, which is known for its poor performance and is often used as a joke or for educational purposes. It's important to note thatbogosort
has a worst-case time complexity of O(∞) and should not be used in production code.src/main/resources/templates/c_plus_plus/solution/include/sort.hpp (8)
1-2
: Good usage of#pragma once
.The
#pragma once
directive is used correctly as an include guard to prevent multiple inclusions of the header file. This is a good practice to avoid potential issues during compilation.
3-4
: Correct inclusion of the<vector>
header.The
<vector>
header file is correctly included, which is necessary for using thestd::vector
container and its iterator type in the function declarations.
5-6
: Appropriate function declaration forselection_sort
.The
selection_sort
function is declared correctly with iterator parameters, allowing it to work with any container that provides a compatible iterator interface. This is a good approach for a generic implementation of the selection sort algorithm.
8-9
: Appropriate function declaration forinsertion_sort
.The
insertion_sort
function is declared correctly with iterator parameters, allowing it to work with any container that provides a compatible iterator interface. This is a good approach for a generic implementation of the insertion sort algorithm.
11-12
: Appropriate function declaration forquicksort
.The
quicksort
function is declared correctly with iterator parameters, allowing it to work with any container that provides a compatible iterator interface. This is a good approach for a generic implementation of the quicksort algorithm.
14-15
: Appropriate function declaration formergesort
.The
mergesort
function is declared correctly with iterator parameters, allowing it to work with any container that provides a compatible iterator interface. This is a good approach for a generic implementation of the mergesort algorithm.
17-18
: Appropriate function declaration formergesort_inplace
.The
mergesort_inplace
function is declared correctly with iterator parameters, allowing it to work with any container that provides a compatible iterator interface. This is a good approach for a generic implementation of the in-place mergesort algorithm.
20-25
: Appropriate function declarations forheapsort
,heapsort_explicit
, andbogosort
.The
heapsort
,heapsort_explicit
, andbogosort
functions are declared correctly with iterator parameters, allowing them to work with any container that provides a compatible iterator interface. This is a good approach for generic implementations of these sorting algorithms.src/main/resources/templates/c_plus_plus/test/Tests.py (1)
11-30
: LGTM!The test configuration and execution logic is implemented correctly.
src/main/resources/templates/c_plus_plus/test/testUtils/junit/Junit.py (1)
1-33
: LGTM!The rest of the code changes look good to me. The class is well-structured and follows the JUnit XML format specification. The
toXml
method correctly generates the XML report and writes it to the specified output path. ThecreateOutputPath
static method ensures that the output path exists and sets the appropriate permissions.Tools
Ruff
13-13: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
13-13: Missing type annotation for
self
in method(ANN101)
17-17: Missing return type annotation for public function
toXml
Add return type annotation:
None
(ANN201)
17-17: Missing type annotation for
self
in method(ANN101)
29-29: Missing return type annotation for staticmethod
createOutputPath
Add return type annotation:
None
(ANN205)
src/main/resources/templates/c_plus_plus/exercise/src/sort.cpp (8)
5-8
: Skipping review of placeholder implementation.The
selection_sort
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 5-5: The function 'selection_sort' is never used.
(unusedFunction)
10-13
: Skipping review of placeholder implementation.The
insertion_sort
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 10-10: The function 'insertion_sort' is never used.
(unusedFunction)
15-18
: Skipping review of placeholder implementation.The
quicksort
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 15-15: The function 'quicksort' is never used.
(unusedFunction)
20-23
: Skipping review of placeholder implementation.The
mergesort
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 20-20: The function 'mergesort' is never used.
(unusedFunction)
25-28
: Skipping review of placeholder implementation.The
mergesort_inplace
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 25-25: The function 'mergesort_inplace' is never used.
(unusedFunction)
30-33
: Skipping review of placeholder implementation.The
heapsort
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 30-30: The function 'heapsort' is never used.
(unusedFunction)
35-38
: Skipping review of placeholder implementation.The
heapsort_explicit
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 35-35: The function 'heapsort_explicit' is never used.
(unusedFunction)
40-43
: Skipping review of placeholder implementation.The
bogosort
function is a placeholder implementation that throws alogic_error
exception to indicate that it is not implemented. As this is intentional, no changes are necessary at this stage.Tools
cppcheck
[style] 40-40: The function 'bogosort' is never used.
(unusedFunction)
src/main/resources/templates/c_plus_plus/test/tests/TestConfigure.py (1)
8-11
: LGTM!The class definition and docstring are clear and concise.
src/main/resources/templates/aeolus/c_plus_plus/default.sh (2)
4-25
: LGTM!The function sets up the build environment correctly by creating a directory for test reports, updating ownership, and installing dependencies from a requirements file if it exists. The logic is sound and follows common practices.
44-56
: LGTM!The
main
function serves as a proper entry point for the script. It handles the case when the script is being sourced, changes the directory to the initial directory, and calls thesetup_the_build_environment
andbuild_and_run_all_tests
functions correctly. The logic is sound and follows common patterns.src/main/java/de/tum/cit/aet/artemis/programming/service/TemplateUpgradePolicyService.java (1)
35-35
: LGTM!The addition of
C_PLUS_PLUS
to the case statement fordefaultRepositoryUpgradeService
is consistent with the existing pattern of using the default service for non-JAVA languages. This change expands the support for C++ within the upgrade service functionality.src/main/resources/templates/c_plus_plus/test/tests/TestClangFormat.py (1)
8-11
: LGTM!The class structure, inheritance, and docstring are well-defined and clearly describe the purpose of the test case.
src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingLanguage.java (1)
51-53
: LGTM!The changes in the
ENABLED_LANGUAGES
set are valid:
- The order change of the
EMPTY
constant does not affect the functionality.- The addition of the
C_PLUS_PLUS
constant enables C++ as a programming language in the system.The code follows the specified coding guidelines:
- CamelCase naming convention is used for the enum and its constants.
- The enum adheres to the Single Responsibility Principle by only defining the programming languages and their file extensions.
src/main/java/de/tum/cit/aet/artemis/programming/service/gitlabci/GitLabCIProgrammingLanguageFeatureService.java (2)
3-3
: LGTM!The import statement for the
C_PLUS_PLUS
constant is necessary and follows the static import style consistently with other import statements in the file.
31-31
: LGTM!The new entry in the
programmingLanguageFeatures
map for theC_PLUS_PLUS
language follows the existing pattern and expands the functionality to include support for C++. The initialization of theProgrammingLanguageFeature
instance with specific boolean values and an empty list indicates the feature settings for C++. The addition does not alter any existing entries or logic.src/main/resources/templates/jenkins/c_plus_plus/regularRuns/pipeline.groovy (4)
1-13
: LGTM!The header comment provides clear instructions, and the Docker configuration variables are correctly defined.
14-30
: ThetestRunner
function looks good.The
testRunner
function correctly runs the build steps inside a Docker container using the provideddockerImage
anddockerFlags
.Based on the retrieved learning from the Rust template, Docker operation failures within the
testRunner
function have not been reported, indicating a stable implementation.
31-58
: Thetest
function looks good.The "Setup" stage correctly creates the
test-reports
directory, updates ownership, and installs Python dependencies if arequirements.txt
file exists.The "Compile and Test" stage activates the Python virtual environment if it exists and runs the tests as an unprivileged user using a
Tests.py
script, which is a good security practice.
60-80
: ThepostBuildTasks
function and the final comment look good.The shell script in the
postBuildTasks
function correctly handles thetest-reports/tests-results.xml
file and moves thetest-reports
directory toresults
.The comment at the end of the file is important to ensure that Jenkins can find the methods defined in the script.
src/main/resources/templates/c_plus_plus/readme (5)
1-1
: LGTM!Having a test case to validate the CMake setup is a good practice. It ensures that the build system is configured correctly for the project.
2-2
: LGTM!Having a test case to validate that the code compiles successfully is crucial. It catches any compilation errors early in the development process.
3-3
: LGTM!Enforcing code formatting using clang-format is a good practice. It maintains a consistent coding style throughout the project, enhancing readability and maintainability.
7-7
: LGTM!Having a comprehensive test suite using Catch2 to validate the correctness of the sorting algorithms is excellent. It ensures that the algorithms produce the expected results for various input scenarios.
8-15
: LGTM!The project includes a wide range of sorting algorithms, which is great to see. Each algorithm is thoroughly tested against various input scenarios, ensuring their correctness and robustness.
The test cases cover important scenarios such as:
- All elements being equal
- Reverse-sorted values
- Single values
- Empty input
- Large input
Testing the algorithms against these scenarios demonstrates a comprehensive testing approach and increases confidence in their implementation.
src/main/resources/templates/gitlabci/c_plus_plus/regularRuns/.gitlab-ci.yml (5)
1-4
: LGTM!The GitLab CI pipeline stages are defined correctly.
5-41
: LGTM!The
test-job
is defined correctly and follows good practices:
- Uses appropriate variables for configuration.
- Clones the necessary repositories.
- Sets up a Python environment and installs dependencies.
- Runs the tests and sets the build status.
- Saves the necessary artifacts.
42-43
: LGTM!The empty lines are used appropriately for separating sections and improving readability.
44-57
: LGTM!The
upload-job
is defined correctly and follows good practices:
- Uses appropriate variables for configuration.
- Depends on the
test-job
to ensure proper order of execution.- Copies the necessary files for the notification plugin.
- Runs the Gradle command to start the upload process.
1-57
: Great job on the GitLab CI configuration!The
.gitlab-ci.yml
file is well-structured and defines a complete pipeline with two stages:test
andupload
. The jobs are properly configured, use appropriate variables and Docker images, and follow good practices such as setting up dependencies and saving artifacts.Overall, the file is consistent and doesn't have any missing or inconsistent parts. The pipeline should work as expected based on this configuration.
src/main/resources/templates/c_plus_plus/test/testUtils/junit/TestCase.py (2)
8-12
: LGTM!The
Result
enum is well-defined and covers the necessary test case outcomes.
15-75
: TheTestCase
class is well-structured and implements the necessary functionality.The class properly represents a test case and its associated properties, and provides methods to generate XML representation and error/failure messages.
Tools
Ruff
25-25: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
25-25: Missing type annotation for
self
in method(ANN101)
35-35: Missing return type annotation for public function
toXml
Add return type annotation:
None
(ANN201)
35-35: Missing type annotation for
self
in method(ANN101)
35-35: Missing type annotation for function argument
maxCharsPerOutput
(ANN001)
52-52: Missing return type annotation for public function
genErrFailureMessage
(ANN201)
52-52: Missing type annotation for
self
in method(ANN101)
52-52: Missing type annotation for function argument
maxChars
(ANN001)
src/main/resources/templates/c_plus_plus/test/testUtils/Tester.py (1)
11-81
: TheTester
class looks good overall!The class is well-structured and provides essential functionality for managing and running tests. The methods are clearly defined and serve their intended purposes.
Tools
Ruff
17-17: Missing return type annotation for special method
__init__
Add return type annotation:
None
(ANN204)
17-17: Missing type annotation for
self
in method(ANN101)
21-21: Unnecessary
dict
call (rewrite as a literal)Rewrite as a literal
(C408)
23-23: Missing return type annotation for public function
run
Add return type annotation:
None
(ANN201)
23-23: Missing type annotation for
self
in method(ANN101)
33-33: Unnecessary
dict
call (rewrite as a literal)Rewrite as a literal
(C408)
57-57: Missing return type annotation for public function
addTest
Add return type annotation:
None
(ANN201)
57-57: Missing type annotation for
self
in method(ANN101)
63-63: Avoid specifying long messages outside the exception class
(TRY003)
66-66: Missing return type annotation for private function
__printResult
Add return type annotation:
None
(ANN202)
66-66: Missing type annotation for
self
in method(ANN101)
75-75: Missing return type annotation for public function
exportResult
Add return type annotation:
None
(ANN201)
75-75: Missing type annotation for
self
in method(ANN101)
src/main/resources/templates/c_plus_plus/test/src/sort-test.cpp (6)
1-9
: LGTM!The included headers are relevant and necessary for the test file. The code segment looks good.
10-40
: LGTM!The
run_all_algorithms
helper function is a good way to avoid code duplication in the test cases. It covers all the sorting algorithms and uses the Catch2 macros correctly to define sections and check the results. The code segment looks good.
42-47
: LGTM!The test case covers a basic scenario with a small input vector and uses the
run_all_algorithms
helper function correctly to run all sorting algorithms and check the results. The code segment looks good.
49-55
: LGTM!The test case covers a scenario with all elements equal, which is a good edge case to test. The comment provides a clear explanation of the purpose of the test case. The code segment looks good.
57-64
: LGTM!The test case covers a scenario with a reverse-sorted input vector, which is a good edge case to test. The code segment looks good.
66-122
: LGTM!The test cases cover various scenarios, including edge cases like single value and empty input vectors, which is good for testing the robustness of the sorting algorithms. The test case for the large input vector with random values is a good way to test the performance of the sorting algorithms. The test cases for the
bogosort
algorithm are separate from the other sorting algorithms, which is appropriate given its inefficiency for large inputs. The comments provide clear explanations for the purpose of some of the test cases. The code segment looks good.src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/JenkinsProgrammingLanguageFeatureService.java (2)
4-4
: LGTM!The import statement for the
C_PLUS_PLUS
enum value is necessary and follows the naming convention. It is placed correctly along with other similar import statements.
47-47
: LGTM!The addition of the C++ entry in the
programmingLanguageFeatures
map is necessary to support C++ as a programming language in the system. The initialization of theProgrammingLanguageFeature
instance for C++ follows the same pattern as other programming languages and sets the feature flags based on the requirements and capabilities of the system. The empty list passed as an argument suggests that there are no specific project types associated with C++ at the moment, which is acceptable.src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java (2)
6-6
: LGTM!The import statement follows the existing pattern, adheres to the coding guidelines, and is necessary for using the
C_PLUS_PLUS
constant.
55-55
: Looks good!The addition of the C++ entry to the
programmingLanguageFeatures
map follows the existing pattern and adheres to the coding guidelines. The parameters passed to theProgrammingLanguageFeature
constructor seem appropriate for C++.src/main/webapp/app/entities/programming/programming-exercise.model.ts (1)
28-28
: LGTM! Verify the usage of the new enum value.The addition of the
C_PLUS_PLUS
enum value to represent the C++ programming language is consistent with the existing naming convention and aligns with the PR objective.Please ensure that this new enum value is handled correctly throughout the codebase, such as in switch statements, if statements, or any other logic that depends on the
ProgrammingLanguage
enum.Run the following script to verify the enum usage:
src/main/java/de/tum/cit/aet/artemis/programming/service/ci/ContinuousIntegrationService.java (2)
222-223
: LGTM!The addition of
C_PLUS_PLUS
to the list of programming languages that return "assignment" is consistent with the method's purpose and aligns with the behavior of other languages.
233-235
: LGTM!The addition of
C_PLUS_PLUS
to the list of programming languages that return an empty string for the test repository checkout path is consistent with the method's purpose and aligns with the behavior of other languages.docs/user/exercises/programming-exercise-features.inc (2)
40-41
: LGTM!The addition of the C++ row to the programming language templates support table is consistent with the PR objective and summary. The formatting and content of the new row look good.
76-77
: LGTM!The addition of the C++ row to the programming exercise capabilities table is consistent with the PR objective and summary. The capabilities listed for C++ match those of JavaScript, as expected. The formatting and content of the new row look good.
src/main/java/de/tum/cit/aet/artemis/plagiarism/service/ProgrammingPlagiarismDetectionService.java (2)
33-33
: LGTM!The import statement for
CPPLanguage
class is correctly added to support C++ language in the plagiarism detection service. It follows the coding guideline to avoid wildcard imports.
317-317
: Looks good!The new
case
statement forC_PLUS_PLUS
is correctly added to thegetJPlagProgrammingLanguage
method. It instantiates a newCPPLanguage
object, consistent with how other programming languages are handled. This change expands the functionality of the plagiarism detection service to support C++ exercises.src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/build_plan/JenkinsBuildPlanService.java (1)
187-188
: LGTM!The changes to add support for the
C_PLUS_PLUS
programming language in thebuilderFor
method look good. The language has been correctly added to the supported languages that return thejenkinsBuildPlanCreator
, and it has been removed from the list of unsupported languages that throw an exception. The changes are consistent and do not introduce any issues.build.gradle (1)
255-255
: LGTM!The addition of the
de.jplag:cpp
dependency is consistent with the existing pattern and expands the plagiarism detection capabilities to support C++.src/main/resources/templates/c_plus_plus/test/testUtils/AbstractProgramTest.py (2)
29-29
: Update method call to reflect corrected method name.After renaming
_terminateProgramm
to_terminateProgram
, update its call in the_onTimeout
method.Apply this diff:
def _onTimeout(self): - self._terminateProgramm() + self._terminateProgram()Likely invalid or redundant comment.
Tools
Ruff
29-29: Missing return type annotation for private function
_onTimeout
Add return type annotation:
None
(ANN202)
29-29: Missing type annotation for
self
in method(ANN101)
32-32
: Update method call to reflect corrected method name.After renaming
_terminateProgramm
to_terminateProgram
, update its call in the_onFailed
method.Apply this diff:
def _onFailed(self): - self._terminateProgramm() + self._terminateProgram()Likely invalid or redundant comment.
Tools
Ruff
32-32: Missing return type annotation for private function
_onFailed
Add return type annotation:
None
(ANN202)
32-32: Missing type annotation for
self
in method(ANN101)
src/main/resources/templates/c_plus_plus/test/testUtils/AbstractTest.py (1)
212-212
: Avoid insecure usage of hard-coded temporary directoriesUsing hard-coded paths like
"/tmp"
for temporary files can lead to security issues, such as symlink attacks or race conditions. Consider using thetempfile
module to generate secure temporary directories.[security]
Apply this diff:
from os import makedirs, path +import tempfile ... return path.join("/tmp", self.suite.name, self.name) + temp_dir = tempfile.gettempdir() + return path.join(temp_dir, self.suite.name, self.name)Tools
Ruff
212-212: Probable insecure usage of temporary file or directory: "/tmp"
(S108)
src/main/resources/templates/c_plus_plus/test/testUtils/TestFailedError.py
Show resolved
Hide resolved
src/main/resources/templates/c_plus_plus/test/testUtils/junit/Junit.py
Outdated
Show resolved
Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Formatting tests removed and task desciption added
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.
Yes, this is intended. These two tests are for CMake configuration and compilation. |
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.
Checklist
General
Server
Changes affecting Programming Exercises
Motivation and Context
Description
This PR adds C++ as a programming language template. It uses CMake as the build system, Catch2 as the testing framework and the GBS Python scripts from the C template adapted for CMake and Catch2 as the test runner.
Thanks to @upsj for adapting the Python scripts and for providing the example exercise.
This template was created from a copy of the C template. For your reviewing convenience the first commit adds the unmodified copy. You can check the diff to this first commit to see the relevant changes.
The Docker image differs from the C image in that it does not provide passwordless sudo. The build script runs as root and drops privileges after setup.
Dockerfile for
artemis-cpp-docker
:Steps for Testing
Prerequisites:
C++
as the programming languageTemplate
andSolution
build jobs finishTemplate Result
should have passed tests only for configuration and compilationSolution Result
should show 48 out of 48 passed testsTestserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.
Review Progress
Code Review
Manual Tests
Test Coverage
Screenshots
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Documentation
Tests