Completed
Push — master ( 78d2f9...949122 )
by greg
42s
created

src/server/routes/post-list-url-save.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 31
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 3
nc 1
mnd 1
bc 3
fnc 2
dl 0
loc 31
rs 10
bpm 1.5
cpm 1.5
noi 3
c 1
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A post-list-url-save.js ➔ route 0 20 1
1
import path from 'path'
2
import fse from 'fs-extra'
3
import Handlebars from 'handlebars'
4
import {
5
  abeExtend
0 ignored issues
show
Unused Code introduced by
The variable abeExtend seems to be never used. Consider removing it.
Loading history...
6
  ,coreUtils
0 ignored issues
show
Unused Code introduced by
The variable coreUtils seems to be never used. Consider removing it.
Loading history...
7
  ,config
8
} from '../../cli'
9
10
var route = function(req, res, next) {
0 ignored issues
show
Unused Code introduced by
The parameter next is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
11
  
12
  var authorizations = req.body
13
14
  let json = config.getLocalConfig()
15
16
  Array.prototype.forEach.call(Object.keys(authorizations), (key) => {
17
  	if (key != "admin") {
18
  		json.users.routes[key] = authorizations[key]
19
  	}
20
  })
21
22
  config.save(json)
23
24
  res.set('Content-Type', 'application/json')
25
  res.send(JSON.stringify({
26
    success: 1,
27
    message: 'config saved'
28
  }))
29
}
30
31
export default route