forked from vitalif/vitastor
Configure ESLint and add it to CI
parent
fd83fef1d9
commit
2c0801f6e4
|
@ -64,6 +64,13 @@ jobs:
|
||||||
# leak sanitizer sometimes crashes
|
# leak sanitizer sometimes crashes
|
||||||
- run: cd /root/vitastor/build && ASAN_OPTIONS=detect_leaks=0 make -j16 test
|
- run: cd /root/vitastor/build && ASAN_OPTIONS=detect_leaks=0 make -j16 test
|
||||||
|
|
||||||
|
npm_lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
container: ${{env.TEST_IMAGE}}:${{github.sha}}
|
||||||
|
steps:
|
||||||
|
- run: cd /root/vitastor/mon && npm run lint
|
||||||
|
|
||||||
test_add_osd:
|
test_add_osd:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:node/recommended"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2020
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"brace-style": [
|
||||||
|
"error",
|
||||||
|
"allman",
|
||||||
|
{ "allowSingleLine": true }
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"require-atomic-updates": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"no-useless-escape": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"no-control-regex": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"no-unused-vars": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"no-empty": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"no-process-exit": [
|
||||||
|
"off"
|
||||||
|
],
|
||||||
|
"node/shebang": [
|
||||||
|
"off"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
|
@ -152,6 +152,7 @@ function parse_pg_dsl(text)
|
||||||
else if (rule[2] === '(')
|
else if (rule[2] === '(')
|
||||||
{
|
{
|
||||||
rule[2] = [];
|
rule[2] = [];
|
||||||
|
// eslint-disable-next-line no-constant-condition
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (i > tokens.length-1)
|
if (i > tokens.length-1)
|
||||||
|
|
|
@ -747,6 +747,7 @@ class Mon
|
||||||
this.save_last_clean_running = true;
|
this.save_last_clean_running = true;
|
||||||
// last_clean_pgs is used to avoid extra data move when observing a series of changes in the cluster
|
// last_clean_pgs is used to avoid extra data move when observing a series of changes in the cluster
|
||||||
const new_clean_pgs = { items: {} };
|
const new_clean_pgs = { items: {} };
|
||||||
|
// eslint-disable-next-line indent
|
||||||
next_pool:
|
next_pool:
|
||||||
for (const pool_id in this.state.config.pools)
|
for (const pool_id in this.state.config.pools)
|
||||||
{
|
{
|
||||||
|
@ -829,6 +830,7 @@ class Mon
|
||||||
async become_master()
|
async become_master()
|
||||||
{
|
{
|
||||||
const state = { ...this.get_mon_state(), id: ''+this.etcd_lease_id };
|
const state = { ...this.get_mon_state(), id: ''+this.etcd_lease_id };
|
||||||
|
// eslint-disable-next-line no-constant-condition
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
const res = await this.etcd_call('/kv/txn', {
|
const res = await this.etcd_call('/kv/txn', {
|
||||||
|
@ -1316,7 +1318,7 @@ class Mon
|
||||||
for (const k in rules)
|
for (const k in rules)
|
||||||
{
|
{
|
||||||
if (!levels[k] || typeof rules[k] !== 'string' &&
|
if (!levels[k] || typeof rules[k] !== 'string' &&
|
||||||
(!rules[k] instanceof Array ||
|
(!(rules[k] instanceof Array) ||
|
||||||
rules[k].filter(s => typeof s !== 'string' && typeof s !== 'number').length > 0))
|
rules[k].filter(s => typeof s !== 'string' && typeof s !== 'number').length > 0))
|
||||||
{
|
{
|
||||||
if (warn)
|
if (warn)
|
||||||
|
|
|
@ -11,5 +11,15 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sprintf-js": "^1.1.2",
|
"sprintf-js": "^1.1.2",
|
||||||
"ws": "^7.2.5"
|
"ws": "^7.2.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^8.0.0",
|
||||||
|
"eslint-plugin-node": "^11.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint *.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ async function run()
|
||||||
const st = await fs.stat(options.device);
|
const st = await fs.stat(options.device);
|
||||||
options.device_block_size = st.blksize;
|
options.device_block_size = st.blksize;
|
||||||
if (st.isBlockDevice())
|
if (st.isBlockDevice())
|
||||||
device_size = Number(await system("/sbin/blockdev --getsize64 "+options.device))
|
device_size = Number(await system("/sbin/blockdev --getsize64 "+options.device));
|
||||||
else
|
else
|
||||||
device_size = st.size;
|
device_size = st.size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ const osd_tree = {
|
||||||
},
|
},
|
||||||
500: {
|
500: {
|
||||||
4: 3.58498,
|
4: 3.58498,
|
||||||
// 8: 3.58589,
|
/*8: 3.58589,*/
|
||||||
9: 3.63869,
|
9: 3.63869,
|
||||||
},
|
},
|
||||||
600: {
|
600: {
|
||||||
|
|
|
@ -104,7 +104,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||||
%make_install
|
%make_install
|
||||||
. /opt/rh/rh-nodejs12/enable
|
. /opt/rh/rh-nodejs12/enable
|
||||||
cd mon
|
cd mon
|
||||||
npm install
|
npm install --production
|
||||||
cd ..
|
cd ..
|
||||||
mkdir -p %buildroot/usr/lib/vitastor
|
mkdir -p %buildroot/usr/lib/vitastor
|
||||||
cp -r mon %buildroot/usr/lib/vitastor
|
cp -r mon %buildroot/usr/lib/vitastor
|
||||||
|
|
|
@ -101,7 +101,7 @@ Vitastor fio drivers for benchmarking.
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
%make_install
|
%make_install
|
||||||
cd mon
|
cd mon
|
||||||
npm install
|
npm install --production
|
||||||
cd ..
|
cd ..
|
||||||
mkdir -p %buildroot/usr/lib/vitastor
|
mkdir -p %buildroot/usr/lib/vitastor
|
||||||
cp -r mon %buildroot/usr/lib/vitastor
|
cp -r mon %buildroot/usr/lib/vitastor
|
||||||
|
|
|
@ -94,7 +94,7 @@ Vitastor fio drivers for benchmarking.
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
%cmake_install
|
%cmake_install
|
||||||
cd mon
|
cd mon
|
||||||
npm install
|
npm install --production
|
||||||
cd ..
|
cd ..
|
||||||
mkdir -p %buildroot/usr/lib/vitastor
|
mkdir -p %buildroot/usr/lib/vitastor
|
||||||
cp -r mon %buildroot/usr/lib/vitastor
|
cp -r mon %buildroot/usr/lib/vitastor
|
||||||
|
|
Loading…
Reference in New Issue