Accessing Function code Linting
- To access the Function code Linting open the following URL:
- After opening the console, you can find the list of Openwhisk actions as shown in the following figure:
Figure 452 - Openwhisk Console
- To create a new action, click on Create Action button on the top right corner of the screen and to edit an existing action click on the edit icon corresponding to the action that you wish to modify.

- The following page appears:

- The gutter on the left side of the editor shows the user, the list of warnings and errors that are present in the code.

- These errors and warnings that are present on the gutter can be viewed by clicking on the warnings and error icons respectively.

The rules that are set in BigFix AEX for errors and warnings are listed below.
These are errors and warnings that the user can see in the editor gutter. These are the validations for any stylistic errors or other vulnerabilities. Users can still save Openwhisk actions even if there are any errors or warnings.
Linting is done to ensure that the user can review the code and refactor it so as to make it neat, scalable, efficient, and optimal.
There are errors, but if they are not syntactical, the user can still save the code.
S.no | Rule | Type |
1. | Indentation of 4 spaces | Warning |
2. | Line-break style unix, such as LF and not CRLF | Warning |
3. | Single quotes in strings | Warning |
4. | id length should be min of 4 (except I,j,k) | Error |
5. | If variable is not reinitialized, then use const | Error |
6. | var data-type not accepted | Error |
7. | CamelCase in variable and method names | Error |
8. | Max lines in the code is 650 (except the comments and empty lines) | Warning |
9. | Max length of a line is 125 | Warning |
10. | Max lines per function is 30 | Warning |
11. | No trailing space | Warning |
12. | Spacing between operators and operands | Warning |
13. | Spacing in unary operator | Error |
14. | Spacing in key-value pairs (before colon false else true) | Warning |
15. | Missing space between async function, while as for named and anonymous no space is required | Error |
Apart from these, there are rules that are pre-defined from the editor and their errors and warnings can also be seen.
Rule 1: Indentation of 4 spaces
- Indentation should be four spaces; otherwise, the below warning message is shown as "expected Indentation of 4 spaces but found 0" as shown in the following figure:

Rule 2: Line-break style Unix i.e., LF and not CRLF
- There are two kinds of line break systems that is LF and CRLF, the code editor that is being used in openwhisk console uses the LF line break style so if the format is not of LF, the below warning message appears as “Expected linebreaks to be ‘LF' but found 'CRLF'”:

Rule 3: Single quotes in strings
- String must be in single quote, otherwise the below warning message appears as “Strings must use single quote”:

Rule 4: id length should be min of 4 (except i,j,k)
- While we declare a variable or method, the id length should be min of 4 letters (except i,j,k) otherwise the below error message is shown as “Identifier name 'ABC' is too short (<4)”:

Rule 5: If variable is not reinitialized, then use const.
- If the variable is not reinitialized, then the user is prompted to declare a const variable, instead let or var variable otherwise the below error message appears:

Rule 6: var datatype not accepted
- When user declares the data type, he should use let or const data type. var data type is not accepted. if var datatype is declared, the below error message appears as “Unexpected var, use let or const instead”:

Rule 7: Camel-case in variable and method names
- When declaring a variable or method, camel-case should be followed, or else the below error message appears:

Rule 8: Max lines in the code is 650 (except the comments and empty lines)
- The code length should be of maximum 650 (except the comments and empty lines) if it exceeds more than 650 lines the below warning message is seen in the gutter “File has too many lines (651). Maximum allowed is 650”:

Rule 9: Max length of a line is 125.
- The maximum length of a line should be 125, if this line is exceeded, the below warning message is shown “This line has a length of 126. Maximum allowed is 125”:

Rule 10: Max lines per function is 30.
- The maximum lines per function should be 30, if it is exceeded more than 30 lines in a function, the below warning message appears as “Function ‘main’ has too many lines (31). Maximum allowed is 30”:

Rule 11: No trailing space
- While writing code, if user uses the unnecessary spaces, the below warning message is shown as “Trailing spaces not allowed”:

Rule 12: Spacing between operators and operands
- There should be a space between operators and operands otherwise the below warning message is shown as “Operator ‘=’ must be spaced.”:

Rule 13: Spacing in unary operator.
- There should be no space between unary operator, otherwise the error message is shown as “Unexpected space after unary operator”:

Rule 14: Spacing in key-value pairs (before colon false else true)
- In Key value pair, after key name before colon, if user gives space and space before key name, the below warning message is shown as “Extra space after key makes”:

Rule 15: Missing space between async function, while as for named and anonymous function, no space is required.
- Space should not be used between async function, otherwise the below Error message can be seen as in below figure:
