Skip to content

Commit

Permalink
make spell test a proper test and not a standalone script
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 22, 2017
1 parent 08c2e66 commit 4021490
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ before_script:

script:
- ./ci/travis/${TRAVIS_OS_NAME}/script.sh
- ./ci/travis/check_spelling.sh

after_script:
- ./ci/travis/${TRAVIS_OS_NAME}/after_script.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#!/bin/bash
set -e

export PATH=${HOME}/osgeo4travis/bin:${PATH}


echo "Spell check"
cd $(git rev-parse --show-toplevel)

if [[ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]]; then
# if on a PR, just analyse the changed files
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD master) | tr '\n' ' ' )
else
export PATH=${HOME}/osgeo4travis/bin:${PATH}
elif [[ ! -z $TRAVIS_COMMIT_RANGE ]]; then
echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
export PATH=${HOME}/osgeo4travis/bin:${PATH}
else
echo "Runnng spell test on all files (might take a while)"
FILES=""
fi

if [[ ! -z $FILES ]]; then
./scripts/spell_check/check_spelling.sh -r $FILES
DIR=$(git rev-parse --show-toplevel)/scripts/spell_check
${DIR}/check_spelling.sh -r $FILES
fi
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ ENDIF (ENABLE_TESTS)
IF(WITH_ASTYLE)
ADD_TEST(qgis_indentation ${CMAKE_SOURCE_DIR}/scripts/verify-indentation.sh)
ENDIF(WITH_ASTYLE)

ADD_TEST(qgis_spelling ${CMAKE_SOURCE_DIR}/scripts/spell_check/spell_test.sh)

3 comments on commit 4021490

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3nids what do you think about splitting off this test to it's own travis build? Since it doesn't require building of qgis it'd make sense to get results from this asap. This would also help speed up the results from the main test build.

We could potentially add other non-functional tests like a copyright header check to this other build too. And possibly the indentation test (although that currently requires building qgis_style, so we'd need to address that). Maybe we could split the indent check from the python pep8 checks and just run the latter in the non-build travis environment....

@3nids
Copy link
Member Author

@3nids 3nids commented on 4021490 Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed it makes a lot of sense. I will have a look at it.

@3nids
Copy link
Member Author

@3nids 3nids commented on 4021490 Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe documentation test could be moved there too, no?

Please sign in to comment.