Skip to content

Commit

Permalink
chore: add useGoMVS, enablePythonBestEffortsInstallation and usePipDe…
Browse files Browse the repository at this point in the history
…pTree settings

Signed-off-by: Ilona Shishov <[email protected]>
  • Loading branch information
IlonaShishov committed Mar 21, 2024
1 parent 5c061e8 commit a195d27
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dist"
],
"dependencies": {
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.25",
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.26",
"@xml-tools/ast": "^5.0.5",
"@xml-tools/parser": "^1.0.11",
"json-to-ast": "^2.1.0",
Expand Down
5 changes: 4 additions & 1 deletion src/componentAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ async function executeComponentAnalysis (diagnosticFilePath: string, contents: s
'RHDA_TOKEN': globalConfig.telemetryId,
'RHDA_SOURCE': globalConfig.utmSource,
'MATCH_MANIFEST_VERSIONS': globalConfig.matchManifestVersions,
'EXHORT_PYTHON_VIRTUAL_ENV': globalConfig.setPythonVirtualEnvironment,
'EXHORT_PYTHON_VIRTUAL_ENV': globalConfig.usePythonVirtualEnvironment,
'EXHORT_GO_MVS_LOGIC_ENABLED': globalConfig.useGoMVS,
'EXHORT_PYTHON_INSTALL_BEST_EFFORTS': globalConfig.enablePythonBestEffortsInstallation,
'EXHORT_PIP_USE_DEP_TREE': globalConfig.usePipDepTree,
'EXHORT_MVN_PATH': globalConfig.exhortMvnPath,
'EXHORT_NPM_PATH': globalConfig.exhortNpmPath,
'EXHORT_GO_PATH': globalConfig.exhortGoPath,
Expand Down
15 changes: 12 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class Config
utmSource: string;
exhortSnykToken: string;
matchManifestVersions: string;
setPythonVirtualEnvironment: string;
usePythonVirtualEnvironment: string;
useGoMVS: string;
enablePythonBestEffortsInstallation: string;
usePipDepTree: string;
vulnerabilityAlertSeverity: string;
exhortMvnPath: string;
exhortNpmPath: string;
Expand All @@ -40,7 +43,10 @@ class Config
this.utmSource = process.env.VSCEXT_UTM_SOURCE || '';
this.exhortSnykToken = process.env.VSCEXT_EXHORT_SNYK_TOKEN || '';
this.matchManifestVersions = process.env.VSCEXT_MATCH_MANIFEST_VERSIONS || 'true';
this.setPythonVirtualEnvironment = process.env.VSCEXT_SET_PYTHON_VIRTUAL_ENVIRONMENT || 'false';
this.usePythonVirtualEnvironment = process.env.VSCEXT_USE_PYTHON_VIRTUAL_ENVIRONMENT || 'false';
this.useGoMVS = process.env.VSCEXT_USE_GO_MVS || 'false';
this.enablePythonBestEffortsInstallation = process.env.VSCEXT_ENABLE_PYTHON_BEST_EFFORTS_INSTALLATION || 'false';
this.usePipDepTree = process.env.VSCEXT_USE_PIP_DEP_TREE || 'false';
this.vulnerabilityAlertSeverity = process.env.VSCEXT_VULNERABILITY_ALERT_SEVERITY || 'Error';
this.exhortMvnPath = process.env.VSCEXT_EXHORT_MVN_PATH || 'mvn';
this.exhortNpmPath = process.env.VSCEXT_EXHORT_NPM_PATH || 'npm';
Expand All @@ -57,7 +63,10 @@ class Config
*/
updateConfig( rhdaData: any ) {
this.matchManifestVersions = rhdaData.matchManifestVersions ? 'true' : 'false';
this.setPythonVirtualEnvironment = rhdaData.setPythonVirtualEnvironment ? 'true' : 'false';
this.usePythonVirtualEnvironment = rhdaData.usePythonVirtualEnvironment ? 'true' : 'false';
this.useGoMVS = rhdaData.useGoMVS ? 'true' : 'false';
this.enablePythonBestEffortsInstallation = rhdaData.enablePythonBestEffortsInstallation ? 'true' : 'false';
this.usePipDepTree = rhdaData.usePipDepTree ? 'true' : 'false';
this.vulnerabilityAlertSeverity = rhdaData.vulnerabilityAlertSeverity;
this.exhortMvnPath = rhdaData.mvn.executable.path || 'mvn';
this.exhortNpmPath = rhdaData.npm.executable.path || 'npm';
Expand Down
25 changes: 20 additions & 5 deletions test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ describe('Config tests', () => {
const rhdaData = {
exhortSnykToken: 'mockToken',
matchManifestVersions: false,
setPythonVirtualEnvironment: true,
usePythonVirtualEnvironment: true,
useGoMVS: true,
enablePythonBestEffortsInstallation: true,
usePipDepTree: true,
mvn: {
executable: { path: 'mockPath' }
},
Expand All @@ -45,7 +48,10 @@ describe('Config tests', () => {
const partialRhdaData = {
exhortSnykToken: 'mockToken',
matchManifestVersions: true,
setPythonVirtualEnvironment: false,
usePythonVirtualEnvironment: false,
useGoMVS: false,
enablePythonBestEffortsInstallation: false,
usePipDepTree: false,
mvn: {
executable: { path: '' }
},
Expand Down Expand Up @@ -76,7 +82,10 @@ describe('Config tests', () => {
expect(mockConfig.utmSource).to.eq('');
expect(mockConfig.exhortSnykToken).to.eq('');
expect(mockConfig.matchManifestVersions).to.eq('true');
expect(mockConfig.setPythonVirtualEnvironment).to.eq('false');
expect(mockConfig.usePythonVirtualEnvironment).to.eq('false');
expect(mockConfig.useGoMVS).to.eq('false');
expect(mockConfig.enablePythonBestEffortsInstallation).to.eq('false');
expect(mockConfig.usePipDepTree).to.eq('false');
expect(mockConfig.exhortMvnPath).to.eq('mvn');
expect(mockConfig.exhortNpmPath).to.eq('npm');
expect(mockConfig.exhortGoPath).to.eq('go');
Expand All @@ -91,7 +100,10 @@ describe('Config tests', () => {
mockConfig.updateConfig(rhdaData);

expect(mockConfig.matchManifestVersions).to.eq('false');
expect(mockConfig.setPythonVirtualEnvironment).to.eq('true');
expect(mockConfig.usePythonVirtualEnvironment).to.eq('true');
expect(mockConfig.useGoMVS).to.eq('true');
expect(mockConfig.enablePythonBestEffortsInstallation).to.eq('true');
expect(mockConfig.usePipDepTree).to.eq('true');
expect(mockConfig.exhortMvnPath).to.eq('mockPath');
expect(mockConfig.exhortNpmPath).to.eq('mockPath');
expect(mockConfig.exhortGoPath).to.eq('mockPath');
Expand All @@ -106,7 +118,10 @@ describe('Config tests', () => {
mockConfig.updateConfig(partialRhdaData);

expect(mockConfig.matchManifestVersions).to.eq('true');
expect(mockConfig.setPythonVirtualEnvironment).to.eq('false');
expect(mockConfig.usePythonVirtualEnvironment).to.eq('false');
expect(mockConfig.useGoMVS).to.eq('false');
expect(mockConfig.enablePythonBestEffortsInstallation).to.eq('false');
expect(mockConfig.usePipDepTree).to.eq('false');
expect(mockConfig.exhortMvnPath).to.eq('mvn');
expect(mockConfig.exhortNpmPath).to.eq('npm');
expect(mockConfig.exhortGoPath).to.eq('go');
Expand Down

0 comments on commit a195d27

Please sign in to comment.