Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Kladov <artem.kladov@flant.com>
  • Loading branch information
z9r5 committed May 8, 2024
1 parent 2d720f6 commit db3cb2f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions tools/spelling/internal/check_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ function check() {
local file_name=$1
local file_changes=$2

if [[ -n "$file_name" ]] && [[ -n "$file_changes" ]]; then
if [[ -n "${file_name}" ]] && [[ -n "${file_changes}" ]]; then
local result=$(file_diff_check_spell ${file_name} "${file_changes}")
if [ -n "$result" ]; then
echo "${OUTPUT_PREFIX_FILE} $(echo \"${file_name}\" | sed '#^\./#d'):"
echo "$result"
if [ -n "${result}" ]; then
echo "${MSG_PREFIX_FILE_TYPOS} $(echo \"${file_name}\" | sed '#^\./#d'):"
echo "${result}"
exit_code=1
fi
fi
}

while IFS= read -r line
do
if [[ "${line}" =~ $diff_start_re ]]; then
check "$file_name" "$file_changes"
if [[ "${line}" =~ ${diff_start_re} ]]; then
check "${file_name}" "${file_changes}"
metadata_block=true
skip_file=false
file_changes=""
Expand All @@ -50,12 +50,12 @@ do
metadata_block=false
continue
fi
if [ $metadata_block = true ] || [ $skip_file = true ]; then
if [ ${metadata_block} = true ] || [ ${skip_file} = true ]; then
continue
fi
file_changes+=$(echo "$line" | sed 's/^[+-]//')
done < $pr_diff
file_changes+=$(echo "${line}" | sed 's/^[+-]//')
done < ${pr_diff}

check "$file_name" "$file_changes"
check "${file_name}" "${file_changes}"

exit exit_code
exit ${exit_code}
2 changes: 1 addition & 1 deletion tools/spelling/internal/container_spell_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ __EOF__
if [ -n "$result" ]; then
unset ex_result
ex_result=1
echo "${OUTPUT_PREFIX_FILE} $(echo ${file} | sed '#^\./#d'):"
echo "${MSG_PREFIX_FILE_TYPOS} $(echo ${file} | sed '#^\./#d'):"
echo $result | sed 's/\s\+/\n/g'
echo
fi
Expand Down
2 changes: 1 addition & 1 deletion tools/spelling/internal/spell_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DICTIONARIES="/app/dictionaries/ru_RU,/app/dictionaries/en_US,/app/dictionaries/
FILES_TO_IGNORE="$(dirname "$(realpath "$0")")/filesignore"
FILES_MATCH_PATTERN='.+(.md|.html|.htm|.liquid|.yaml|.yml)$'

OUTPUT_PREFIX_FILE="Possible typos in"
MSG_PREFIX_FILE_TYPOS="Possible typos in"

# Returns 0 if file should be processed, 1 if it should be skipped
# Function to validate a given file name against a list of files to ignore
Expand Down

0 comments on commit db3cb2f

Please sign in to comment.