From da99f9e9553ae5dea43689a447c5df85d68be701 Mon Sep 17 00:00:00 2001 From: kegilbert Date: Fri, 30 Nov 2018 17:56:11 -0600 Subject: [PATCH] Add doxygen spellcheck jobs to Travis Currently tests - drivers - platform - rtos - events - features/netsocket --- .travis.yml | 22 +- drivers/MbedCRC.h | 2 +- features/netsocket/TLSSocketWrapper.h | 4 +- .../PPPCellularInterface.h | 2 +- platform/ATCmdParser.h | 4 +- platform/mbed_critical.h | 4 +- platform/mbed_error.h | 2 +- tools/test/travis-ci/doxy-spellchecker/en.dat | 6 + .../travis-ci/doxy-spellchecker/en_affix.dat | 226 ++++++++++++++++ .../travis-ci/doxy-spellchecker/en_phonet.dat | 250 ++++++++++++++++++ .../travis-ci/doxy-spellchecker/ignore.en.pws | 93 +++++++ .../test/travis-ci/doxy-spellchecker/spell.sh | 123 +++++++++ 12 files changed, 728 insertions(+), 10 deletions(-) create mode 100644 tools/test/travis-ci/doxy-spellchecker/en.dat create mode 100644 tools/test/travis-ci/doxy-spellchecker/en_affix.dat create mode 100644 tools/test/travis-ci/doxy-spellchecker/en_phonet.dat create mode 100644 tools/test/travis-ci/doxy-spellchecker/ignore.en.pws create mode 100755 tools/test/travis-ci/doxy-spellchecker/spell.sh diff --git a/.travis.yml b/.travis.yml index 2b37e5503b..e9a7df73f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -122,7 +122,27 @@ matrix: after_success: # Coverage for tools - coveralls - # Report success since we have overridden default behaviour + # Report success since we have overridden default behavior + - bash -c "$STATUS" success "Local $NAME testing has passed" + + - env: + - NAME=doxy-spellcheck + + install: + - sudo apt-get install aspell + + script: + # Run local testing on header file doxy + - ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers + - ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform + - ./tools/test/travis-ci/doxy-spellchecker/spell.sh events + - ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos + - ./tools/test/travis-ci/doxy-spellchecker/spell.sh features/netsocket + + after_success: + # Coverage for tools + - coveralls + # Report success since we have overridden default behavior - bash -c "$STATUS" success "Local $NAME testing has passed" # - <<: *tools-pytest diff --git a/drivers/MbedCRC.h b/drivers/MbedCRC.h index 9e99e9049f..60227e0826 100644 --- a/drivers/MbedCRC.h +++ b/drivers/MbedCRC.h @@ -497,7 +497,7 @@ private: } /** Constructor init called from all specialized cases of constructor. - * Note: All construtor common code should be in this function. + * Note: All constructor common code should be in this function. */ void mbed_crc_ctor(void) { diff --git a/features/netsocket/TLSSocketWrapper.h b/features/netsocket/TLSSocketWrapper.h index bffdd97d2b..78451a28f4 100644 --- a/features/netsocket/TLSSocketWrapper.h +++ b/features/netsocket/TLSSocketWrapper.h @@ -168,7 +168,7 @@ public: */ void set_ssl_config(mbedtls_ssl_config *conf); - /** Get internal Mbed TLS contect structure. + /** Get internal Mbed TLS context structure. * @return SSL context */ mbedtls_ssl_context *get_ssl_context(); @@ -198,7 +198,7 @@ protected: private: - /** Continue already initialised handshake */ + /** Continue already initialized handshake */ nsapi_error_t continue_handshake(); /** * Helper for pretty-printing mbed TLS error codes diff --git a/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.h b/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.h index 4f98293f3c..b0658c77dd 100644 --- a/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.h +++ b/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.h @@ -214,7 +214,7 @@ public: * connection. It doesn't do anything immediately other than setting up flags. * * @param set can be set to true if the SIM pin check is supposed to be enabled - * and vice versa. + * and false if not. */ MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use mbed-os/features/cellular/easy_cellular/EasyCellularConnection.h instead.") void set_sim_pin_check(bool set); diff --git a/platform/ATCmdParser.h b/platform/ATCmdParser.h index 927b24d992..ee60813834 100644 --- a/platform/ATCmdParser.h +++ b/platform/ATCmdParser.h @@ -171,7 +171,7 @@ public: /** * Allows traces from modem to be turned on or off * - * @param on Set as 1 to turn on traces and vice versa. + * @param on Set as 1 to turn on traces and 0 to disable traces. */ void debug_on(uint8_t on) { @@ -184,7 +184,7 @@ public: * * Allows traces from modem to be turned on or off * - * @param on Set as 1 to turn on traces and vice versa. + * @param on Set as 1 to turn on traces and 0 to disable traces. */ MBED_DEPRECATED_SINCE("mbed-os-5.5.0", "Replaced with debug_on for consistency") void debugOn(uint8_t on) diff --git a/platform/mbed_critical.h b/platform/mbed_critical.h index c4a510ca8e..28a6396b6d 100644 --- a/platform/mbed_critical.h +++ b/platform/mbed_critical.h @@ -93,14 +93,14 @@ bool core_util_in_critical_section(void); * A lock-free, primitive atomic flag. * * Emulate C11's atomic_flag. The flag is initially in an indeterminate state - * unless explicitly initialised with CORE_UTIL_ATOMIC_FLAG_INIT. + * unless explicitly initialized with CORE_UTIL_ATOMIC_FLAG_INIT. */ typedef struct core_util_atomic_flag { uint8_t _flag; } core_util_atomic_flag; /** - * Initialiser for a core_util_atomic_flag. + * Initializer for a core_util_atomic_flag. * * Example: * ~~~ diff --git a/platform/mbed_error.h b/platform/mbed_error.h index d91c967f6c..692336154e 100644 --- a/platform/mbed_error.h +++ b/platform/mbed_error.h @@ -948,7 +948,7 @@ typedef void (*mbed_error_hook_t)(const mbed_error_ctx *error_ctx); * it will auto-reboot the system(if MBED_CONF_PLATFORM_FATAL_ERROR_AUTO_REBOOT_ENABLED is enabled) after capturing the * error info in special crash data RAM region. Once rebooted, MbedOS initialization routines will call this function with a pointer to * the captured mbed_error_ctx structure. If application implementation needs to receive this callback, mbed_error_reboot_callback - * function should be overriden with custom implementation. By default it's defined as a WEAK function in mbed_error.c. + * function should be overridden with custom implementation. By default it's defined as a WEAK function in mbed_error.c. * Note that this callback will be invoked before the system starts executing main() function. So the implementation of * the callback should be aware any resource limitations/availability of resources which are yet to be initialized by application main(). * diff --git a/tools/test/travis-ci/doxy-spellchecker/en.dat b/tools/test/travis-ci/doxy-spellchecker/en.dat new file mode 100644 index 0000000000..ec2555ee21 --- /dev/null +++ b/tools/test/travis-ci/doxy-spellchecker/en.dat @@ -0,0 +1,6 @@ +name en +charset iso8859-1 +soundslike en +affix en +special ' -*- 0 *** 1 *** 2 *** 3 *** 4 *** 5 *** 6 *** 7 *** 8 *** 9 *** < *** > *** _ *** +#repl-table en_affix.dat diff --git a/tools/test/travis-ci/doxy-spellchecker/en_affix.dat b/tools/test/travis-ci/doxy-spellchecker/en_affix.dat new file mode 100644 index 0000000000..e753407a0d --- /dev/null +++ b/tools/test/travis-ci/doxy-spellchecker/en_affix.dat @@ -0,0 +1,226 @@ +# +# This affix file is based on Ispell, which is under the following +# copyright: +# +# Copyright 1992, 1993, 1999, 2000, 2001, Geoff Kuenning, Claremont, CA +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions, and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All modifications to the source code must be clearly marked as +# such. Binary redistributions based on modified source code +# must be clearly marked as modified versions in the documentation +# and/or other materials provided with the distribution. +# (Clause 4 removed with permission from Geoff Kuenning.) +# 5. The name of Geoff Kuenning may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +SET ISO8859-1 +TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' + +PFX A Y 1 +PFX A 0 re . + +PFX I Y 1 +PFX I 0 in . + +PFX U Y 1 +PFX U 0 un . + +PFX C Y 1 +PFX C 0 de . + +PFX E Y 1 +PFX E 0 dis . + +PFX F Y 1 +PFX F 0 con . + +PFX K Y 1 +PFX K 0 pro . + +SFX V N 2 +SFX V e ive e +SFX V 0 ive [^e] + +SFX N Y 3 +SFX N e ion e +SFX N y ication y +SFX N 0 en [^ey] + +SFX X Y 3 +SFX X e ions e +SFX X y ications y +SFX X 0 ens [^ey] + +SFX H N 2 +SFX H y ieth y +SFX H 0 th [^y] + +SFX Y Y 1 +SFX Y 0 ly . + +SFX G Y 2 +SFX G e ing e +SFX G 0 ing [^e] + +SFX J Y 2 +SFX J e ings e +SFX J 0 ings [^e] + +SFX D Y 4 +SFX D 0 d e +SFX D y ied [^aeiou]y +SFX D 0 ed [^ey] +SFX D 0 ed [aeiou]y + +SFX T N 4 +SFX T 0 st e +SFX T y iest [^aeiou]y +SFX T 0 est [aeiou]y +SFX T 0 est [^ey] + +SFX R Y 4 +SFX R 0 r e +SFX R y ier [^aeiou]y +SFX R 0 er [aeiou]y +SFX R 0 er [^ey] + +SFX Z Y 4 +SFX Z 0 rs e +SFX Z y iers [^aeiou]y +SFX Z 0 ers [aeiou]y +SFX Z 0 ers [^ey] + +SFX S Y 4 +SFX S y ies [^aeiou]y +SFX S 0 s [aeiou]y +SFX S 0 es [sxzh] +SFX S 0 s [^sxzhy] + +SFX P Y 3 +SFX P y iness [^aeiou]y +SFX P 0 ness [aeiou]y +SFX P 0 ness [^y] + +SFX M Y 1 +SFX M 0 's . + +SFX B Y 3 +SFX B 0 able [^aeiou] +SFX B 0 able ee +SFX B e able [^aeiou]e + +SFX L Y 1 +SFX L 0 ment . + +REP 88 +REP a ei +REP ei a +REP a ey +REP ey a +REP ai ie +REP ie ai +REP are air +REP are ear +REP are eir +REP air are +REP air ere +REP ere air +REP ere ear +REP ere eir +REP ear are +REP ear air +REP ear ere +REP eir are +REP eir ere +REP ch te +REP te ch +REP ch ti +REP ti ch +REP ch tu +REP tu ch +REP ch s +REP s ch +REP ch k +REP k ch +REP f ph +REP ph f +REP gh f +REP f gh +REP i igh +REP igh i +REP i uy +REP uy i +REP i ee +REP ee i +REP j di +REP di j +REP j gg +REP gg j +REP j ge +REP ge j +REP s ti +REP ti s +REP s ci +REP ci s +REP k cc +REP cc k +REP k qu +REP qu k +REP kw qu +REP o eau +REP eau o +REP o ew +REP ew o +REP oo ew +REP ew oo +REP ew ui +REP ui ew +REP oo ui +REP ui oo +REP ew u +REP u ew +REP oo u +REP u oo +REP u oe +REP oe u +REP u ieu +REP ieu u +REP ue ew +REP ew ue +REP uff ough +REP oo ieu +REP ieu oo +REP ier ear +REP ear ier +REP ear air +REP air ear +REP w qu +REP qu w +REP z ss +REP ss z +REP shun tion +REP shun sion +REP shun cion diff --git a/tools/test/travis-ci/doxy-spellchecker/en_phonet.dat b/tools/test/travis-ci/doxy-spellchecker/en_phonet.dat new file mode 100644 index 0000000000..41a8b090c0 --- /dev/null +++ b/tools/test/travis-ci/doxy-spellchecker/en_phonet.dat @@ -0,0 +1,250 @@ +# phonetic_english.h - phonetic transformation rules for use with phonetic.c +# Copyright (C) 2000 Bjoern Jacke +# +# This rule set is based on Lawrence Phillips original metaphone +# algorithm with modifications made by Michael Kuhn in his +# C implantation, more modifications by Bjoern Jacke when +# converting the algorithm to a rule set and minor +# touch ups by Kevin Atkinson +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation; +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Bjoern Jacke may be reached by email at bjoern.jacke@gmx.de +# +# Changelog: +# +# 2000-01-05 Bjoern Jacke +# - first version with translation rules derived from +# metaphone.cc distributed with aspell 0.28.3 +# - "TH" is now representated as "@" because "0" is a +# meta character +# - removed TH(!vowel) --> T; always use TH --> # instead +# - dropped "^AE" -> "E" (redundant) +# - "ing" is transformed to "N", not "NK" +# - "SCH(EO)" transforms to "SK" now +# - added R --> SILENT if (after a vowel) and no (vowel or +# "y" follows) like in "Marcy" or "abort" +# - H is SILENT in RH at beginning of words +# - H is SILENT if vowel leads and "Y" follows +# - some ".OUGH.." --> ...F exceptions added +# - "^V" transforms to "W" +# 2000-01-07 Kevin Atkinson +# Converted from header to data file. +# + +version 1.1 + +AH(AEIOUY)-^ *H +AR(AEIOUY)-^ *R +A(HR)^ * +A^ * +AH(AEIOUY)- H +AR(AEIOUY)- R +A(HR) _ +BB- _ +B B +CQ- _ +CIA X +CH X +C(EIY)- S +CK K +COUGH^ KF +CC< C +C K +DG(EIY) K +DD- _ +D T +É< E +EH(AEIOUY)-^ *H +ER(AEIOUY)-^ *R +E(HR)^ * +ENOUGH^$ *NF +E^ * +EH(AEIOUY)- H +ER(AEIOUY)- R +E(HR) _ +FF- _ +F F +GN^ N +GN$ N +GNS$ NS +GNED$ N +GH(AEIOUY)- K +GH _ +GG9 K +G K +H H +IH(AEIOUY)-^ *H +IR(AEIOUY)-^ *R +I(HR)^ * +I^ * +ING6 N +IH(AEIOUY)- H +IR(AEIOUY)- R +I(HR) _ +J K +KN^ N +KK- _ +K K +LAUGH^ LF +LL- _ +L L +MB$ M +MM M +M M +NN- _ +N N +OH(AEIOUY)-^ *H +OR(AEIOUY)-^ *R +O(HR)^ * +O^ * +OH(AEIOUY)- H +OR(AEIOUY)- R +O(HR) _ +PH F +PN^ N +PP- _ +P P +Q K +RH^ R +ROUGH^ RF +RR- _ +R R +SCH(EOU)- SK +SC(IEY)- S +SH X +SI(AO)- X +SS- _ +S S +TI(AO)- X +TH @ +TCH-- _ +TOUGH^ TF +TT- _ +T T +UH(AEIOUY)-^ *H +UR(AEIOUY)-^ *R +U(HR)^ * +U^ * +UH(AEIOUY)- H +UR(AEIOUY)- R +U(HR) _ +V^ W +V F +WR^ R +WH^ W +W(AEIOU)- W +X^ S +X KS +Y(AEIOU)- Y +ZZ- _ +Z S + +#The rules in a different view: +# +# Exceptions: +# +# Beginning of word: "gn", "kn-", "pn-", "wr-" ----> drop first letter +# "Aebersold", "Gnagy", "Knuth", "Pniewski", "Wright" +# +# Beginning of word: "x" ----> change to "s" +# as in "Deng Xiaopeng" +# +# Beginning of word: "wh-" ----> change to "w" +# as in "Whalen" +# Beginning of word: leading vowels are transformed to "*" +# +# "[crt]ough" and "enough" are handled separately because of "F" sound +# +# +# A --> A at beginning +# _ otherwise +# +# B --> B unless at the end of word after "m", as in "dumb", "McComb" +# +# C --> X (sh) if "-cia-" or "-ch-" +# S if "-ci-", "-ce-", or "-cy-" +# SILENT if "-sci-", "-sce-", or "-scy-", or "-cq-" +# K otherwise, including in "-sch-" +# +# D --> K if in "-dge-", "-dgy-", or "-dgi-" +# T otherwise +# +# E --> A at beginnig +# _ SILENT otherwise +# +# F --> F +# +# G --> SILENT if in "-gh-" and not at end or before a vowel +# in "-gn" or "-gned" or "-gns" +# in "-dge-" etc., as in above rule +# K if before "i", or "e", or "y" if not double "gg" +# +# K otherwise (incl. "GG"!) +# +# H --> SILENT if after vowel and no vowel or "Y" follows +# or after "-ch-", "-sh-", "-ph-", "-th-", "-gh-" +# or after "rh-" at beginning +# H otherwise +# +# I --> A at beginning +# _ SILENT otherwise +# +# J --> K +# +# K --> SILENT if after "c" +# K otherwise +# +# L --> L +# +# M --> M +# +# N --> N +# +# O --> A at beginning +# _ SILENT otherwise +# +# P --> F if before "h" +# P otherwise +# +# Q --> K +# +# R --> SILENT if after vowel and no vowel or "Y" follows +# R otherwise +# +# S --> X (sh) if before "h" or in "-sio-" or "-sia-" +# SK if followed by "ch(eo)" (SCH(EO)) +# S otherwise +# +# T --> X (sh) if "-tia-" or "-tio-" +# 0 (th) if before "h" +# silent if in "-tch-" +# T otherwise +# +# U --> A at beginning +# _ SILENT otherwise +# +# V --> V if first letter of word +# F otherwise +# +# W --> SILENT if not followed by a vowel +# W if followed by a vowel +# +# X --> KS +# +# Y --> SILENT if not followed by a vowel +# Y if followed by a vowel +# +# Z --> S + diff --git a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws new file mode 100644 index 0000000000..d01b6d4f67 --- /dev/null +++ b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws @@ -0,0 +1,93 @@ +personal_ws-1.1 en 1600 utf-8 +_code_ +mbed +rtos +malloc +mutex +tx +rx +wi +fi +rr +sd +pc +vtable +nmemb +relloc +printf +arg +scanf +fclose +fputs +usb +or'd +MMmmpp +multithread +multithreaded +initializer +lookup +startup +unreferenced +singleshot +multishot +inlined +allocator +parameterized +XORed +unbuffered +sizeof +stringification +interoperability +memcpy +nack +mbit +retval +dequeue +assertation +destructor +constructor +ctor +dtor +dereference +ptr +templated +templatize +accessor +init +deleters +decrement +increment +deinitialize +deinitializes +atomicity +pointee +entrancy +Systick +noop +deassert +deasserts +deasserted +getter +setter +preallocated +ascii +IPv +param +struct +typedef +typedefs +onboard +enum +endian +emac +emacs +json +noncopyable +sendto +multicast +multicasts +singleshot +multishot +_doxy_ +sa +tparam diff --git a/tools/test/travis-ci/doxy-spellchecker/spell.sh b/tools/test/travis-ci/doxy-spellchecker/spell.sh new file mode 100755 index 0000000000..e56c33e646 --- /dev/null +++ b/tools/test/travis-ci/doxy-spellchecker/spell.sh @@ -0,0 +1,123 @@ +#!/bin/bash -eu +# mbed Microcontroller Library +# Copyright (c) 2018 ARM Limited +# SPDX-License-Identifier: Apache-2.0 + +set -o pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +ERRORS=0 + +# Loops use here strings to allow them to run in the main shell and modify the correct version of +# the error counter global variable +while read file; do + echo "${file}" + res=$(awk '/\/\*\*/,/\*\//' "${file}" | cut -d '/' -f2 | sed 's/0x[^ ]*//' | sed 's/[0-9]*//g') + + # Select a token to begin on, then a formating option such as strip all text between the start + # and end token, strip an entire line containing the start token, or strip a portion of a line + # containing the start token. Select an appropiate end token. The tokens and formats are index + # matched. + start_tokens=( "/@code" + "/addtogroup" + "defgroup" + "<" + "()" + ) + + formats=( 'strip_between' + 'strip_between' + 'strip_line' + 'strip_between_sameline' + 'strip_token' + ) + + end_tokens=( "/@endcode" + "/\*" + "" + ">" + "" + ) + + # Stripping strings between tokens P1-P2 and P3-P4 inclusively ran into issues depending + # on if the tokens were on the same line or not. + #_________________________________________ + # Don't remove this P1 remove me P2 + # Keep me + # P3 + # Remove me too please + # P4 + # Keep me too + # Still here P1 But this shouldn't be P2 + #_________________________________________ + # + # Opted for having two separate formats. In particular this formatting issue came up when + # trying to strip the code segments and template type arguments between '<, >' as the multiline + # sed command would strip the entire line, causing the removal string to span across the entire file + # when trying to match the next end token (above format when stripping everything between P1 and P2 + # would end up with just "Don't remove this" and the rest of the file stripped). + + for ((i=0;i<${#start_tokens[@]};++i)); do + filter="" + if [[ "${formats[i]}" == 'strip_between' ]]; then + filter=$(<<< "${res}" sed "${start_tokens[i]}/,${end_tokens[i]}/d") + elif [[ "${formats[i]}" == 'strip_between_sameline' ]]; then + filter=$(<<< "${res}" sed -e "s/"${start_tokens[i]}".*"${end_tokens[i]}"//") + elif [[ "${formats[i]}" == 'strip_line' ]]; then + filter=$(<<< "${res}" sed "/"${start_tokens[i]}"/ d") + elif [[ "${formats[i]}" == 'strip_token' ]]; then + filter=$(<<< "${res}" sed "s/"${start_tokens[i]}"//g") + fi + + if [ "${filter}" != "" ]; then + res=${filter} + fi + done + + if [ "${2:-}" == "-vv" ]; then + echo "${res}" + fi + + prev_err=("") + while read err; do + if [ $(echo "${res}" | grep "${err}" | wc -l) -eq $(grep "${err}" "${file}" | wc -l) ]; then + # Do not count all caps words as errors (RTOS, WTI, etc) or plural versions (APNs/MTD's) + if ! [[ ${err} =~ ^[A-Z]+$ || ${err} =~ ^[A-Z]+s$ || ${err} =~ ^[A-Z]+\'s$ ]]; then + + # Disregard camelcase/underscored words. Hex was stripped at the beginning + if ! echo "${err}" | grep --quiet -E '[a-z]{1,}[A-Z]|_'; then + + # The grep command to fetch the line numbers will report all instances, do not + # list repeated error words found from aspell in each file + if ! [[ ${prev_err[*]} =~ "${err}" ]]; then + prev_err+=("${err}") + + if [ ${#prev_err[@]} -eq 2 ]; then + echo "=================================" + echo "Errors: " + fi + + while read ln; do + echo "${ln} ${err}" + ERRORS=$((ERRORS + 1)) + done <<< "$(grep -n "${err}" "${file}" | cut -d ' ' -f1)" + fi + fi + fi + fi + done <<< "$(echo "${res}" | aspell list -C --ignore-case -p "${DIR}"/ignore.en.pws --local-data-dir "${DIR}")" + + if [ ${#prev_err[@]} -ne 1 ]; then + echo "_________________________________" + fi + +done < <(find "${1}" -type d -iname "*target*" -prune -o -name '*.h' -print) + +echo "----------------------------------------------------------------------------------" +echo "Total Errors Found: ${ERRORS}" + +if [ ${ERRORS} -ne 0 ]; then + echo "If any of the failed words should be considered valid please add them to the ignore.en.pws file"\ + "found in tools/test/scripts/doxy-spellchecker between the _code_ and _doxy_ tags." + exit 1 +fi