| 1 | #!/bin/sh
|
|---|
| 2 | # -*- coding: utf-8 -*-
|
|---|
| 3 | ###############################################################################
|
|---|
| 4 | # $Id$
|
|---|
| 5 | #
|
|---|
| 6 | # Project: GDAL
|
|---|
| 7 | # Purpose: (Interactive) script to identify and fix typos
|
|---|
| 8 | # Author: Even Rouault <even.rouault at spatialys.com>
|
|---|
| 9 | #
|
|---|
| 10 | ###############################################################################
|
|---|
| 11 | # Copyright (c) 2016, Even Rouault <even.rouault at spatialys.com>
|
|---|
| 12 | #
|
|---|
| 13 | # Permission is hereby granted, free of charge, to any person obtaining a
|
|---|
| 14 | # copy of this software and associated documentation files (the "Software"),
|
|---|
| 15 | # to deal in the Software without restriction, including without limitation
|
|---|
| 16 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|---|
| 17 | # and/or sell copies of the Software, and to permit persons to whom the
|
|---|
| 18 | # Software is furnished to do so, subject to the following conditions:
|
|---|
| 19 | #
|
|---|
| 20 | # The above copyright notice and this permission notice shall be included
|
|---|
| 21 | # in all copies or substantial portions of the Software.
|
|---|
| 22 | #
|
|---|
| 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|---|
| 24 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|---|
| 25 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|---|
| 26 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|---|
| 27 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|---|
| 28 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|---|
| 29 | # DEALINGS IN THE SOFTWARE.
|
|---|
| 30 | ###############################################################################
|
|---|
| 31 |
|
|---|
| 32 | if ! test -d fix_typos; then
|
|---|
| 33 | # Get our fork of codespell that adds --words-white-list and full filename support for -S option
|
|---|
| 34 | mkdir fix_typos
|
|---|
| 35 | cd fix_typos
|
|---|
| 36 | git clone https://github.com/rouault/codespell
|
|---|
| 37 | cd codespell
|
|---|
| 38 | git checkout gdal_improvements
|
|---|
| 39 | cd ..
|
|---|
| 40 | # Aggregate base dictionary + QGIS one + Debian Lintian one
|
|---|
| 41 | curl https://raw.githubusercontent.com/qgis/QGIS/master/scripts/spelling.dat | sed "s/:/->/" | grep -v "colour->" | grep -v "colours->" > qgis.txt
|
|---|
| 42 | curl https://anonscm.debian.org/cgit/lintian/lintian.git/plain/data/spelling/corrections| grep "||" | grep -v "#" | sed "s/||/->/" > debian.txt
|
|---|
| 43 | cat codespell/data/dictionary.txt qgis.txt debian.txt | awk 'NF' > gdal_dict.txt
|
|---|
| 44 | echo "difered->deferred" >> gdal_dict.txt
|
|---|
| 45 | echo "differed->deferred" >> gdal_dict.txt
|
|---|
| 46 | cat gdal_dict.txt | grep -v 404 > gdal_dict.txt.tmp
|
|---|
| 47 | mv gdal_dict.txt.tmp gdal_dict.txt
|
|---|
| 48 | cd ..
|
|---|
| 49 | fi
|
|---|
| 50 |
|
|---|
| 51 | EXCLUDED_FILES="*/.svn*,configure,config.status,config.sub,*/autom4te.cache/*"
|
|---|
| 52 | EXCLUDED_FILES="$EXCLUDED_FILES,*/hdf-eos/*,teststream.out,ogrogdilayer.cpp"
|
|---|
| 53 | EXCLUDED_FILES="$EXCLUDED_FILES,*/doc/br/*,*/data/*,figures.mp,*/tmp/*,*/ruby/*"
|
|---|
| 54 | EXCLUDED_FILES="$EXCLUDED_FILES,*/fix_typos/*,fix_typos.sh,*.eps,geopackage_aspatial.html"
|
|---|
| 55 | EXCLUDED_FILES="$EXCLUDED_FILES,*/kdu_cache_wrapper.h,*/PublicDecompWT/*,*/man/*,./html/*"
|
|---|
| 56 | EXCLUDED_FILES="$EXCLUDED_FILES,PROVENANCE.TXT,libtool,ltmain.sh,libtool.m4,./m4/*"
|
|---|
| 57 | WORDS_WHITE_LIST="poSession,FIDN,TRAFIC,HTINK,repID,oCurr,INTREST,oPosition"
|
|---|
| 58 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,CPL_SUPRESS_CPLUSPLUS,SRP_NAM,ADRG_NAM,'SRP_NAM,AuxilaryTarget"
|
|---|
| 59 | # IRIS driver metadata item names: FIXME ?
|
|---|
| 60 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,TOP_OF_HEIGTH_INTERVAL,BOTTOM_OF_HEIGTH_INTERVAL"
|
|---|
| 61 | # libjpeg
|
|---|
| 62 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,JBUF_PASS_THRU"
|
|---|
| 63 | # libgif
|
|---|
| 64 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,IS_WRITEABLE,E_GIF_ERR_NOT_WRITEABLE"
|
|---|
| 65 | # libtiff
|
|---|
| 66 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,THRESHHOLD_BILEVEL,THRESHHOLD_HALFTONE,THRESHHOLD_ERRORDIFFUSE"
|
|---|
| 67 | # mffdataset.cpp
|
|---|
| 68 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,oUTMorLL"
|
|---|
| 69 | # hf2dataset.cpp
|
|---|
| 70 | WORDS_WHITE_LIST="$WORDS_WHITE_LIST,fVertPres"
|
|---|
| 71 |
|
|---|
| 72 | python3 fix_typos/codespell/codespell.py -w -i 3 -q 2 -S $EXCLUDED_FILES \
|
|---|
| 73 | -x scripts/typos_whitelist.txt --words-white-list=$WORDS_WHITE_LIST \
|
|---|
| 74 | ../autotest
|
|---|
| 75 | python3 fix_typos/codespell/codespell.py -w -i 3 -q 2 -S $EXCLUDED_FILES \
|
|---|
| 76 | -x scripts/typos_whitelist.txt --words-white-list=$WORDS_WHITE_LIST \
|
|---|
| 77 | -D ./fix_typos/gdal_dict.txt .
|
|---|