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 #9626

Merged
merged 9 commits into from
Nov 7, 2024

Conversation

magaupp
Copy link
Contributor

@magaupp magaupp commented Oct 29, 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 LocalVC and Jenkins.

Motivation and Context

Description

This template adds C# using .NET 8 and NUnit. Usage is demonstrated using the usual Strategy Pattern example.

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 show 0 out of 10 passed tests
  7. The Solution Result should show 16 out of 16 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

Release Notes

  • New Features

    • Added support for the C# programming language, including integration into the plagiarism detection service and continuous integration systems.
    • Introduced new project templates and scripts for C# exercises, including sorting algorithms and build configurations.
    • Updated documentation to reflect C# support and its features.
  • Bug Fixes

    • Enhanced error handling and coverage verification for programming languages.
  • Tests

    • Implemented comprehensive unit tests for new C# functionalities, including sorting algorithms and structural integrity checks.
  • Chores

    • Updated project configurations to utilize the latest .NET SDK and Gradle versions.

@magaupp magaupp force-pushed the feature/programming-exercises/csharp-template branch from 05e1f8a to d935c3f Compare October 30, 2024 16:45
@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) config-change Pull requests that change the config in a way that they require a deployment via Ansible. plagiarism Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module labels Oct 30, 2024
@magaupp magaupp force-pushed the feature/programming-exercises/csharp-template branch from d935c3f to cc21cc2 Compare October 31, 2024 19:18
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) documentation labels Oct 31, 2024
@magaupp magaupp temporarily deployed to artemis-test2.artemis.cit.tum.de October 31, 2024 19:55 — with GitHub Actions Inactive
@magaupp magaupp force-pushed the feature/programming-exercises/csharp-template branch from 5dc159c to 1a6276e Compare October 31, 2024 20:19
@magaupp magaupp temporarily deployed to artemis-test2.artemis.cit.tum.de October 31, 2024 20:27 — with GitHub Actions Inactive
@magaupp magaupp marked this pull request as ready for review October 31, 2024 20:30
@magaupp magaupp requested a review from a team as a code owner October 31, 2024 20:30
Copy link

coderabbitai bot commented Oct 31, 2024

Walkthrough

The pull request introduces extensive support for the C# programming language across various components of the project. Key changes include the addition of C# as a supported language in the build configuration, documentation updates, and modifications to multiple service classes to handle C# submissions. New files for C# exercises, including sorting algorithms and associated testing frameworks, are created. Overall, these changes enhance the functionality and flexibility of the system to accommodate C# programming.

Changes

File Change Summary
build.gradle - Added dependency for C# support: implementation "de.jplag:csharp:${jplag_version}".
- Updated jacocoTestCoverageVerification task settings.
- Enhanced test task configuration.
- Updated Gradle wrapper to version "8.10.2".
docs/user/exercises/programming-exercise-features.inc - Added C# support in programming exercise templates and feature support tables.
src/main/java/de/tum/cit/aet/artemis/plagiarism/service/ProgrammingPlagiarismDetectionService.java - Added support for C# in getJPlagProgrammingLanguage method.
- Updated error handling for unsupported languages.
src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingLanguage.java - Added C_SHARP to ENABLED_LANGUAGES set.
src/main/java/de/tum/cit/aet/artemis/programming/service/TemplateUpgradePolicyService.java - Updated control flow to treat C# as a supported language in getUpgradeService.
src/main/java/de/tum/cit/aet/artemis/programming/service/ci/ContinuousIntegrationService.java - Added C# support in forProgrammingLanguage method implementations.
src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/JenkinsProgrammingLanguageFeatureService.java - Registered C# in the constructor for programming language features.
src/main/java/de/tum/cit/aet/artemis/programming/service/jenkins/build_plan/JenkinsBuildPlanService.java - Updated builderFor method to include C# in case statement.
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java - Added C# support in the constructor.
src/main/resources/templates/aeolus/c_sharp/default.sh - Created Bash script for building and testing .NET projects.
src/main/resources/templates/c_sharp/exercise/.gitignore - Added a comprehensive .gitignore for C# projects.
src/main/resources/templates/c_sharp/exercise/BubbleSort.cs - Introduced BubbleSort class with PerformSort method.
src/main/resources/templates/c_sharp/exercise/Client.cs - Added Client class with methods for random date generation and sorting demonstration.
src/main/resources/templates/c_sharp/exercise/MergeSort.cs - Introduced MergeSort class with PerformSort method.
src/main/resources/templates/c_sharp/exercise/assignment.csproj - Created new project file for C# assignment.
src/main/resources/templates/c_sharp/readme - Updated to outline sorting algorithms exercise using the Strategy Pattern.
src/main/resources/templates/c_sharp/solution/.gitignore - Added .gitignore file for C# solution.
src/main/resources/templates/c_sharp/solution/BubbleSort.cs - Added BubbleSort class implementing ISortStrategy.
src/main/resources/templates/c_sharp/solution/Client.cs - Added Client class with Main method for application entry point.
src/main/resources/templates/c_sharp/solution/Context.cs - Introduced Context class for sorting strategy management.
src/main/resources/templates/c_sharp/solution/ISortStrategy.cs - Created ISortStrategy interface with PerformSort method.
src/main/resources/templates/c_sharp/solution/MergeSort.cs - Added MergeSort class implementing sorting logic.
src/main/resources/templates/c_sharp/solution/Policy.cs - Introduced Policy class for sorting strategy configuration based on date list size.
src/main/resources/templates/c_sharp/test/.gitignore - Added .gitignore for C# test files.
src/main/resources/templates/c_sharp/test/BehaviorTest.cs - Created unit tests for sorting algorithms using NUnit.
src/main/resources/templates/c_sharp/test/GlobalUsings.cs - Added global using directives for NUnit and assignment namespaces.
src/main/resources/templates/c_sharp/test/StructuralTest.cs - Created structural tests for validating class and interface architecture.
src/main/resources/templates/c_sharp/test/test.csproj - Introduced new test project file configured for .NET 8.0.
src/main/resources/templates/jenkins/c_sharp/regularRuns/pipeline.groovy - Added Groovy script for Jenkins build configuration for C# projects.
src/main/webapp/app/entities/programming/programming-exercise.model.ts - Added C_SHARP to ProgrammingLanguage enum.

Possibly related PRs

Suggested reviewers

  • JohannesStoehr
  • SimonEntholzer
  • BBesrour
  • pzdr7
  • EneaGore

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

@JanaNF JanaNF left a comment

Choose a reason for hiding this comment

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

Manual tested on TS2. Worked as expected just that "0 out of 16" template result passed
image

Copy link

@zagemello zagemello left a comment

Choose a reason for hiding this comment

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

Tested on TS2, all worked as expected

Copy link

@alekspetrov9e alekspetrov9e left a comment

Choose a reason for hiding this comment

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

Works as expected! Tested on TS 2.
Screenshot from 2024-11-04 14-03-44

Copy link

@vinceclifford vinceclifford left a comment

Choose a reason for hiding this comment

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

Tested on TS4, works as expected

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

code lgtm

@krusche krusche added this to the 7.7.0 milestone Nov 7, 2024
@krusche krusche merged commit 63f9cca into develop Nov 7, 2024
162 of 168 checks passed
@krusche krusche deleted the feature/programming-exercises/csharp-template branch November 7, 2024 23:17
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 to merge server Pull requests that update Java code. (Added Automatically!) template tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.