[gjs: 3/4] CI: add Javascript eslint
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 3/4] CI: add Javascript eslint
- Date: Tue, 6 Mar 2018 13:36:18 +0000 (UTC)
commit 4ba83649f83b6fc3785216b2b9f250dc11425744
Author: Claudio André <claudioandre br gmail com>
Date: Mon Mar 5 11:18:56 2018 -0300
CI: add Javascript eslint
.eslintignore | 2 ++
.eslintrc.json | 43 +++++++++++++++++++++++++++++++++++++++++++
.gitlab-ci.yml | 8 ++++++++
test/test-ci.sh | 27 +++++++++++++++++++++++++++
4 files changed, 80 insertions(+)
---
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..2949f27
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,2 @@
+installed-tests/js/jasmine.js
+modules/jsUnit.js
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..8cade1c
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,43 @@
+{
+ "env": {
+ "es6": true,
+ "jasmine": true
+ },
+ "extends": "eslint:recommended",
+ "rules": {
+ "indent": [
+ "error",
+ 4,
+ {
+ "MemberExpression": "off"
+ }
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "quotes": [
+ "error",
+ "single",
+ {
+ "avoidEscape": true
+ }
+ ],
+ "semi": [
+ "error",
+ "always"
+ ]
+ },
+ "globals": {
+ "imports": false,
+ "ARGV": false,
+ "print": false,
+ "printerr": false,
+ "window": false,
+ "log": false,
+ "logError": false
+ },
+ "parserOptions": {
+ "ecmaVersion": 2017
+ }
+}
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5688d2f..9645aec 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,6 +20,7 @@ stages:
- $(pwd)/coverage/
- $(pwd)/cppcheck/
- $(pwd)/cpplint/
+ - $(pwd)/eslint/
- $(pwd)/tokei/
script:
@@ -134,6 +135,13 @@ cpplint:
variables:
CODECHECK: "CPPLINT"
+eslint:
+ <<: *build
+ stage: static_analysis
+ image: claudioandre/spidermonkey:fedora.dev.gcc
+ variables:
+ CODECHECK: "ESLINT"
+
code_statistics:
<<: *build
stage: static_analysis
diff --git a/test/test-ci.sh b/test/test-ci.sh
index e5a9d81..b1a85b2 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -94,6 +94,7 @@ save_dir="$(pwd)"
mkdir -p "$save_dir"/coverage; touch "$save_dir"/coverage/doing-"$1"
mkdir -p "$save_dir"/cppcheck; touch "$save_dir"/cppcheck/doing-"$1"
mkdir -p "$save_dir"/cpplint; touch "$save_dir"/cpplint/doing-"$1"
+mkdir -p "$save_dir"/eslint; touch "$save_dir"/eslint/doing-"$1"
mkdir -p "$save_dir"/tokei; touch "$save_dir"/tokei/doing-"$1"
if [[ $1 == "GJS" ]]; then
@@ -188,6 +189,32 @@ elif [[ $1 == "CPPLINT" ]]; then
# Compare the report with master and fail if new warnings are found
do_Compare_With_Upstream_Master "cppLint"
+elif [[ $1 == "ESLINT" ]]; then
+ # Install needed packages
+ npm install -g eslint
+
+ echo
+ echo '-- Javascript linter report --'
+ eslint examples installed-tests modules --format unix 2>&1 | \
+ tee "$save_dir"/eslint/current-report.txt | \
+ sed -E -e 's/:[0-9]+:[0-9]+:/:LINE:COL:/' -e 's/[0-9]+ problems//' -e 's/\/root\/tmp-upstream//' -e
's/\/builds\/claudioandre//' | \
+ tee /cwd/current-report.txt
+ echo
+
+ # Get the code committed at upstream master
+ do_Get_Upstream_Master
+ cp "$save_dir"/.eslint* .
+
+ echo '-- Master Javascript linter report --'
+ eslint examples installed-tests modules --format unix 2>&1 | \
+ tee "$save_dir"/eslint/master-report.txt | \
+ sed -E -e 's/:[0-9]+:[0-9]+:/:LINE:COL:/' -e 's/[0-9]+ problems//' -e 's/\/root\/tmp-upstream//' -e
's/\/builds\/claudioandre//' | \
+ tee /cwd/master-report.txt
+ echo
+
+ # Compare the report with master and fail if new warnings are found
+ do_Compare_With_Upstream_Master "esLint"
+
elif [[ $1 == "TOKEI" ]]; then
echo
echo '-- Project statistics --'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]