Commit 986bbddd authored by Ronan Abhamon's avatar Ronan Abhamon

feat(tools): check and test qml if it's necessary!

parent 03010465
...@@ -18,29 +18,25 @@ cd $SCRIPT_DIR/.. ...@@ -18,29 +18,25 @@ cd $SCRIPT_DIR/..
# ============================================================================== # ==============================================================================
if ! [ -x "$( command -v "$LINTER" )" ]; then if ! [ -x "$( command -v "$LINTER" )" ]; then
printf "${RED}Unable to found `$LINTER`. No tests can be executed.${NC}\n" printf "${RED}Unable to found `$LINTER`.${NC}\n"
exit 0 exit 1
fi fi
"${LINTER}" -v "${LINTER}" -v 2> /dev/null 1>&2
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
printf "${RED}Unable to check qml syntax.${NC}\n" printf "${RED}Unable to check qml syntax.${NC}\n"
exit 0 exit 1
fi fi
printf "${BLUE}Checking qml files...${NC}\n" printf "${BLUE}Checking qml files...${NC}\n"
so_far_so_good=0 so_far_so_good=0
while read line while read file; do
do $LINTER "$file"
result=$( if [[ $? != 0 ]] ; then
printf "$line" |
sed -n 's/^\s*<\s*file\s*>\s*\(.*\.\(qml\|js\)\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
)
if [[ ! -z $result ]] && ! $LINTER "$result"; then
so_far_so_good=1 so_far_so_good=1
fi fi
done < $RESOURCES_FILE done < <(git diff --name-only --cached | grep -E '\.qml|js|js\.spec$')
if [[ $so_far_so_good == 0 ]]; then if [[ $so_far_so_good == 0 ]]; then
printf "${GREEN}Done. No qml error found.\n" printf "${GREEN}Done. No qml error found.\n"
......
...@@ -28,9 +28,13 @@ if ! [ -x "$( command -v "$TEST_RUNNER" )" ]; then ...@@ -28,9 +28,13 @@ if ! [ -x "$( command -v "$TEST_RUNNER" )" ]; then
exit 0 exit 0
fi fi
so_far_so_good=0 git diff --name-only --cached | grep -Eq '\.qml|js|js\.spec$'
if [[ $? != 0 ]] ; then
exit 0
fi
# Check all `*.spec.qml` files. # Check all `*.spec.qml` files.
so_far_so_good=0
while read line while read line
do do
source_file=$( source_file=$(
......
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