Skip to content

Commit 410d706

Browse files
committed
Combine product name and version into ProductVersion type
1 parent ce1de8d commit 410d706

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/languages/traced.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export const UNSUPPORTED_DARWIN_FOR_TRACED = 27;
2222
/** Xcode 27 and above do not support traced extraction. */
2323
export const UNSUPPORTED_XCODE_FOR_TRACED = 27;
2424

25+
/** A version along with the product it relates to. */
26+
type ProductVersion = {
27+
product: "macOS" | "Xcode";
28+
version: semver.SemVer;
29+
};
30+
2531
/**
2632
* Creates a diagnostic indicating that `version` of `product` is unsupported for traced analysis.
2733
* Depending on `skipUnsupportedTracedAnalysis`, this function then either throws a {@link ConfigurationError}
@@ -31,17 +37,16 @@ export const UNSUPPORTED_XCODE_FOR_TRACED = 27;
3137
* @param config The CodeQL Action configuration.
3238
* @param tracedLanguages Traced languages that are configured for analysis.
3339
* @param abortUnsupportedTracedAnalysis Whether this is a fatal error.
34-
* @param product The product that the version is unsupported of.
35-
* @param version The unsupported version.
40+
* @param productVersion A description of the product and its version that is unsupported.
3641
*/
3742
function handleUnsupportedVersion(
3843
logger: Logger,
3944
config: ActionConfig<"dbLocation" | "tempDir">,
4045
tracedLanguages: string[],
4146
abortUnsupportedTracedAnalysis: boolean,
42-
product: "macOS" | "Xcode",
43-
version: semver.SemVer,
47+
productVersion: ProductVersion,
4448
) {
49+
const { product, version } = productVersion;
4550
const unsupportedVersion =
4651
product === "macOS"
4752
? UNSUPPORTED_DARWIN_FOR_TRACED
@@ -181,8 +186,7 @@ export async function checkRunnerSupportsTracedAnalysis(
181186
config,
182187
tracedLanguages,
183188
abortUnsupportedTracedAnalysis,
184-
"macOS",
185-
version,
189+
{ product: "macOS", version },
186190
);
187191

188192
// Return early so that we don't end up producing more-or-less the same log message/diagnostic
@@ -209,8 +213,7 @@ export async function checkRunnerSupportsTracedAnalysis(
209213
config,
210214
tracedLanguages,
211215
abortUnsupportedTracedAnalysis,
212-
"Xcode",
213-
xcodeVer,
216+
{ product: "Xcode", version: xcodeVer },
214217
);
215218
} else if (xcodeVer === undefined) {
216219
action.logger.info(

0 commit comments

Comments
 (0)