-
Notifications
You must be signed in to change notification settings - Fork 307
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
: Fix code button showing password authentication initially
#10446
Programming exercises
: Fix code button showing password authentication initially
#10446
Conversation
WalkthroughThis pull request renames the variable from a singular Changes
Sequence Diagram(s)sequenceDiagram
participant C as CodeButtonComponent
participant P as ProfileInfo
C->>P: Retrieve repositoryAuthenticationMechanisms
P-->>C: Return list of mechanisms
C->>C: Assign list to authenticationMechanisms
sequenceDiagram
participant U as User
participant C as CodeButtonComponent
participant L as LocalStorage
U->>C: Click button
C->>L: Retrieve saved authentication mechanism
L-->>C: Return saved mechanism (if exists)
C->>C: Validate against authenticationMechanisms
C->>C: Set selectedAuthenticationMechanism (default to first if invalid)
Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on our test system as instructor. Works as expected (tested with practice mode)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested locally, works as expected now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code
…correct-default-mechanism
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
🧹 Nitpick comments (4)
src/main/java/de/tum/cit/aet/artemis/programming/repository/BuildJobRepository.java (1)
47-51
: Improved SQL query readability and safetyReformatted the SQL condition for better readability and replaced the inline string concatenation with the database-agnostic
CONCAT()
function. The new format is clearer, more explicit, and follows SQL best practices.For consistency, consider applying similar formatting to other complex conditions in the query, such as the duration checks on lines 53-54.
src/main/resources/templates/aeolus/javascript/default_static.sh (2)
11-11
: Consider handling all non-zero exit codes consistentlyThe script uses
|| [ $? -eq 1 ]
to allow the linting command to exit with code 1, but it doesn't handle other non-zero exit codes. This could lead to unpredictable behavior if the linting process fails with a different exit code.- npm run lint:ci || [ $? -eq 1 ] + npm run lint:ci || trueAlternatively, if you only want to accept exit code 1 as valid but fail on others:
- npm run lint:ci || [ $? -eq 1 ] + npm run lint:ci || { [ $? -eq 1 ] || exit $?; }
1-7
: Add descriptive comment explaining the script's purposeWhile the script is well-structured, it lacks a header comment explaining its purpose and usage.
#!/usr/bin/env bash +# This script automates JavaScript project setup, static code analysis, and testing +# for the Aeolus CI/CD pipeline. It ensures each step runs in a clean environment. +# +# Usage: ./default_static.sh + set -e export AEOLUS_INITIAL_DIRECTORY=${PWD}src/main/webapp/app/shared/util/markdown.conversion.util.ts (1)
139-149
: Consider aligning plugin name with Angular conventions.
WhileMarkdownitTagClass
works, renaming it in camelCase may better reflect standard Angular naming (e.g.,markdownItTagClass
). Otherwise, the plugin implementation is robust and well-integrated.-export function MarkdownitTagClass(markdown: MarkdownIt, mapping: TagClassMapping = {}): void { +export function markdownItTagClass(markdown: MarkdownIt, mapping: TagClassMapping = {}): void {
🛑 Comments failed to post (2)
src/main/java/de/tum/cit/aet/artemis/communication/service/AnswerMessageService.java (1)
92-95:
⚠️ Potential issuePotential performance issue with
orElse
usageThe current implementation uses
orElse()
which will always executeloadConversationWithParticipantsIfGroupChat()
regardless of whether the first method returns a value. This can lead to unnecessary database operations.Consider using
orElseGet()
instead to ensure the second method is only called when needed:-var conversation = conversationService.isMemberOrCreateForCourseWideElseThrow(conversationId, author, Optional.empty()) - .orElse(conversationService.loadConversationWithParticipantsIfGroupChat(conversationId)); +var conversation = conversationService.isMemberOrCreateForCourseWideElseThrow(conversationId, author, Optional.empty()) + .orElseGet(() -> conversationService.loadConversationWithParticipantsIfGroupChat(conversationId));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.var conversationId = answerMessage.getPost().getConversation().getId(); // For group chats we need the participants to generate the conversation title var conversation = conversationService.isMemberOrCreateForCourseWideElseThrow(conversationId, author, Optional.empty()) .orElseGet(() -> conversationService.loadConversationWithParticipantsIfGroupChat(conversationId));
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIInfoContributor.java (1)
60-73:
⚠️ Potential issueAdded helper method to parse memory strings into megabytes.
The new
parseMemoryStringToMB
method converts Docker memory specifications (with g, m, k suffixes) into consistent megabyte values. This is good practice as it standardizes how memory values are represented internally.However, there's a potential issue with the string parsing. The method expects quotes in suffixes (e.g.,
"g\""
), which might be inconsistent with how memory strings are actually formatted.- private static long parseMemoryStringToMB(String memoryString) { - if (memoryString.endsWith("g\"")) { - return Long.parseLong(memoryString.replaceAll("[^0-9]", "")) * 1024L; - } - else if (memoryString.endsWith("m\"")) { - return Long.parseLong(memoryString.replaceAll("[^0-9]", "")); - } - else if (memoryString.endsWith("k\"")) { - return Long.parseLong(memoryString.replaceAll("[^0-9]", "")) / 1024L; - } - else { - return Long.parseLong(memoryString); - } - } + private static long parseMemoryStringToMB(String memoryString) { + // Remove any quotation marks that might be present + String cleanedString = memoryString.replace("\"", ""); + + if (cleanedString.endsWith("g")) { + return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")) * 1024L; + } + else if (cleanedString.endsWith("m")) { + return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")); + } + else if (cleanedString.endsWith("k")) { + return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")) / 1024L; + } + else { + return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")); + } + }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.private static long parseMemoryStringToMB(String memoryString) { // Remove any quotation marks that might be present String cleanedString = memoryString.replace("\"", ""); if (cleanedString.endsWith("g")) { return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")) * 1024L; } else if (cleanedString.endsWith("m")) { return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")); } else if (cleanedString.endsWith("k")) { return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")) / 1024L; } else { return Long.parseLong(cleanedString.replaceAll("[^0-9]", "")); } }
Programming exercises
: Fix code button showing password authentication initially, although it is disabledProgramming exercises
: Fix code button showing password authentication initially
Checklist
General
Client
Changes affecting Programming Exercises
Motivation and Context
When the server is configured to only use SSH and tokens for authentication to LocalVC, e.g. see the application-local.yml:
The code button still showed HTTPs initially, although it should not be an available option.
Description
Fixes this issue, by assuring that as the default value, only an enabled authentication mechanism is used.
Steps for Testing
Testserver States
You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.
Review Progress
Code Review
Manual Tests
Test Coverage
Client
Screenshots
Incorrect behavior: - HTTPs is shown as selected, although only Token and SSH are available


Fixed behavior: - Token (or an actually available) mechanism is shown:
Summary by CodeRabbit
Refactor
New Features
Bug Fixes
Tests