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 ( a7d869...2b73a7 )
by Stefano
02:46
created

hostile.get   B

Complexity

Conditions 4
Paths 10

Size

Total Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
nc 10
dl 0
loc 36
rs 8.5806
nop 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A 0 14 4
A 0 9 2
1
var chalk = require('chalk');
2
var hostile = require('hostile');
3
var emoji = require('node-emoji');
4
5
var enviroment = process.env.npm_package_config_enviroment;
6
var server_name = process.env.npm_package_config_server;
7
var server_ip = process.env.npm_package_config_ip;
8
var found = false;
9
var preserveFormatting = false;
10
hostile.get(preserveFormatting, function (err, lines) {
11
  if (err) {
12
    console.error(err.message);
13
  }
14
  lines.forEach(function (line) {
15
    if ( line[0].trim() === '127.0.0.1' ) {
16
      line[1].trim().split(' ').forEach(function(elem){
17
        if ( elem === server_name){
18
          found = true;
19
        }
20
      });
21
    }
22
  });
23
  if ( !found ){
24
    process.stderr.write(chalk.yellow(emoji.emojify("[:raised_hand: ] Server hostname non found on local /etc/hosts \n")));
25
    if ( enviroment === 'dev' ){
26
      server_ip = '127.0.0.1';
27
    }
28
    hostile.set(server_ip, server_name, function (err) {
29
      if (err) {
30
        if ( err.code === 'EACCES' && err.path === '/etc/hosts' ){
31
          process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Impossibile modificare il file automaticamente, \nrieseguire 'npm run check:hostfile' come admin o editare a mano opportuanmente il file\n")));
32
        } else {
33
          process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore nel settaggio di /etc/hosts\n")));
34
          process.stderr.write(chalk.red(err+"\n"));
35
        }
36
37
        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...
38
      } else {
39
        process.stdout.write(chalk.bgGreen.black(emoji.emojify('[:heavy_check_mark: ] set /etc/hosts successfully!' + "\n")));
40
      }
41
    });
42
  } else {
43
    process.stdout.write(chalk.bgGreen.black(emoji.emojify('[:heavy_check_mark: ] /etc/hosts correct!' + "\n")));
44
  }
45
});
46