Skip to content
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

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from

Conversation

magaupp
Copy link
Contributor

@magaupp magaupp commented Sep 1, 2024

Checklist

General

Server

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a local server configured with LocalCI and Jenkins.

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:

FROM ubuntu:24.04

RUN apt-get update && apt-get install -y --no-install-recommends \
  catch2 \
  clang \
  clang-format \
  cmake \
  g++ \
  gcc \
  libclang-rt-dev \
  make \
  python3 \
  python3-pip \
  python3-venv \
  && apt-get dist-clean

RUN useradd -m artemis_user

# drop privileges to artemis_user after setup
USER root

Steps for Testing

Prerequisites:

  • 1 Course
  1. Navigate to the exercise creation page
  2. Select C++ as the programming language
  3. Fill out the rest of the required fields. Keep the default build plan
  4. Generate the exercise
  5. Wait until the Template and Solution build jobs finish
  6. The Template Result should have passed tests only for configuration and compilation
  7. The Solution Result should show 48 out of 48 passed tests

Testserver 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

  • Code Review

Manual Tests

  • Test

Test Coverage

Screenshots

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced support for C++ in the plagiarism detection service and various CI/CD integrations.
    • Enhanced dependency management with the addition of C++ while removing Swift.
    • Implemented a structured README for C++ sorting algorithms, detailing tasks and implementation guidelines.
    • Added a new Python test runner for C++ components, facilitating automated testing.
    • Introduced a new CMake configuration for building and testing C++ projects.
  • Documentation

    • Updated README to include comprehensive information on C++ sorting algorithms and their testing scenarios.
  • Tests

    • Introduced a new test script for executing various C++ project tests and reporting results.
    • Added CMake support for testing with the Catch2 framework.

@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) documentation config-change Pull requests that change the config in a way that they require a deployment via Ansible. template labels Sep 1, 2024
Copy link

github-actions bot commented Sep 8, 2024

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.

@github-actions github-actions bot added the stale label Sep 8, 2024
Copy link

@upsj upsj left a 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.

@github-actions github-actions bot removed the stale label Sep 10, 2024
@magaupp magaupp force-pushed the feature/programming-exercises/cpp-template branch from 69a009c to bfdb0e6 Compare September 15, 2024 23:56
@magaupp
Copy link
Contributor Author

magaupp commented Sep 20, 2024

I rewrote the history to be easier to compare to the C template

@magaupp magaupp marked this pull request as ready for review September 20, 2024 22:06
@magaupp magaupp requested a review from a team as a code owner September 20, 2024 22:06
Copy link

coderabbitai bot commented Sep 20, 2024

Walkthrough

This 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 build.gradle, the addition of C++ support in various service classes, and the restructuring of programming language enums. Additionally, a structured README file for C++ sorting algorithms, a new Python test runner script, and CMake configuration files for testing are introduced.

Changes

File Path Change Summary
build.gradle Updated dependencies to include de.jplag:cpp. Removed de.jplag:swift. Modified test coverage verification and logging configurations. Updated Gradle wrapper version to "8.10.2".
src/main/resources/templates/c_plus_plus/readme Introduced a structured README file for C++ sorting algorithms, detailing tasks and test cases for various algorithms.
src/main/java/de/tum/cit/aet/artemis/plagiarism/service/ProgrammingPlagiarismDetectionService.java Added support for C++ by including CPPLanguage and modifying the getJPlagProgrammingLanguage method.
src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingLanguage.java Modified ENABLED_LANGUAGES enum to add C_PLUS_PLUS.
src/main/java/de/tum/cit/aet/artemis/programming/service/TemplateUpgradePolicyService.java Updated getUpgradeService method to include a case for C_PLUS_PLUS.
src/main/java/de/tum/cit/aet/artemis/programming/service/ci/ContinuousIntegrationService.java Added support for C_PLUS_PLUS in the RepositoryCheckoutPath enum.
src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/JenkinsProgrammingLanguageFeatureService.java Added C_PLUS_PLUS to the programmingLanguageFeatures map.
src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/build_plan/JenkinsBuildPlanService.java Added case for C_PLUS_PLUS in the builderFor method.
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java Added support for C++ and removed duplicate entries for C and Assembler.
src/main/resources/templates/c_plus_plus/test/Tests.py Added a new Python test runner script that manages the execution of tests for the C++ project.
src/main/resources/templates/c_plus_plus/test/.gitignore Introduced a new .gitignore file to specify ignored files and directories for Git.
src/main/resources/templates/c_plus_plus/test/CMakeLists.txt Added a new CMake configuration file for the C++ project, specifying requirements and creating a test executable.
src/main/webapp/app/entities/programming/programming-exercise.model.ts Updated ProgrammingLanguage enum to include C_PLUS_PLUS and reorganized existing entries.

Possibly related PRs

Suggested labels

feature

Suggested reviewers

  • JohannesStoehr
  • SimonEntholzer
  • pzdr7
  • BBesrour
  • krusche
  • EneaGore

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 9ed8fcd and 60b6e39.

📒 Files selected for processing (1)
  • src/main/resources/templates/c_plus_plus/test/CMakeLists.txt (1 hunks)
🧰 Additional context used
🔇 Additional comments (5)
src/main/resources/templates/c_plus_plus/test/CMakeLists.txt (5)

6-8: LGTM! Catch2 version specification implemented.

The inclusion of CTest and finding Catch2 with a specific version is correct and follows best practices. This setup ensures a compatible version of Catch2 is used across different environments, addressing the previous suggestion.


12-13: LGTM! Test executable setup is correct.

The test executable setup is well-structured. Creating the 'sort-test' executable and linking it with the 'assignment' library and Catch2 is appropriate for the test structure. This setup will allow for proper testing of the sorting algorithms using the Catch2 framework.


1-4: 🧹 Nitpick (assertive)

Consider updating CMake version for better C++20 support.

The project setup looks good, and using C++20 is great for modern C++ features. However, CMake 3.13 is relatively old (released in 2018). Consider updating the minimum CMake version to a more recent one (e.g., 3.20+) for better feature support and compatibility with C++20 and newer build environments.

-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.20)

This change will ensure better compatibility with C++20 features and modern CMake practices.


10-10: 🧹 Nitpick (assertive)

Add a check for the subdirectory's existence.

While using a variable for the subdirectory path provides flexibility, it's important to ensure the directory exists to prevent CMake errors. Consider adding a check before including the subdirectory:

if(EXISTS "${studentParentWorkingDirectoryName}")
    add_subdirectory("${studentParentWorkingDirectoryName}")
else()
    message(FATAL_ERROR "Student working directory not found: ${studentParentWorkingDirectoryName}")
endif()

This will provide a clear error message if the directory is missing, making it easier to diagnose configuration issues.


14-14: 🧹 Nitpick (assertive)

Consider adding test properties for better organization.

While adding the test is correct, consider enhancing it with additional properties for better organization and control:

add_test(NAME sort-test COMMAND sort-test)
set_tests_properties(sort-test PROPERTIES
    LABELS "sorting"
    TIMEOUT 10  # Timeout in seconds
)

This allows for better categorization of tests and sets a timeout to prevent infinite loops in student code from hanging the test runner.


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between 0354197 and 1c44ee2.

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_imports

src/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_imports

src/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_imports

src/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_imports

src/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_imports

src/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_imports

src/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_imports

src/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_imports

src/main/webapp/app/entities/programming/programming-exercise.model.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

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 of super(__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 a tz 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 a tz 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 statement

Remove 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 statement

Remove 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 statement

Remove unnecessary pass

(PIE790)

src/main/resources/templates/c_plus_plus/test/testUtils/TestFailedError.py

6-6: Unnecessary pass statement

Remove 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 a tz argument

(DTZ005)


120-120: Missing return type annotation for private function __getCurSeconds

(ANN202)


124-124: datetime.datetime.now() called without a tz argument

(DTZ005)


128-128: Missing return type annotation for private function __getCurDateTimeStr

(ANN202)


132-132: datetime.datetime.now() called without a tz 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 after return statement

Remove 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 after return statement

Remove unnecessary elif

(RET505)


469-469: datetime.datetime.now() called without a tz argument

(DTZ005)


472-472: datetime.datetime.now() called without a tz 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 a tz argument

(DTZ005)


498-498: Unnecessary elif after return statement

Remove unnecessary elif

(RET505)


498-498: datetime.datetime.now() called without a tz 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 of super(__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; use defusedxml 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 statement

Remove 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 of super(__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 of super(__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 of super(__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 of super(__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 after break statement

Remove 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 the assignment 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 the std::vector container class in the code. This is a standard practice when working with vectors in C++.


5-6: Proper declaration of selection_sort function.

The selection_sort function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within a std::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 of insertion_sort function.

The insertion_sort function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within a std::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 of quicksort function.

The quicksort function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within a std::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 of mergesort function.

The mergesort function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within a std::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 of mergesort_inplace function.

The mergesort_inplace function is declared correctly, taking two iterators as parameters to define the range of elements to be sorted within a std::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 regular mergesort function. This is a good practice for providing an alternative implementation that considers space efficiency.


20-25: Proper declaration of heapsort, heapsort_explicit, and bogosort functions.

The heapsort, heapsort_explicit, and bogosort functions are declared correctly, taking two iterators as parameters to define the range of elements to be sorted within a std::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 that bogosort 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 the std::vector container and its iterator type in the function declarations.


5-6: Appropriate function declaration for selection_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 for insertion_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 for quicksort.

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 for mergesort.

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 for mergesort_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 for heapsort, heapsort_explicit, and bogosort.

The heapsort, heapsort_explicit, and bogosort 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. The createOutputPath 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 a logic_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 a logic_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 a logic_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 a logic_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 a logic_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 a logic_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 a logic_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 a logic_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 the setup_the_build_environment and build_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 for defaultRepositoryUpgradeService 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 the C_PLUS_PLUS language follows the existing pattern and expands the functionality to include support for C++. The initialization of the ProgrammingLanguageFeature 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: The testRunner function looks good.

The testRunner function correctly runs the build steps inside a Docker container using the provided dockerImage and dockerFlags.

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: The test function looks good.

The "Setup" stage correctly creates the test-reports directory, updates ownership, and installs Python dependencies if a requirements.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: The postBuildTasks function and the final comment look good.

The shell script in the postBuildTasks function correctly handles the test-reports/tests-results.xml file and moves the test-reports directory to results.

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 and upload. 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: The TestCase 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: The Tester 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 the ProgrammingLanguageFeature 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 the ProgrammingLanguageFeature 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 for C_PLUS_PLUS is correctly added to the getJPlagProgrammingLanguage method. It instantiates a new CPPLanguage 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 the builderFor method look good. The language has been correctly added to the supported languages that return the jenkinsBuildPlanCreator, 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 directories

Using hard-coded paths like "/tmp" for temporary files can lead to security issues, such as symlink attacks or race conditions. Consider using the tempfile 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)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@magaupp magaupp marked this pull request as ready for review October 13, 2024 10:32
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Outside diff range comments (1)
src/main/webapp/app/entities/programming/programming-exercise.model.ts (1)

Line range hint 19-30: LGTM! Consider minor adjustments for consistency and readability.

The addition of C++ support to the ProgrammingLanguage enum is approved and aligns with the PR objectives. However, I have a few suggestions:

  1. For consistency with other language names in the enum, consider using CPP instead of C_PLUS_PLUS. This would make it more aligned with entries like JAVA, PYTHON, etc. Here's the suggested change:
-    C_PLUS_PLUS = 'C_PLUS_PLUS',
+    CPP = 'CPP',
  1. The reordering of enum values doesn't affect functionality, but it might impact readability. Consider maintaining alphabetical order for easier maintenance and readability. Here's a suggested order:
export enum ProgrammingLanguage {
    ASSEMBLER = 'ASSEMBLER',
    C = 'C',
    CPP = 'CPP',
    EMPTY = 'EMPTY',
    HASKELL = 'HASKELL',
    JAVA = 'JAVA',
    JAVASCRIPT = 'JAVASCRIPT',
    KOTLIN = 'KOTLIN',
    OCAML = 'OCAML',
    PYTHON = 'PYTHON',
    R = 'R',
    RUST = 'RUST',
    SWIFT = 'SWIFT',
    VHDL = 'VHDL',
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 0c36fed and 9ed8fcd.

📒 Files selected for processing (3)
  • 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/webapp/app/entities/programming/programming-exercise.model.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/entities/programming/programming-exercise.model.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

🔇 Additional comments (2)
src/main/resources/templates/c_plus_plus/test/.gitignore (1)

5-6: LGTM! CMake build directories correctly ignored.

The pattern cmake-build-*/ appropriately ignores all CMake build directories, regardless of the build type. This is a good practice for C++ projects using CMake.

src/main/resources/templates/c_plus_plus/test/CMakeLists.txt (1)

1-14: Overall, the CMake configuration is well-structured and appropriate.

This CMakeLists.txt file sets up a solid foundation for a C++ project with testing capabilities. It uses modern C++ standards, integrates with Catch2, and provides a clear structure for adding tests. The suggestions provided in the review aim to improve robustness, maintainability, and error handling. These minor enhancements will make the configuration more resilient and easier to manage as the project grows.

Copy link

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Oct 13, 2024
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Oct 13, 2024
@magaupp magaupp temporarily deployed to artemis-test3.artemis.cit.tum.de October 13, 2024 11:22 — with GitHub Actions Inactive
@magaupp magaupp dismissed JohannesStoehr’s stale review October 13, 2024 19:51

Formatting tests removed and task desciption added

@SimonEntholzer SimonEntholzer temporarily deployed to artemis-test4.artemis.cit.tum.de October 14, 2024 08:22 — with GitHub Actions Inactive
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Nice work, seems to work on Ts4 👍 One thing I noticed: Is it intended that two tests pass already for the template repository?
image

@magaupp
Copy link
Contributor Author

magaupp commented Oct 14, 2024

Yes, this is intended. These two tests are for CMake configuration and compilation.

Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

image
Tested on TS3. Works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) config-change Pull requests that change the config in a way that they require a deployment via Ansible. documentation plagiarism Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module ready for review server Pull requests that update Java code. (Added Automatically!) template tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

5 participants