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: Enable static code analysis for TypeScript with LocalCI #10373

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

Conversation

magaupp
Copy link
Contributor

@magaupp magaupp commented Feb 20, 2025

Note

Large diff due to package-lock.json update

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).

Motivation and Context

This PR enables static code analysis for JavaScript using ESLint.
Rules can be configured in the eslint.config.mjs file of the Test repository.

Description

ESLint does not assign any category to the lints, so each code issue will have the category Lint.

The docker image is updated to include the new packages in the package cache.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • LocalCI Server (TS1-4)
  1. Navigate to the create programming exercise view
  2. Select TypeScript as the language
  3. Enter a name in the General section
  4. Select advanced mode via the button on the bottom left
  5. Enable static code analysis in the Language section
  6. Enter the points in the Grading section
  7. Generate the exercise via the button on the bottom right
  8. Verify that the Template Result has exactly one no-empty-object-type code issue
  9. Verify that the Solution Result has no code issues
  10. Open the editor for any of the repositories via the Edit in Editor button on the top
  11. Add an empty block ({}) to a function
  12. Submit this change
  13. Verify that the no-empty code issue is in the feedback
  14. Verify that the issue is highlighted in the correct location
    image

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

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Server

Class/File Line Coverage Confirmation (assert/expect)
StaticCodeAnalysisConfigurer.java 99%
StaticCodeAnalysisTool.java 100%
LocalCIProgrammingLanguageFeatureService.java 100%
ParserPolicy.java 93%
SingleCategoryCategorizer.java 100%

Summary by CodeRabbit

  • New Features

    • Enhanced static code analysis for TypeScript in local CI.
    • Introduced ESLint integration for improved linting of JavaScript and TypeScript.
    • Added automation scripts to streamline build, test, and analysis workflows.
  • Documentation

    • Updated user documentation to clearly present the new feature set and integration differences across continuous integration systems.
  • Tests

    • Extended test coverage to validate ESLint parsing and ensure reliable static code analysis results.

@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) documentation config-change Pull requests that change the config in a way that they require a deployment via Ansible. template core Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module labels Feb 20, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de February 20, 2025 13:08 Inactive
@magaupp magaupp changed the title Programming exercises Enable static code analysis for TypeScript with LocalCI Programming exercises: Enable static code analysis for TypeScript with LocalCI Feb 20, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de February 20, 2025 19:03 Inactive
Base automatically changed from feature/programming-exercises/sca-tool-eslint to develop February 20, 2025 21:03
@magaupp magaupp marked this pull request as ready for review February 20, 2025 21:06
@magaupp magaupp requested a review from a team as a code owner February 20, 2025 21:06
Copy link

coderabbitai bot commented Feb 20, 2025

Walkthrough

This pull request updates the support for TypeScript within the static code analysis and continuous integration systems. The documentation now reflects that TypeScript supports static code analysis under Local CI. In the core configuration, a new mapping for TypeScript is added using ESLint, and a corresponding enumeration value for ESLint is introduced. The parser logic is also updated with a new categorizer and constant to handle ESLint issues. Additionally, new template files, ESLint configurations, and test cases have been added to fully integrate and validate the ESLint support.

Changes

File(s) Summary
docs/user/exercises/programming-exercise-features.inc Updated documentation to indicate that TypeScript now supports static code analysis under Local CI.
src/main/java/de/tum/cit/aet/artemis/core/config/StaticCodeAnalysisConfigurer.java,
src/main/java/de/tum/cit/aet/artemis/programming/domain/StaticCodeAnalysisTool.java,
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java,
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/ParserPolicy.java,
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/SingleCategoryCategorizer.java,
src/main/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java
Integrated ESLint support: added TypeScript mapping to ESLint in configuration, introduced the ESLINT enum with its file pattern, updated parser logic (including a new generic lint category constant and a dedicated categorizer), and modified issue generation for ESLint.
src/main/resources/templates/aeolus/typescript/default_static.sh,
src/main/resources/templates/typescript/staticCodeAnalysis/test/eslint.config.mjs,
src/main/resources/templates/typescript/staticCodeAnalysis/test/package.json
Added new template files for TypeScript projects, including a shell script for dependency installation, building and testing, an ESLint configuration file, and a package.json that defines scripts and devDependencies.
src/test/java/de/tum/cit/aet/artemis/programming/StaticCodeAnalysisParserUnitTest.java,
src/test/resources/test-data/static-code-analysis/expected/eslint.json,
src/test/resources/test-data/static-code-analysis/reports/eslint.sarif
Introduced new test cases and supporting resource files to validate the ESLint parser, including a SARIF report and its corresponding expected JSON output.

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant CI_System as LocalCI Feature Service
  participant Configurer as StaticCodeAnalysisConfigurer
  participant Parser as ParserPolicy
  participant Categorizer as SingleCategoryCategorizer

  Developer->>CI_System: Commit TypeScript code and trigger build
  CI_System->>Configurer: Retrieve static analysis configuration for TypeScript
  Configurer-->>CI_System: Return configuration mapping (ESLint for TypeScript)
  CI_System->>Parser: Parse ESLint SARIF report
  Parser->>Categorizer: Categorize rules using generic lint category
  Categorizer-->>Parser: Return categorized issue
  Parser-->>CI_System: Report static analysis results
Loading

Possibly related PRs

Suggested labels

tests, ready to merge

Suggested reviewers

  • BBesrour
  • SimonEntholzer
  • krusche
  • HanyangXu0508
  • az108
  • coolchock
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 0

🧹 Nitpick comments (5)
src/test/resources/test-data/static-code-analysis/reports/eslint.sarif (1)

31-57: Consider using relative paths in test data.

The use of absolute paths with /var/tmp/testing-dir/ in test data might cause portability issues across different environments.

Consider using relative paths or environment variables to make the test data more portable:

-            "uri": "file:///var/tmp/testing-dir/assignment/src/bubblesort.js"
+            "uri": "file:///${TEST_DIR}/assignment/src/bubblesort.js"
src/main/resources/templates/typescript/staticCodeAnalysis/test/eslint.config.mjs (1)

8-9: Consider restricting Node.js globals.

The current configuration allows all Node.js globals, which might be too permissive for student exercises. Consider explicitly listing only the required globals.

-  {languageOptions: { globals: globals.node }},
+  {languageOptions: { globals: {
+    // List only required globals
+    console: false,
+    process: false
+  }}},
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/SingleCategoryCategorizer.java (1)

5-7: Enhance class documentation.

Consider adding more detailed documentation explaining:

  • The purpose of using a single category
  • Example use cases
  • Whether null categories are allowed
 /**
  * Categorizes all rules into the same category.
+ *
+ * This categorizer is useful when a static analysis tool doesn't provide meaningful
+ * categorization or when all issues should be grouped under a single category.
+ *
+ * @param category The category to assign to all rules. Must not be null.
  */
src/main/resources/templates/aeolus/typescript/default_static.sh (1)

30-37: Consider optimizing directory handling.

The script repeatedly changes back to the initial directory between each command. Consider wrapping the commands in a subshell to avoid multiple directory changes:

-  cd "${AEOLUS_INITIAL_DIRECTORY}"
-  bash -c "source ${_script_name} aeolus_sourcing; install_dependencies"
-  cd "${AEOLUS_INITIAL_DIRECTORY}"
-  bash -c "source ${_script_name} aeolus_sourcing; static_code_analysis"
-  cd "${AEOLUS_INITIAL_DIRECTORY}"
-  bash -c "source ${_script_name} aeolus_sourcing; build"
-  cd "${AEOLUS_INITIAL_DIRECTORY}"
-  bash -c "source ${_script_name} aeolus_sourcing; test"
+  (
+    cd "${AEOLUS_INITIAL_DIRECTORY}"
+    bash -c "source ${_script_name} aeolus_sourcing; install_dependencies"
+    bash -c "source ${_script_name} aeolus_sourcing; static_code_analysis"
+    bash -c "source ${_script_name} aeolus_sourcing; build"
+    bash -c "source ${_script_name} aeolus_sourcing; test"
+  )
src/main/resources/templates/typescript/staticCodeAnalysis/test/package.json (1)

15-25: Consider pinning dependency versions.

Using caret ranges (^) for dependencies may lead to unexpected behavior if new versions introduce breaking changes. Consider pinning exact versions for better reproducibility in CI environment.

     "devDependencies": {
-        "@eslint/js": "^9.20.0",
-        "@microsoft/eslint-formatter-sarif": "^3.1.0",
-        "@tsconfig/node20": "^20.1.4",
-        "@types/jest": "^29.5.12",
-        "eslint": "^9.20.1",
-        "globals": "^15.15.0",
-        "jest": "^29.7.0",
-        "jest-junit": "^16.0.0",
-        "ts-jest": "^29.2.5",
-        "typescript": "^5.6.2",
-        "typescript-eslint": "^8.24.1"
+        "@eslint/js": "9.20.0",
+        "@microsoft/eslint-formatter-sarif": "3.1.0",
+        "@tsconfig/node20": "20.1.4",
+        "@types/jest": "29.5.12",
+        "eslint": "9.20.1",
+        "globals": "15.15.0",
+        "jest": "29.7.0",
+        "jest-junit": "16.0.0",
+        "ts-jest": "29.2.5",
+        "typescript": "5.6.2",
+        "typescript-eslint": "8.24.1"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9490fc and 5e50256.

⛔ Files ignored due to path filters (4)
  • src/main/resources/config/application.yml is excluded by !**/*.yml
  • src/main/resources/templates/aeolus/typescript/default_static.yaml is excluded by !**/*.yaml
  • src/main/resources/templates/typescript/staticCodeAnalysis/test/package-lock.json is excluded by !**/package-lock.json
  • src/main/resources/templates/typescript/test/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • docs/user/exercises/programming-exercise-features.inc (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/core/config/StaticCodeAnalysisConfigurer.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/domain/StaticCodeAnalysisTool.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/ParserPolicy.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/SingleCategoryCategorizer.java (1 hunks)
  • src/main/resources/templates/aeolus/typescript/default_static.sh (1 hunks)
  • src/main/resources/templates/typescript/staticCodeAnalysis/test/eslint.config.mjs (1 hunks)
  • src/main/resources/templates/typescript/staticCodeAnalysis/test/package.json (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/programming/StaticCodeAnalysisParserUnitTest.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java (1 hunks)
  • src/test/resources/test-data/static-code-analysis/expected/eslint.json (1 hunks)
  • src/test/resources/test-data/static-code-analysis/reports/eslint.sarif (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`src/test/java/**/*.java`: test_naming: descriptive; test_si...

src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

  • src/test/java/de/tum/cit/aet/artemis/programming/StaticCodeAnalysisParserUnitTest.java
  • src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java
`src/main/java/**/*.java`: naming:CamelCase; principles:{sin...

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
  • src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/SingleCategoryCategorizer.java
  • src/main/java/de/tum/cit/aet/artemis/programming/domain/StaticCodeAnalysisTool.java
  • src/main/java/de/tum/cit/aet/artemis/core/config/StaticCodeAnalysisConfigurer.java
  • src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/ParserPolicy.java
🧠 Learnings (3)
src/main/resources/templates/typescript/staticCodeAnalysis/test/package.json (4)
Learnt from: magaupp
PR: ls1intum/Artemis#9440
File: src/main/resources/templates/typescript/test/package.json:9-11
Timestamp: 2024-11-12T12:51:40.391Z
Learning: In the Artemis TypeScript programming exercise templates, the "assignment" workspace directory specified in `src/main/resources/templates/typescript/test/package.json` is copied in by the CI beforehand.
Learnt from: magaupp
PR: ls1intum/Artemis#9440
File: src/main/resources/templates/typescript/solution/package.json:4-7
Timestamp: 2024-11-12T12:51:58.050Z
Learning: In the Artemis TypeScript programming exercise templates, students do not run the tests, so the `package.json` files in the solution and exercise directories should not include a `"test"` script.
Learnt from: magaupp
PR: ls1intum/Artemis#9440
File: src/main/resources/templates/typescript/exercise/package.json:4-7
Timestamp: 2024-11-12T12:51:58.050Z
Learning: In TypeScript programming exercises in Artemis, tests are not run by the students, so it's unnecessary to include a test script in the package.json file.
Learnt from: magaupp
PR: ls1intum/Artemis#9440
File: src/main/resources/templates/typescript/test/package.json:4-8
Timestamp: 2024-11-12T12:51:58.050Z
Learning: In Artemis TypeScript programming exercise templates, the test `package.json` file is only used for testing and does not require a `start` script.
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/SingleCategoryCategorizer.java (1)
Learnt from: magaupp
PR: ls1intum/Artemis#10204
File: src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/RubocopCategorizer.java:13-15
Timestamp: 2025-01-28T17:50:58.545Z
Learning: In the Artemis codebase, null checks for ReportingDescriptor and rule.id() are handled during SARIF parsing before reaching the categorizer classes.
src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/ParserPolicy.java (1)
Learnt from: magaupp
PR: ls1intum/Artemis#10204
File: src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/RubocopCategorizer.java:13-15
Timestamp: 2025-01-28T17:50:58.545Z
Learning: In the Artemis codebase, null checks for ReportingDescriptor and rule.id() are handled during SARIF parsing before reaching the categorizer classes.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (15)
src/test/resources/test-data/static-code-analysis/expected/eslint.json (1)

1-27: New File Addition: Correct JSON Structure for ESLint Results

The new JSON file correctly provides a structured output for ESLint analysis. The file includes a "tool" key and an "issues" array with all the necessary properties (filePath, start/end lines and columns, rule, category, message, and priority). One suggestion is to verify that the absolute file paths (e.g., /var/tmp/testing-dir/assignment/src/client.js) align with your test environment requirements; if portability is a concern, consider using relative paths in your test setup.

src/test/resources/test-data/static-code-analysis/reports/eslint.sarif (3)

1-3: LGTM! Valid SARIF schema configuration.

The SARIF version and schema URL are correctly specified according to the standard format.


58-107: LGTM! Well-structured error reporting.

The results section provides clear, actionable error messages with precise location information, which aligns well with the PR's objective of enabling static code analysis.


6-30:

✅ Verification successful

Verify ESLint version and consider expanding the rule set.

The ESLint configuration looks good, but let's verify the version and consider expanding the rule set.

Consider adding more essential rules such as:

  • no-unused-vars
  • no-undef
  • no-console
  • semi
  • quotes

These rules would help catch more potential issues during static analysis.


🌐 Web query:

What is the latest version of ESLint and are there any known security vulnerabilities in version 9.20.1?

💡 Result:

The latest version of ESLint is v9.20.1, released on February 11, 2025[2][7]. According to Snyk's vulnerability database:

  • No direct vulnerabilities have been reported for ESLint v9.20.1[2]
  • The related @eslint/js package also shows no security vulnerabilities[3]

Recent security scans indicate:

  • No CVEs or exploit patterns identified in versions ≥9.14.0 through current[2]
  • Stable release channel shows clean security status since November 2024[2][10]

For context:

  • The ESLint team maintains a strict semantic versioning policy with security-focused release practices[7]
  • Version 9.20.x series includes critical fixes for configuration handling and type safety improvements[4]

Always verify dependencies through your project's vulnerability scanning tools, but current data shows v9.20.1 as secure[2][3][7].

Citations:


ESLint configuration verified; consider extending rule set (optional improvement).

The ESLint configuration in src/test/resources/test-data/static-code-analysis/reports/eslint.sarif is confirmed to use version 9.20.1, which is the latest release and free of known security vulnerabilities. The current rule set (covering no-debugger and no-empty) is valid, but for broader static analysis it might be beneficial to add additional rules. For instance, consider including:

  • no-unused-vars
  • no-undef
  • no-console
  • semi
  • quotes

These enhancements could help capture more potential issues during static analysis.

src/main/resources/templates/typescript/staticCodeAnalysis/test/eslint.config.mjs (1)

10-11: LGTM! Good use of recommended configurations.

The configuration correctly incorporates recommended settings from both JavaScript and TypeScript ESLint plugins.

src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/sarif/SingleCategoryCategorizer.java (1)

8-19: LGTM! Clean and focused implementation.

The implementation follows SOLID principles with a single responsibility and immutable state.

src/main/java/de/tum/cit/aet/artemis/programming/domain/StaticCodeAnalysisTool.java (1)

20-20: LGTM! Consistent integration of ESLint.

The changes correctly:

  • Add ESLint with its SARIF output file pattern
  • Map JavaScript to ESLint in the tools mapping
  • Maintain alphabetical ordering

Also applies to: 37-37

src/main/java/de/tum/cit/aet/artemis/programming/service/localci/scaparser/strategy/ParserPolicy.java (1)

20-23: LGTM! Well-integrated ESLint support.

The changes:

  • Add a well-documented generic category constant
  • Correctly integrate ESLint using the SARIF parser
  • Follow the established pattern for other SARIF-based tools

Also applies to: 41-41

src/test/java/de/tum/cit/aet/artemis/programming/StaticCodeAnalysisParserUnitTest.java (1)

66-69: LGTM!

The test method follows the established pattern in the test class, using the correct helper method and file names. The test is properly annotated and handles exceptions correctly.

src/main/java/de/tum/cit/aet/artemis/programming/service/localci/LocalCIProgrammingLanguageFeatureService.java (1)

81-81: LGTM!

The TypeScript configuration correctly enables static code analysis and plagiarism checks, aligning with the documented features in the programming exercise features documentation.

src/main/java/de/tum/cit/aet/artemis/core/config/StaticCodeAnalysisConfigurer.java (1)

98-99: LGTM!

The TypeScript configuration correctly uses ESLint with a generic lint category, following the same pattern as other single-tool language configurations.

docs/user/exercises/programming-exercise-features.inc (1)

96-96: LGTM!

The TypeScript feature documentation accurately reflects the implementation in the code, correctly indicating that static code analysis is supported only in Local CI.

src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java (1)

358-358: LGTM!

The addition of the ESLINT case with the "Lint" category is consistent with similar tools in the switch statement.

src/main/resources/templates/aeolus/typescript/default_static.sh (1)

11-11:

❓ Verification inconclusive

Review error handling in static code analysis.

The || [ $? -eq 1 ] condition allows the script to continue if ESLint exits with code 1. This might mask legitimate errors. Consider capturing and logging the exit code for better error tracking.


🏁 Script executed:

#!/bin/bash
# Description: Check ESLint exit codes documentation
# Test: Search for ESLint exit codes documentation
rg -A 5 'exit codes|exit status' eslint.sarif

Length of output: 100


Action Required: Verify Static Analysis Error Handling

The current condition

npm run lint:ci || [ $? -eq 1 ]

allows the script to continue if the lint command exits with code 1. However, this approach may mask other legitimate errors. The earlier attempt to verify ESLint exit code documentation using a search in eslint.sarif did not produce any meaningful output. Please manually verify whether an exit code of 1 is an acceptable result for your use case and whether additional logging of the exit code might be beneficial for error tracking.

  • Suggestion: Consider capturing the exit code in a variable (e.g., status=$?) immediately after executing npm run lint:ci, log this value, and then decide conditionally how to proceed. This ensures that unintended non-1 errors aren’t silently ignored.
src/main/resources/templates/typescript/staticCodeAnalysis/test/package.json (1)

11-13:

✅ Verification successful

Verify workspace variable resolution.

The ${studentParentWorkingDirectoryName} variable is used in both scripts and workspaces. Ensure this variable is properly resolved during CI execution.


🏁 Script executed:

#!/bin/bash
# Description: Check if the variable is defined and resolved
# Test: Search for variable definition or usage
rg -A 5 'studentParentWorkingDirectoryName'

Length of output: 41963


CI Variable Resolution Verified

The grep results confirm that the ${studentParentWorkingDirectoryName} placeholder is defined (in src/main/java/de/tum/cit/aet/artemis/core/config/Constants.java) and is consistently used across multiple configuration files and scripts—including the workspaces array in src/main/resources/templates/typescript/staticCodeAnalysis/test/package.json. As long as your CI configuration replaces these placeholders with actual values at runtime, everything appears to be in order.

@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de February 20, 2025 21:23 Inactive
Copy link

@Cathy0123456789 Cathy0123456789 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. Works as described.
image
image

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

Successfully merging this pull request may close these issues.

2 participants