Skip to content

Commit

Permalink
chore: add setPythonVirtualEnvironment setting (#245)
Browse files Browse the repository at this point in the history
Signed-off-by: Ilona Shishov <[email protected]>
  • Loading branch information
IlonaShishov authored Mar 14, 2024
1 parent ab2baa9 commit 44e353c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 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.14",
"@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.24",
"@xml-tools/ast": "^5.0.5",
"@xml-tools/parser": "^1.0.11",
"json-to-ast": "^2.1.0",
Expand Down
1 change: 1 addition & 0 deletions src/componentAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ 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_MVN_PATH': globalConfig.exhortMvnPath,
'EXHORT_NPM_PATH': globalConfig.exhortNpmPath,
'EXHORT_GO_PATH': globalConfig.exhortGoPath,
Expand Down
3 changes: 3 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Config
utmSource: string;
exhortSnykToken: string;
matchManifestVersions: string;
setPythonVirtualEnvironment: string;
vulnerabilityAlertSeverity: string;
exhortMvnPath: string;
exhortNpmPath: string;
Expand All @@ -39,6 +40,7 @@ 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.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 @@ -55,6 +57,7 @@ class Config
*/
updateConfig( rhdaData: any ) {
this.matchManifestVersions = rhdaData.matchManifestVersions ? 'true' : 'false';
this.setPythonVirtualEnvironment = rhdaData.setPythonVirtualEnvironment ? 'true' : 'false';
this.vulnerabilityAlertSeverity = rhdaData.vulnerabilityAlertSeverity;
this.exhortMvnPath = rhdaData.mvn.executable.path || 'mvn';
this.exhortNpmPath = rhdaData.npm.executable.path || 'npm';
Expand Down
5 changes: 5 additions & 0 deletions test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Config tests', () => {
const rhdaData = {
exhortSnykToken: 'mockToken',
matchManifestVersions: false,
setPythonVirtualEnvironment: true,
mvn: {
executable: { path: 'mockPath' }
},
Expand All @@ -44,6 +45,7 @@ describe('Config tests', () => {
const partialRhdaData = {
exhortSnykToken: 'mockToken',
matchManifestVersions: true,
setPythonVirtualEnvironment: false,
mvn: {
executable: { path: '' }
},
Expand Down Expand Up @@ -74,6 +76,7 @@ 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.exhortMvnPath).to.eq('mvn');
expect(mockConfig.exhortNpmPath).to.eq('npm');
expect(mockConfig.exhortGoPath).to.eq('go');
Expand All @@ -88,6 +91,7 @@ describe('Config tests', () => {
mockConfig.updateConfig(rhdaData);

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

expect(mockConfig.matchManifestVersions).to.eq('true');
expect(mockConfig.setPythonVirtualEnvironment).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 44e353c

Please sign in to comment.