Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • jw_sonar
  • jw_sonar_backup
  • main
  • move-to-esm-only
  • open_tool_for_self_hosting
  • v5.0
  • v4.1
  • v4.2
8 results

Target

Select target project
  • dojo_project/projects/shared/nodesharedcode
1 result
Select Git revision
  • jw_sonar
  • jw_sonar_backup
  • main
  • move-to-esm-only
  • open_tool_for_self_hosting
  • v5.0
  • v4.1
  • v4.2
8 results
Show changes
Commits on Source (1)
...@@ -11,14 +11,14 @@ class SharedConfig { ...@@ -11,14 +11,14 @@ class SharedConfig {
enabled: boolean enabled: boolean
url: string url: string
token: string token: string
} };
constructor() { constructor() {
this.production = process.env.NODE_ENV === 'production'; this.production = process.env.NODE_ENV === 'production';
this.sonar = { this.sonar = {
enabled: ['yes', 'true', '1', 'on'].includes(process.env.SONAR_ENABLED?.trim()?.toLowerCase() ?? ''), enabled: [ 'yes', 'true', '1', 'on' ].includes(process.env.SONAR_ENABLED?.trim()?.toLowerCase() ?? ''),
url: process.env.SONAR_URL || '', url : process.env.SONAR_URL ?? '',
token: process.env.SONAR_TOKEN || '' token : process.env.SONAR_TOKEN ?? ''
}; };
this.logsFolder = process.env.LOGS_FOLDER ?? ''; this.logsFolder = process.env.LOGS_FOLDER ?? '';
......
...@@ -4,7 +4,7 @@ import path from 'path'; ...@@ -4,7 +4,7 @@ import path from 'path';
class Toolbox { class Toolbox {
public urlToPath(url: string): string { public urlToPath(url: string): string {
return url.replace(/^([a-z]{3,5}:\/{2})?[a-z.@]+(:[0-9]{1,5})?.(.*)/, '$3').replace('.git', ''); return url.replace(/^([a-z]{3,5}:\/{2})?[a-z.@]+(:\d{1,5})?.(.*)/, '$3').replace('.git', '');
} }
/* /*
......
...@@ -64,7 +64,7 @@ function registerStringCapitalizeName() { ...@@ -64,7 +64,7 @@ function registerStringCapitalizeName() {
function registerStringConvertWithEnvVars() { function registerStringConvertWithEnvVars() {
String.prototype.convertWithEnvVars = function (this: string): string { String.prototype.convertWithEnvVars = function (this: string): string {
return this.replace(/\${?([a-zA-Z0-9_]+)}?/g, (_match: string, p1: string) => process.env[p1] || ''); return this.replace(/\${?(\w+)}?/g, (_match: string, p1: string) => process.env[p1] ?? '');
}; };
} }
......
...@@ -57,10 +57,10 @@ class RecursiveFilesStats { ...@@ -57,10 +57,10 @@ class RecursiveFilesStats {
name: file, name: file,
path: path.join(rootPath, file) path: path.join(rootPath, file)
})).filter(item => { })).filter(item => {
if ( options.include && options.include.test(item.path) ) { if ( options.include?.test(item.path) ) {
return true; return true;
} }
if ( options.exclude && options.exclude.test(item.path) ) { if ( options.exclude?.test(item.path) ) {
return false; return false;
} }
if ( options.ignored ) { if ( options.ignored ) {
......
...@@ -10,9 +10,7 @@ class SharedGitlabManager { ...@@ -10,9 +10,7 @@ class SharedGitlabManager {
private readonly refreshTokenFunction?: () => Promise<string>; private readonly refreshTokenFunction?: () => Promise<string>;
setToken(token: string) { setToken(token: string) {
this.api = new Gitlab(Object.assign({ this.api = new Gitlab({ host: this.gitlabUrl ?? '', ...(this.refreshTokenFunction ? { oauthToken: token } : { token: token }) });
host: this.gitlabUrl ?? ''
}, this.refreshTokenFunction ? { oauthToken: token } : { token: token }));
} }
constructor(public gitlabUrl: string, token: string, public clientId?: string, public urlRedirect?: string, public urlToken?: string, refreshTokenFunction?: () => Promise<string>) { constructor(public gitlabUrl: string, token: string, public clientId?: string, public urlRedirect?: string, public urlToken?: string, refreshTokenFunction?: () => Promise<string>) {
......
...@@ -4,19 +4,19 @@ import SharedConfig from '../config/SharedConfig'; ...@@ -4,19 +4,19 @@ import SharedConfig from '../config/SharedConfig';
class SharedSonarManager { class SharedSonarManager {
// Use custom instance to allow self-signed certificates // Use custom instance to allow self-signed certificates
private instance = axios.create({ private readonly axiosInstance = axios.create({
httpsAgent: new https.Agent({ httpsAgent: new https.Agent({
rejectUnauthorized: false rejectUnauthorized: false
}) })
}); });
async isSonarSupported(): Promise<boolean> { async isSonarSupported(): Promise<boolean> {
if (!SharedConfig.sonar.enabled) { if ( !SharedConfig.sonar.enabled ) {
return false; return false;
} }
try { try {
const sonar = await this.instance.get(SharedConfig.sonar.url); const sonar = await this.axiosInstance.get(SharedConfig.sonar.url);
return sonar.status == 200; return sonar.status == 200;
} catch ( error ) { } catch ( error ) {
return false; return false;
...@@ -29,15 +29,16 @@ class SharedSonarManager { ...@@ -29,15 +29,16 @@ class SharedSonarManager {
* @param language * @param language
*/ */
mapLanguage(language: string): string { mapLanguage(language: string): string {
switch (language) { switch ( language ) {
case "csharp": case 'csharp':
return "cs"; return 'cs';
case "python": case 'python':
return "py"; return 'py';
default: default:
return language; return language;
} }
} }
} }
export default new SharedSonarManager(); export default new SharedSonarManager();
\ No newline at end of file