GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

scripts/js/workspace.build.js   A
last analyzed

Complexity

Total Complexity 11
Complexity/F 5.5

Size

Lines of Code 60
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
cc 0
wmc 11
c 4
b 1
f 0
nc 5
mnd 3
bc 8
fnc 2
dl 0
loc 60
rs 10
bpm 4
cpm 5.5
noi 3

1 Function

Rating   Name   Duplication   Size   Complexity  
C fs.readFile(ꞌconfig.php.distꞌ) 0 50 9
1
var shell = require('shelljs');
2
var chalk = require('chalk');
3
var fs = require('fs');
4
5
var enviroment = process.env.npm_package_config_enviroment;
6
7
shell.echo('Compile Workspace ('+enviroment+')');
8
9
shell.cd('applications/workspace/');
10
11
fs.readFile('config.php.dist', 'utf8', function (err,data) {
12
13
  if (err) {
14
    process.stderr.write(chalk.red("Errore in lettura: "+err) + "\n");
15
    process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
16
  }
17
18
  var result;
19
  if ( enviroment === 'dev' ){
20
    result = data.replace(/##TYPE##/g, 'sqlite');
21
    result = result.replace(/##HOST##/g, 'ROOT_PATH.\'/../database/workspace.sqlite\'');
22
    result = result.replace(/##DBNAME##/g, '');
23
    result = result.replace(/##PASSWORD##/g, '');
24
    result = result.replace(/##USERNAME##/g, '');
25
    result = result.replace(/##LOGLEVEL##/g, '\\Monolog\\Logger::DEBUG');
26
  } else if ( enviroment === 'vagrant' ){
27
    result = data.replace(/##TYPE##/g, 'mysql');
28
    result = result.replace(/##HOST##/g, '\'localhost\'');
29
    result = result.replace(/##DBNAME##/g, 'workspace');
30
    result = result.replace(/##PASSWORD##/g, 'workspace');
31
    result = result.replace(/##USERNAME##/g, 'workspace');
32
    result = result.replace(/##LOGLEVEL##/g, '\\Monolog\\Logger::DEBUG');
33
  } else {
34
    // STAGING / PROD
35
    result = data.replace(/##TYPE##/g, 'mysql');
36
    if (
37
      !process.env.npm_package_config_database_host ||
38
      !process.env.npm_package_config_database_host ||
39
      !process.env.npm_package_config_database_dbname ||
40
      !process.env.npm_package_config_database_password ||
41
      !process.env.npm_package_config_database_username
42
    ) {
43
      process.stderr.write(chalk.red("Errore manca la configurazione in .npmrc") + "\n");
44
      process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
45
    }
46
    result = result.replace(/##HOST##/g, '\''+process.env.npm_package_config_database_host+'\'');
47
    result = result.replace(/##DBNAME##/g, process.env.npm_package_config_database_dbname);
48
    result = result.replace(/##PASSWORD##/g, process.env.npm_package_config_database_password);
49
    result = result.replace(/##USERNAME##/g, process.env.npm_package_config_database_username);
50
    result = result.replace(/##LOGLEVEL##/g, '\\Monolog\\Logger::INFO');
51
  }
52
53
54
  fs.writeFile('config.php', result, 'utf8', function (err) {
55
     if (err) {
56
       process.stderr.write(chalk.red("Errore in scrittura: "+err));
57
       process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
58
     }
59
  });
60
});
61