Skip to content

Allow using new CodeQL languages without updating the CodeQL Action #2914

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

Open
wants to merge 6 commits into
base: henrymercer/bump-minimum-codeql-2.16.6
Choose a base branch
from

Conversation

henrymercer
Copy link
Contributor

This PR revives #779, adding a few new features:

  • Correctly handle language aliases (these didn't exist at the time)
  • Determine whether or not a language is traced by looking for its tracing-config.lua file — this is what we do in the CLI too
  • Simplify the parsing logic in config-utils.ts

Commit-by-commit review recommended as one commit has a large diff from renaming the Language enum to KnownLanguage.

Caveats:

  • We don't attempt to make language handling in the start-proxy Action generic, because this Action can't assume access to the CodeQL CLI, which is the source of truth. However this is probably OK because the default behaviour of this Action, i.e. not to proxy anything, is OK for new languages.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 17:05
@henrymercer henrymercer requested a review from a team as a code owner May 30, 2025 17:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates language handling to rely on the CodeQL CLI for alias resolution and tracing detection, renames the Language enum to KnownLanguage, simplifies parsing logic in config-utils.ts, and adds async utilities.

  • Introduce asyncFilter/asyncSome in util.js for async predicate operations.
  • Replace sync tracing checks with async file-based checks (isTracedLanguage) and use them throughout.
  • Remove hardcoded Language enum in favor of KnownLanguage and drive parsing via the CLI (betterResolveLanguagesgetSupportedLanguageMap).

Reviewed Changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/util.js Added asyncFilter and asyncSome helpers.
lib/languages.js Dropped old Language enum and parsing, now only exports KnownLanguage.
lib/start-proxy.js New parseLanguage implementation with alias support.
lib/tracer-config.js Switched shouldEnableIndirectTracing to async language checks.
lib/config-utils.js Simplified getLanguages/getRawLanguages, renamed some exports.
lib/codeql.js Added isTracedLanguage, isScannedLanguage, and getSupportedLanguageMap.
lib/autobuild.js Updated to use async tracing checks; refactored parameter order.
Tests (various) Updated to use KnownLanguage, added new async stubs.
Comments suppressed due to low confidence (2)

lib/autobuild.js:61

  • Checking if (!autobuildLanguages) will never catch the case where autobuildLanguages is an empty array because an empty array is truthy. Replace this with if (autobuildLanguages.length === 0) to correctly handle no-trace languages.
if (!autobuildLanguages) {

lib/start-proxy.test.js:115

  • [nitpick] Add tests for the remaining aliases defined in LANGUAGE_ALIASES, such as "javascript-typescript"KnownLanguage.javascript and "java-kotlin"KnownLanguage.java, to ensure full coverage of alias mappings.
t.deepEqual((0, start_proxy_1.parseLanguage)("typescript"), languages_1.KnownLanguage.javascript);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant