Conditions | 3 |
Paths | 1 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
34 | let parse = function parse(body) { |
||
|
|||
35 | try { |
||
36 | let { |
||
37 | "output": output, |
||
38 | "comparison": { |
||
39 | "success": success |
||
40 | } |
||
41 | } = body; |
||
42 | if (success) { |
||
43 | return Promise.resolve(output); |
||
44 | } else { |
||
45 | throw `Success property must be true`; |
||
46 | } |
||
47 | } catch(error) { |
||
48 | let message = `The body is not of response type '${name}'\n`; |
||
49 | message += error.message; |
||
50 | throw new Error(message); |
||
51 | } |
||
52 | }; |
||
53 | |||
58 |
This check looks for variables that are declared in multiple lines. There may be several reasons for this.
In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.
If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.