Completed
Pull Request — master (#66)
by
unknown
02:15
created

src/cli/cms/structure/structure.js   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 14
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 1
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2
mnd 1
bc 1
fnc 1
bpm 1
cpm 2
noi 4

1 Function

Rating   Name   Duplication   Size   Complexity  
A structure.js ➔ editStructure 0 5 2
1
import path from 'path'
2
3
import {
4
  coreUtils,
5
  cmsStructure,
0 ignored issues
show
Unused Code introduced by
The variable cmsStructure seems to be never used. Consider removing it.
Loading history...
6
  cmsData,
0 ignored issues
show
Unused Code introduced by
The variable cmsData seems to be never used. Consider removing it.
Loading history...
7
  config
0 ignored issues
show
Unused Code introduced by
The variable config seems to be never used. Consider removing it.
Loading history...
8
} from '../../'
9
10
export function editStructure(type, folderPath) {
11
  if(type === 'add') coreUtils.file.addFolder(folderPath)
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
12
  else coreUtils.file.removeFolder(folderPath)
13
  return folderPath
14
}
15