Surya Hebbar has uploaded a new patch set (#5). ( 
http://gerrit.cloudera.org:8080/21970 )

Change subject: IMPALA-13473: Add support for JS code analysis and linting with 
ESLint
......................................................................

IMPALA-13473: Add support for JS code analysis and linting with ESLint

This patch adds support for JS code analysis and linting to webUI
scripts using ESLint.

Support to enforce code style and quality is partcularly beneficial,
as the codebase for client-side scripts is consistently growing.

This works alongside 'flake8' to enforce code style guidelines,
within the existing jenkins job 'gerrit-auto-critic'. Refer to
IMPALA-7317 for further details.

In the case of webUI scripts, ESLint's linting checks are performed,
only if there are any changes within ".js" files in the patchset.

For code style enforcement and analysis the required ESLint packages are
installed from NodeJS repositories.

After analysis, the generated code style violations are formatted into
the required JSON form according to gerrit's REST API, similar to
comments generated by flake8. These are then posted to gerrit as comments
on the respective patchset from jenkins over SSH.

For NodeJS installation, which is required for JS tests as well
as linting, a seperate common script has been added to the "bin/nodejs"
directory.

The required linting packages have been added as dependencies in the
"www/scripts" directory.

A custom formatter has been added to format and filter the violations
generated from ESLint.

The following code style and quality rules have been added using ESLint.
  - Disallow unused variables
  - Enforce strict equality (=== and !==)
  - Require curly braces for all control statements (if, while, etc.)
  - Enforce semicolons at the end of statements
  - Enforce double quotes for strings
  - Set maximum line length to 90
  - Disallow `var`, use `let` or `const`
  - Prefer `const` where possible
  - Disallow multiple empty lines
  - Enforce spacing around infix operators (eg. +, =)
  - Disallow the use of undeclared variables
  - Require parentheses around arrow function arguments
  - Require a space before blocks
  - Enforce consistent spacing inside braces
  - Disallow shadowing variables declared in the outer scope
  - Disallow constant conditions in if statements, loops, etc
  - Disallow unnecessary parentheses in expressions
  - Disallow duplicate arguments in function definitions
  - Disallow duplicate keys in object literals
  - Disallow unreachable code after return, throw, continue, etc
  - Disallow reassigning function parameters
  - Require functions to always consistently return or not return at all
  - Enforce consistent use of dot notation wherever possible
  - Disallow multiple empty lines
  - Enforce spacing around the colon in object literal properties

Change-Id: Ieb3d0a9221738e2ac6fefd60087eaeee4366e33f
---
M bin/jenkins/critique-gerrit-review.py
A bin/nodejs/setup_nodejs.sh
M tests/run-js-tests.sh
A www/scripts/.gitignore
A www/scripts/eslint.config.js
A www/scripts/eslint/eslint_custom_output_formatter.js
A www/scripts/package.json
M www/scripts/query_timeline/package.json
M www/scripts/tests/package.json
9 files changed, 226 insertions(+), 46 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/70/21970/5
--
To view, visit http://gerrit.cloudera.org:8080/21970
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ieb3d0a9221738e2ac6fefd60087eaeee4366e33f
Gerrit-Change-Number: 21970
Gerrit-PatchSet: 5
Gerrit-Owner: Surya Hebbar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Kurt Deschler <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>
Gerrit-Reviewer: Surya Hebbar <[email protected]>

Reply via email to