We will be at OWASP APPSEC EUROPE 2017 - Belfast! Let’s talk!MORE INFO

Help Center

Get to know more about our API, Code Annotations and Code Transformations

Debug Code Elimination

Potency
0 / 3
Resilience
5 / 5
Cost
0 / 5

Tags: debug code,debug,elimination,removal,optimization

Description

Debug code main purpose is to help the developer doing code debugging. This can
be done in many different ways, such as log statements or assertions. Debug
Code Elimination
removes statements and public variable declarations
used to control the output of debugging messages that help on code debugging.

Notes:

  • Try to use (uppercase) names that do not collide with other declarations
  • Local declarations with the same name will not be removed

Examples

The following example contains some debug code to be removed:

1
2
3
4
5
6
7
8
9
if (typeof DEBUG === 'undefined') {
DEBUG = true;
}
// code A
if (DEBUG) {
console.log('Collecting objects.');
}
// code B
DEBUG && console.log('In debugging mode.');

Adding DEBUG to the variables list removes any statement or public
variable declaration with that name, leading to:

1
2
// code A
// code B

Option Types

Name Required Default Value Description
variables Yes N/A List of variables that are intended to be removed from the code.

API Parameters

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"keys": {
"accessKey": "XXXXXX",
"secretKey": "YYYYYY"
},
"applicationId": "ZZZZZZ",
"params": [
{
"name": "debugCodeElimination",
"options": {
"variables": "VALUE"
}
}
]
}