Commit 4ba83649 authored by Claudio André's avatar Claudio André

CI: add Javascript eslint

parent 00f0e79d
installed-tests/js/jasmine.js
modules/jsUnit.js
{
"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
......@@ -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
......
......@@ -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 --'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment