ci: add support for pylint
src: fix QA issues
This commit is contained in:
parent
7989b29d7a
commit
30e5013bfa
@ -5,7 +5,7 @@ stages:
|
||||
|
||||
before_script:
|
||||
- apt-get update
|
||||
- apt-get install -y bash shellcheck
|
||||
- apt-get install -y bash pylint3 shellcheck
|
||||
|
||||
test:
|
||||
stage: test
|
||||
|
@ -1,5 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Original author: XGQT
|
||||
Licensed under the ISC License
|
||||
Copyright (c) 2020, src_prepare group
|
||||
|
||||
How to use:
|
||||
- cd into the repository root:
|
||||
$ pwd
|
||||
=> /home/user/git/src_prepare-overlay/app-admin/
|
||||
cd ..
|
||||
- run this script
|
||||
"""
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
26
test.sh
26
test.sh
@ -1,14 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# Original author: XGQT
|
||||
# Licensed under the ISC License
|
||||
# Copyright (c) 2020, src_prepare group
|
||||
|
||||
|
||||
# $1 - code check tool
|
||||
# $2 - files to check (quoed list)
|
||||
# Examples:
|
||||
# - run_test shellcheck "src/check-commit src/repomanci"
|
||||
# - run_test pylint "${py_files}"
|
||||
|
||||
exit_result=0
|
||||
files="$(grep -R --exclude-dir='.git' '^#!/.*sh$' 2>/dev/null | cut -d ':' -f 1)"
|
||||
|
||||
|
||||
for file in ${files}
|
||||
run_test() {
|
||||
for file in ${2}
|
||||
do
|
||||
echo "File ${file}... checking"
|
||||
if shellcheck "${file}"
|
||||
if command "${1}" "${file}"
|
||||
then
|
||||
echo " file is correct"
|
||||
else
|
||||
@ -18,6 +28,14 @@ do
|
||||
echo "Done: ${file}"
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
sh_files="$(grep -R --exclude-dir='.git' '^#!/.*sh$' 2>/dev/null | cut -d ':' -f 1)"
|
||||
py_files="$(grep -R --exclude-dir='.git' '^#!/.*python$' 2>/dev/null | cut -d ':' -f 1)"
|
||||
|
||||
run_test shellcheck "${sh_files}"
|
||||
run_test pylint "${py_files}"
|
||||
|
||||
if [ ${exit_result} = 0 ]
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user