Skip to content

Commit

Permalink
Merge pull request #3857 from 3nids/spellingtest
Browse files Browse the repository at this point in the history
Check spelling on travis
  • Loading branch information
3nids authored Dec 15, 2016
2 parents 94b0de5 + 1090e8b commit 49055c6
Show file tree
Hide file tree
Showing 19 changed files with 170 additions and 65 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ matrix:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
- george-edison55-precise-backports # doxygen 1.8.3
# - laurent-boulard-devtools not whitelisted yet https://github.com/travis-ci/apt-source-whitelist/pull/345
packages:
- doxygen
- bison
Expand All @@ -36,11 +37,15 @@ matrix:
- xvfb
- flip
- clang-3.8
# used for spell checks
# - silversearcher-ag not available in precise nor in a white listed ppa (in osgeo4travis as for now)
- expect-dev # unbuffer
# OSX based build with QT4 and Python 2
# - os: osx
# env:
# - BUILD=osx
# - IGNORE_BUILD_FAILURES=YES


git:
depth: 30
Expand Down Expand Up @@ -70,6 +75,7 @@ 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
16 changes: 16 additions & 0 deletions ci/travis/check_spelling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

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


echo "Spell check"

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 --name-only HEAD $(git merge-base HEAD master) | tr '\n' ' ' )
fi

./scripts/chkspelling_ag.sh $FILES

2 changes: 1 addition & 1 deletion python/core/qgsactionscoperegistry.sip
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QgsActionScopeRegistry : QObject
/**
* Create a new QgsActionScopeRegistry.
* QGIS already creates a central registry. You will normally
* want to use QgsApplication::actionScopeRegistry() to get acess
* want to use QgsApplication::actionScopeRegistry() to get access
* to that one instead.
*
* @note Added in QGIS 3.0
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgstaskmanager.sip
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ class QgsTask : QObject
* Subtasks allow a single task to be created which
* consists of multiple smaller tasks. Subtasks are not visible or indepedently
* controllable by users. Ownership of the subtask is transferred.
* Subtasks can have an optional list of dependant tasks, which must be completed
* Subtasks can have an optional list of dependent tasks, which must be completed
* before the subtask can begin. By default subtasks are considered independent
* of the parent task, ie they can be run either before, after, or at the same
* time as the parent task. This behaviour can be overriden through the subTaskDependency
* time as the parent task. This behaviour can be overridden through the subTaskDependency
* argument.
*
* The parent task must be added to a QgsTaskManager for subtasks to be utilised.
Expand Down Expand Up @@ -286,7 +286,7 @@ class QgsTaskManager : QObject
long addTask( QgsTask* task /Transfer/, int priority = 0 );

/**
* Adds a task to the manager, using a full task definition (including dependancy
* Adds a task to the manager, using a full task definition (including dependency
* handling). Ownership of the task is transferred to the manager, and the task
* manager will be responsible for starting the task. The priority argument can
* be used to control the run queue's order of execution.
Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgsstyle.sip
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class QgsStyle : QObject
*/
QStringList tagsOfSymbol( StyleEntity type, const QString& symbol );

/** Returns wheter a given tag is associated with the symbol
/** Returns whether a given tag is associated with the symbol
*
* \param type is either SymbolEntity or ColorrampEntity
* \param symbol is the name of the symbol or color ramp
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/help/qgis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ qgis:countuniquepointsinpolygon: >
A new polygons layer is generated, with the exact same content as the input polygons layer, but containing an additional field with the points count corresponding to each polygon.

qgis:createattributeindex: >
Creates an index to speed up queries made against a field in a table. Support for index creation is dependant on the layer's data provider and the field type.
Creates an index to speed up queries made against a field in a table. Support for index creation is dependent on the layer's data provider and the field type.

qgis:createconstantrasterlayer: >
Given an input raster layer an a value, this algorithm generates a new layer with the same extent and cellsize as the input one, and all cells with the specified value.
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/SplitLinesWithLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterVector(self.INPUT_B,
self.tr('Split layer'), [dataobjects.TYPE_VECTOR_LINE]))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Splitted'), datatype=[dataobjects.TYPE_VECTOR_LINE]))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Split'), datatype=[dataobjects.TYPE_VECTOR_LINE]))

def processAlgorithm(self, progress):
layerA = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_A))
Expand Down
38 changes: 38 additions & 0 deletions scripts/.agignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Folders
.build*/
ci/
debian/build.*/
debian/build*/
debian/.*/usr/
i18n/
ms-windows/osgeo4w/
python/ext-libs/
python/plugins/processing/algs/otb/
python/plugins/processing/algs/saga/
python/qsci_apis/
src/app/dwg/libdxfrw/
src/app/gps/qwtpolar-1.0/
src/app/gps/qwtpolar-1.1.1/
src/plugins/grass/qtermwidget/

#Extensions
*.*.orig
*.*.sortinc
*.*.prepare


#Specific files
ChangeLog
Exception_to_GPL_for_Qt.txt
images/themes/default/svgbase/hammer.svg
images/themes/default/propertyicons/general.svg
LexerR.py
spelling.dat
resources/cpt-city-qgis-min/fme/metres/DESC.xml
resources/cpt-city-qgis-min/wkp/schwarzwald/COPYING.xml
tests/src/python/test_qgsserver_accesscontrol.py
tests/testdata/qgis_server/ets-wms13/project.qgs
tests/testdata/qgis_server_accesscontrol/project.qgs
tests/testdata/qgis_server_accesscontrol/Hello.qml


41 changes: 41 additions & 0 deletions scripts/chkspelling_ag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
###########################################################################
# chkspelling.sh
# ---------------------
# Date : December 2016
# Copyright : (C) 2016 by Denis Rouzaud
# Email : denis.rouzaud@gmail.com
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################

# optional arguments: files to be checked
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

AGIGNORE=${DIR}/.agignore

RE=$(cut -d: -f1 scripts/spelling.dat | tr '\n' '\|' | sed -e 's/|$//')
if [ ! $# -eq 0 ]; then
EXCLUDE=$(cat $AGIGNORE | sed -e 's/\s*#.*$//' -e '/^\s*$/d' | tr '\n' '|' | sed -e 's/|$//')
FILES=$(echo $@ | tr -s '[[:blank:]]' '\n' | egrep -iv "$EXCLUDE" | tr '\n' ' ' )
echo "Running spell check on files: $FILES"
else
FILES="."
fi


exec 5>&1
OUTPUT=$(unbuffer ag --smart-case --all-text --nopager --numbers --word-regexp --path-to-ignore $AGIGNORE "$RE" $FILES |tee /dev/fd/5)


if [[ ! -z $OUTPUT ]]; then
echo "Spelling errors have been found"
exit 1
else
exit 0
fi
86 changes: 44 additions & 42 deletions scripts/prepare-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,32 @@ PATH=$TOPLEVEL/scripts:$PATH
cd $TOPLEVEL

if ! type -p astyle.sh >/dev/null; then
echo astyle.sh not found
exit 1
echo astyle.sh not found
exit 1
fi

if ! type -p colordiff >/dev/null; then
colordiff()
{
cat "$@"
}
colordiff()
{
cat "$@"
}
fi

if [ "$1" = "-c" ]; then
echo "Cleaning..."
remove_temporary_files.sh
echo "Cleaning..."
remove_temporary_files.sh
fi

set -e

# determine changed files
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)
${TOPLEVEL}/scripts/chkspelling_ag.sh $MODIFIED


if [ -z "$MODIFIED" ]; then
echo nothing was modified
exit 0
echo nothing was modified
exit 0
fi

# save original changes
Expand All @@ -58,42 +60,42 @@ ASTYLEDIFF=astyle.$REV.diff
i=0
N=$(echo $MODIFIED | wc -w)
for f in $MODIFIED; do
(( i++ )) || true

case "$f" in
src/core/gps/qextserialport/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*)
echo $f skipped
continue
;;

*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py)
;;

*)
continue
;;
esac

m=$f.$REV.prepare

cp $f $m
ASTYLEPROGRESS=" [$i/$N]" astyle.sh $f
if diff -u $m $f >>$ASTYLEDIFF; then
# no difference found
rm $m
fi
(( i++ )) || true

case "$f" in
src/core/gps/qextserialport/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*)
echo $f skipped
continue
;;

*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.sip|*.py)
;;

*)
continue
;;
esac

m=$f.$REV.prepare

cp $f $m
ASTYLEPROGRESS=" [$i/$N]" astyle.sh $f
if diff -u $m $f >>$ASTYLEDIFF; then
# no difference found
rm $m
fi
done

if [ -s "$ASTYLEDIFF" ]; then
if tty -s; then
# review astyle changes
colordiff <$ASTYLEDIFF | less -r
else
echo "Files changed (see $ASTYLEDIFF)"
fi
exit 1
if tty -s; then
# review astyle changes
colordiff <$ASTYLEDIFF | less -r
else
echo "Files changed (see $ASTYLEDIFF)"
fi
exit 1
else
rm $ASTYLEDIFF
rm $ASTYLEDIFF
fi

exit 0
Expand Down
2 changes: 2 additions & 0 deletions scripts/spelling.dat
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ optionnal:optional
optmizations:optimizations
orientatied:orientated
orientied:oriented
orthagonal:orthogonal
orthagonalize:orthogonalize
overaall:overall
overidden:overridden
overide:override
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsactionscoperegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CORE_EXPORT QgsActionScopeRegistry : public QObject
/**
* Create a new QgsActionScopeRegistry.
* QGIS already creates a central registry. You will normally
* want to use QgsApplication::actionScopeRegistry() to get acess
* want to use QgsApplication::actionScopeRegistry() to get access
* to that one instead.
*
* @note Added in QGIS 3.0
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgstaskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ void QgsTaskManager::taskStatusChanged( int status )

if ( status == QgsTask::Terminated )
{
//recursively cancel dependant tasks
//recursively cancel dependent tasks
cancelDependentTasks( id );
}

Expand Down Expand Up @@ -790,9 +790,9 @@ void QgsTaskManager::cancelDependentTasks( long taskId )
{
if ( it.value().contains( cancelledTask ) )
{
// found task with this dependancy
// found task with this dependency

// cancel it - note that this will be recursive, so any tasks dependant
// cancel it - note that this will be recursive, so any tasks dependent
// on this one will also be cancelled
QgsTask* dependentTask = task( it.key() );
if ( dependentTask )
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgstaskmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ class CORE_EXPORT QgsTask : public QObject
* Subtasks allow a single task to be created which
* consists of multiple smaller tasks. Subtasks are not visible or indepedently
* controllable by users. Ownership of the subtask is transferred.
* Subtasks can have an optional list of dependant tasks, which must be completed
* Subtasks can have an optional list of dependent tasks, which must be completed
* before the subtask can begin. By default subtasks are considered independent
* of the parent task, ie they can be run either before, after, or at the same
* time as the parent task. This behaviour can be overriden through the subTaskDependency
* time as the parent task. This behaviour can be overridden through the subTaskDependency
* argument. Note that subtasks should NEVER be dependent on their parent task, and violating
* this constraint will prevent the task from completing successfully.
*
Expand Down Expand Up @@ -381,7 +381,7 @@ class CORE_EXPORT QgsTaskManager : public QObject
long addTask( QgsTask* task, int priority = 0 );

/**
* Adds a task to the manager, using a full task definition (including dependancy
* Adds a task to the manager, using a full task definition (including dependency
* handling). Ownership of the task is transferred to the manager, and the task
* manager will be responsible for starting the task. The priority argument can
* be used to control the run queue's order of execution, with larger numbers
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class CORE_EXPORT QgsStyle : public QObject
*/
QStringList tagsOfSymbol( StyleEntity type, const QString& symbol );

/** Returns wheter a given tag is associated with the symbol
/** Returns whether a given tag is associated with the symbol
*
* \param type is either SymbolEntity or ColorrampEntity
* \param symbol is the name of the symbol or color ramp
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsdwgimportbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<item>
<widget class="QPushButton" name="pbDeselectAll">
<property name="text">
<string>Unselect all</string>
<string>Deselect all</string>
</property>
</widget>
</item>
Expand Down
Loading

2 comments on commit 49055c6

@alexbruy
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems spellchecking causes Travis failures when PR removes some files, see for example https://travis-ci.org/qgis/QGIS/builds/184481431#L1400 or https://travis-ci.org/qgis/QGIS/builds/185214040#L1401

@3nids
Copy link
Member Author

@3nids 3nids commented on 49055c6 Dec 19, 2016

Choose a reason for hiding this comment

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

Yes I noticed. Will fix this asap.

Please sign in to comment.