Skip to content

Commit

Permalink
🔥 Remove deprecated action parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Jul 3, 2022
1 parent 974668a commit cc65887
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 201 deletions.
60 changes: 1 addition & 59 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inputs:
required: false
default: "${{ github.sha }}"
upload-result:
description: 'Upload Qodana results as an artifact to the job'
description: 'Upload Qodana results on GitHub as an artifact to the job'
required: false
default: "true"
artifact-name:
Expand All @@ -41,64 +41,6 @@ inputs:
description: 'GitHub token to be used for uploading annotations'
required: false
default: ${{ github.token }}
linter:
description: '[DEPRECATED] Qodana linter – [official Qodana Docker image](#supported-qodana-docker-images).'
required: false
deprecationMessage: 'Use `args` (e.g. `args: --linter,<linter>`) instead'
project-dir:
description: '[DEPRECATED] Root directory of the project to be analyzed'
required: false
deprecationMessage: 'Use `args` (e.g. `args: --project-dir,<path>`) instead'
idea-config-dir:
description: '[DEPRECATED] IntelliJ IDEA configuration directory'
required: false
deprecationMessage: 'Use `args` to mount the directory (e.g. `args: -v,<path>:/root/.config/idea`) instead'
gradle-settings-path:
description: '[DEPRECATED] Provide path to gradle.properties file. An example: "/your/custom/path/gradle.properties"'
required: false
deprecationMessage: 'Use `args` to mount the file (e.g. `args: -v,<path>:/root/.gradle/gradle.properties`) instead'
additional-volumes:
description: '[DEPRECATED] Mount additional volumes to Docker container'
required: false
deprecationMessage: 'Use `args` to mount any directory (e.g. `args: -v,<path1>:<path2>,-v,<path3>:<path4>`) instead'
additional-env-variables:
description: '[DEPRECATED] Pass additional environment variables to docker container'
required: false
deprecationMessage: 'Use `args` to pass any environment variable (e.g. `args: -e,<key1>=<value1>,-e,<key2>=<value2>`) instead'
fail-threshold:
description: '[DEPRECATED] Set the number of problems that will serve as a quality gate. If this number is reached, the pipeline run is terminated'
required: false
deprecationMessage: 'Use `args` to pass the threshold (e.g. `args: --fail-threshold,<number>`) instead'
inspected-dir:
description: '[DEPRECATED] Directory to be inspected. If not specified, the whole project is inspected by default'
required: false
deprecationMessage: 'Use `args` to pass the directory (e.g. `args: -d,<path>`) instead'
baseline-path:
description: '[DEPRECATED] Run in baseline mode. Provide the path to an existing SARIF report to be used in the baseline state calculation'
required: false
deprecationMessage: 'Use `args` to pass the baseline path (e.g. `args: -b,<path>`) instead'
baseline-include-absent:
description: '[DEPRECATED] Include the results from the baseline absent in the current Qodana run in the output report'
required: false
default: "false"
deprecationMessage: 'Use `args` to pass the baseline include absent flag (e.g. `args: --baseline-include-absent`) instead'
changes:
description: '[DEPRECATED] Inspect uncommitted changes and report new problems'
required: false
default: "false"
deprecationMessage: 'Use `args` to pass the changes flag (e.g. `args: --changes`) instead'
script:
description: '[DEPRECATED] Override the default docker scenario'
required: false
deprecationMessage: 'Use `args` to pass the script (e.g. `args: --script,<name>`) instead'
profile-name:
description: '[DEPRECATED] Name of a profile defined in the project'
required: false
deprecationMessage: 'Use `args` to pass the profile name (e.g. `args: --profile-name,<name>`) instead'
profile-path:
description: '[DEPRECATED] Absolute path to the profile file'
required: false
deprecationMessage: 'Use `args` to pass the profile path (e.g. `args: --profile-path,<path>`) instead'

runs:
using: 'node12'
Expand Down
68 changes: 1 addition & 67 deletions scan/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68088,75 +68088,9 @@ var require_utils5 = __commonJS({
var tc = __importStar2(require_tool_cache());
var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports));
var path_1 = __importDefault(require("path"));
function getDeprecatedInputs(args) {
const deprecatedInputs = {
linter: core2.getInput("linter"),
projectDir: core2.getInput("project-dir"),
additionalVolumes: core2.getMultilineInput("additional-volumes"),
additionalEnvVars: core2.getMultilineInput("additional-env-variables"),
inspectedDir: core2.getInput("inspected-dir"),
ideaConfigDir: core2.getInput("idea-config-dir"),
baselinePath: core2.getInput("baseline-path"),
baselineIncludeAbsent: core2.getBooleanInput("baseline-include-absent"),
failThreshold: core2.getInput("fail-threshold"),
profileName: core2.getInput("profile-name"),
profilePath: core2.getInput("profile-path"),
gradleSettingsPath: core2.getInput("gradle-settings-path"),
changes: core2.getBooleanInput("changes"),
script: core2.getInput("script")
};
if (deprecatedInputs.linter) {
args.push("-l", deprecatedInputs.linter);
}
if (deprecatedInputs.projectDir) {
args.push("-i", deprecatedInputs.projectDir);
}
if (deprecatedInputs.additionalVolumes) {
for (const volume of deprecatedInputs.additionalVolumes) {
args.push("-v", volume);
}
}
if (deprecatedInputs.additionalEnvVars) {
for (const envVar of deprecatedInputs.additionalEnvVars) {
args.push("-e", envVar);
}
}
if (deprecatedInputs.inspectedDir) {
args.push("-d", deprecatedInputs.inspectedDir);
}
if (deprecatedInputs.ideaConfigDir) {
args.push("-v", `${deprecatedInputs.ideaConfigDir}:/root/.config/idea`);
}
if (deprecatedInputs.baselinePath) {
args.push("-b", deprecatedInputs.baselinePath);
}
if (deprecatedInputs.baselineIncludeAbsent) {
args.push("--baseline-include-absent");
}
if (deprecatedInputs.failThreshold) {
args.push("--fail-threshold", deprecatedInputs.failThreshold);
}
if (deprecatedInputs.profileName) {
args.push("--profile-name", deprecatedInputs.profileName);
}
if (deprecatedInputs.profilePath) {
args.push("--profile-path", deprecatedInputs.profilePath);
}
if (deprecatedInputs.gradleSettingsPath) {
args.push("-v", `${deprecatedInputs.gradleSettingsPath}:/root/.gradle/gradle.properties`);
}
if (deprecatedInputs.changes) {
args.push("--changes");
}
if (deprecatedInputs.script) {
args.push("--script", deprecatedInputs.script);
}
return args;
}
__name(getDeprecatedInputs, "getDeprecatedInputs");
function getInputs() {
return {
args: getDeprecatedInputs(core2.getInput("args").split(",").map((arg) => arg.trim())),
args: core2.getInput("args").split(",").map((arg) => arg.trim()),
resultsDir: core2.getInput("results-dir"),
cacheDir: core2.getInput("cache-dir"),
additionalCacheHash: core2.getInput("additional-cache-hash"),
Expand Down
79 changes: 4 additions & 75 deletions scan/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,87 +14,16 @@ import {
} from '../../common/qodana'
import path from 'path'

function getDeprecatedInputs(args: string[]): string[] {
const deprecatedInputs = {
linter: core.getInput('linter'),
projectDir: core.getInput('project-dir'),
additionalVolumes: core.getMultilineInput('additional-volumes'),
additionalEnvVars: core.getMultilineInput('additional-env-variables'),
inspectedDir: core.getInput('inspected-dir'),
ideaConfigDir: core.getInput('idea-config-dir'),
baselinePath: core.getInput('baseline-path'),
baselineIncludeAbsent: core.getBooleanInput('baseline-include-absent'),
failThreshold: core.getInput('fail-threshold'),
profileName: core.getInput('profile-name'),
profilePath: core.getInput('profile-path'),
gradleSettingsPath: core.getInput('gradle-settings-path'),
changes: core.getBooleanInput('changes'),
script: core.getInput('script')
}
if (deprecatedInputs.linter) {
args.push('-l', deprecatedInputs.linter)
}
if (deprecatedInputs.projectDir) {
args.push('-i', deprecatedInputs.projectDir)
}
if (deprecatedInputs.additionalVolumes) {
for (const volume of deprecatedInputs.additionalVolumes) {
args.push('-v', volume)
}
}
if (deprecatedInputs.additionalEnvVars) {
for (const envVar of deprecatedInputs.additionalEnvVars) {
args.push('-e', envVar)
}
}
if (deprecatedInputs.inspectedDir) {
args.push('-d', deprecatedInputs.inspectedDir)
}
if (deprecatedInputs.ideaConfigDir) {
args.push('-v', `${deprecatedInputs.ideaConfigDir}:/root/.config/idea`)
}
if (deprecatedInputs.baselinePath) {
args.push('-b', deprecatedInputs.baselinePath)
}
if (deprecatedInputs.baselineIncludeAbsent) {
args.push('--baseline-include-absent')
}
if (deprecatedInputs.failThreshold) {
args.push('--fail-threshold', deprecatedInputs.failThreshold)
}
if (deprecatedInputs.profileName) {
args.push('--profile-name', deprecatedInputs.profileName)
}
if (deprecatedInputs.profilePath) {
args.push('--profile-path', deprecatedInputs.profilePath)
}
if (deprecatedInputs.gradleSettingsPath) {
args.push(
'-v',
`${deprecatedInputs.gradleSettingsPath}:/root/.gradle/gradle.properties`
)
}
if (deprecatedInputs.changes) {
args.push('--changes')
}
if (deprecatedInputs.script) {
args.push('--script', deprecatedInputs.script)
}
return args
}

/**
* The context for the action.
* @returns The action inputs.
*/
export function getInputs(): Inputs {
return {
args: getDeprecatedInputs(
core
.getInput('args')
.split(',')
.map(arg => arg.trim())
),
args: core
.getInput('args')
.split(',')
.map(arg => arg.trim()),
resultsDir: core.getInput('results-dir'),
cacheDir: core.getInput('cache-dir'),
additionalCacheHash: core.getInput('additional-cache-hash'),
Expand Down

0 comments on commit cc65887

Please sign in to comment.