diff --git a/spellings/action.yml b/spellings/action.yml index f4d984cf..833bb4fc 100644 --- a/spellings/action.yml +++ b/spellings/action.yml @@ -30,7 +30,7 @@ runs: shell: bash run: | # ${{ env.stepName }} - echo -e "::group::Install Dependencies" + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" # Install the Dependencies we need to run the spell-checker sudo apt-get install util-linux -y @@ -39,16 +39,20 @@ runs: sudo npm install -g cspell echo -e "::endgroup::" - # Add the current directory to PATH + # Add the Github Action Path to PATH export PATH="$GITHUB_ACTION_PATH:$PATH" - # cp has an error code if it's asked to copy to the same file - # Wrap it in a set +e in case the input path is the working directory + # Account for starting with an alternate path in a repository + # Do this by copying the cspell config and wordlist to the desired path + # Wrap in a set +e so Github doesn't throw an error if the file or + # directory already exists. set +e - cp $GITHUB_ACTION_PATH/cspell.config.yaml ${{ inputs.path }} + cp cspell.config.yaml ${{ inputs.path }} + mkdir ${{ inputs.path }}/.github + cp .github/.cSpellWords.txt ${{ inputs.path }}/.github + cd ${{ inputs.path }} set -e - # Make sure we have all the commands we need. echo -e "${{ env.bashInfo }} fdfind --version $(fdfind --version) ${{ env.bashEnd }}" echo -e "${{ env.bashInfo }} cspell --version $(cspell --version) ${{ env.bashEnd }}" @@ -99,10 +103,12 @@ runs: args+=" ${file_types}" fi + echo -e "${{ env.bashInfo }} Running: fdfind -e c -e h -e md -e txt -e readme ${args} --exec cspell lint --language-id C --color --show-context --show-suggestions --no-must-find-files -c cspell.config.yaml ${{ env.bashEnd }}" + # Wrap in a set +e so Github doesn't stop the spell check from running set +e - echo -e echo -e "${{ env.bashInfo }} Running: fdfind -e c -e h -e md -e txt -e readme ${args} --exec cspell lint --language-id C --color --show-context --show-suggestions --no-must-find-files -c cspell.config.yaml ${{ env.bashEnd }}" + # Find all relevant files, then check them for spelling mistakes fdfind -e c -e h -e md -e txt -e readme ${args} --exec-batch \ cspell lint --language-id C --color --show-context --show-suggestions --no-must-find-files -c cspell.config.yaml exitStatus=$? diff --git a/spellings/cspell.config.yaml b/spellings/cspell.config.yaml index 331f137e..911ce1d8 100644 --- a/spellings/cspell.config.yaml +++ b/spellings/cspell.config.yaml @@ -3,24 +3,28 @@ $schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell version: '0.2' # Allows things like stringLength allowCompoundWords: true + +# Read files not to spell check from the git ignore useGitignore: true + +# Language settings for C languageSettings: - - allowCompoundWords: true - caseSensitive: false + - caseSensitive: false enabled: true languageId: c locale: "*" -# Could split this up? And do a dictionary for each repo? -# But feel like if this isn't super slow -# That having just one single dictionary might be nicer? + +# Add a dictionary, and the path to the word list dictionaryDefinitions: - name: freertos-words path: '.github/.cSpellWords.txt' addWords: true + dictionaries: - freertos-words + +# Paths and files to ignore ignorePaths: - - '.cSpellWords.txt' - 'dependency' - 'docs' - 'ThirdParty'