Fix review points, rebuild solution

This commit is contained in:
IvanZosimov
2023-05-22 12:27:33 +02:00
parent 38b49fb717
commit b05a3f26b3
4 changed files with 13 additions and 25 deletions

View File

@ -16,11 +16,8 @@ export interface DotnetVersion {
qualityFlag: boolean;
}
enum DotnetInstallerLimits {
QualityInputMinimalMajorTag = 6,
LatestPatchSyntaxMinimalMajorTag = 5
}
const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6;
const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5;
export class DotnetVersionResolver {
private inputVersion: string;
private resolvedArgument: DotnetVersion;
@ -53,8 +50,7 @@ export class DotnetVersionResolver {
)?.groups?.majorTag;
if (
majorTag &&
parseInt(majorTag) <
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag
parseInt(majorTag) < LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG
) {
throw new Error(
`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`
@ -82,9 +78,7 @@ export class DotnetVersionResolver {
this.resolvedArgument.value = 'LTS';
}
this.resolvedArgument.qualityFlag =
parseInt(major) >= DotnetInstallerLimits.QualityInputMinimalMajorTag
? true
: false;
parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false;
}
public async createDotNetVersion(): Promise<DotnetVersion> {

View File

@ -48,7 +48,7 @@ export async function run() {
versions.push(getVersionFromGlobalJson(globalJsonPath));
} else {
core.info(
`A global.json wasn't found in the root directory. No .NET version will be installed.`
`The global.json wasn't found in the root directory. No .NET version will be installed.`
);
}
}
@ -121,7 +121,7 @@ function outputInstalledVersion(
}
if (globalJsonFileInput) {
const versionToOutput = installedVersions.at(-1);
const versionToOutput = installedVersions.at(-1); // .NET SDK version parsed from the global.json file is installed last
core.setOutput('dotnet-version', versionToOutput);
return;
}