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.
Completed
Push — master ( c8bf84...8e4dac )
by Stefano
02:11
created

fs.readFile(ꞌconfig.php.distꞌ)   C

Complexity

Conditions 9
Paths 8

Size

Total Lines 50

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 9
c 1
b 0
f 0
nc 8
dl 0
loc 50
rs 6
nop 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A ��) 0 6 2
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