| Total Complexity | 5 |
| Complexity/F | 2.5 |
| Lines of Code | 34 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import path from 'path' |
||
| 2 | |||
| 3 | import { |
||
| 4 | cmsOperations |
||
| 5 | ,coreUtils |
||
| 6 | ,config |
||
| 7 | ,Manager |
||
| 8 | ,FileParser |
||
| 9 | } from '../../' |
||
| 10 | |||
| 11 | |||
| 12 | export function unpublish(filePath) { |
||
| 13 | var tplUrl = FileParser.getFileDataFromUrl(path.join(config.publish.url, filePath)) |
||
| 14 | if(coreUtils.file.exist(tplUrl.json.path)) { |
||
| 15 | var json = JSON.parse(JSON.stringify(FileParser.getJson(tplUrl.json.path))) |
||
| 16 | if(typeof json.abe_meta.publish !== 'undefined' && json.abe_meta.publish !== null) { |
||
| 17 | delete json.abe_meta.publish |
||
| 18 | } |
||
| 19 | |||
| 20 | cmsOperations.save.save( |
||
| 21 | path.join(config.root, config.draft.url, json.abe_meta.link.replace(config.root)), |
||
| 22 | json.abe_meta.template, |
||
| 23 | json, |
||
| 24 | '', |
||
| 25 | 'reject', |
||
| 26 | null, |
||
| 27 | 'reject' |
||
| 28 | ) |
||
| 29 | .then((resSave) => { |
||
|
|
|||
| 30 | FileParser.removeFile(tplUrl.publish.path, tplUrl.publish.json) |
||
| 31 | Manager.instance.updateList() |
||
| 32 | }) |
||
| 33 | } |
||
| 34 | } |
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.