xref: /oneTBB/.github/scripts/codespell.sh (revision e1b24895)
1#!/bin/bash
2#
3# Copyright (c) 2021 Intel Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17SCAN_TARGET=$1
18
19SKIP_PATTERN='*/.github/*'
20
21# Ignored cases
22IGNORE_COMMAND="sed -e /.*\\sOd\\s*=.*/d \
23-e /.*\\sOt\\s*=.*/d \
24-e /.*\\siff\\s*=.*/d \
25-e /.*\\sith\\s*=.*/d \
26-e /.*\\scas\\s*=.*/d \
27-e /.*\\sCAS\\s*=.*/d \
28-e /.*\\ssom\\s*=.*/d \
29-e /.*\\sSOM\\s*=.*/d \
30-e /.*\\suint\\s*=.*/d \
31-e /.*\\sUINT\\s*=.*/d \
32-e /.*\\scopyable\\s*=.*/d \
33-e /.*\\sCopyable\\s*=.*/d \
34-e /.*\\sFo\\s*=.*/d \
35-e /.*pipeline_filters.h.*nd\\s*=.*/d \
36-e /.*ittnotify.h.*unx\\s*=.*/d \
37-e /.*bzlib.cpp.*MSDOS\\s*=.*/d \
38-e /.*test_task.cpp.*tE\\s*=.*/d \
39-e /.*backend.cpp.*resSize\\s*=.*/d \
40-e /.*test_join_node.h.*Ned\\s*=.*/d \
41-e /.*test_indexer_node.cpp.*OT\\s*=.*/d \
42-e /.*allocator_stl_test_common.h.*Aci*\\s*=.*/d \
43-e /.*seismic_video.cpp.*DialogBox\\s*=.*/d \
44-e /.*test_composite_node.cpp.*que\\s*=.*/d \
45-e /.*blocksort.cpp.*hiSt\\s*=.*/d \
46-e /.*compress.cpp.*fave\\s*=.*/d \
47-e /.*count_strings.cpp.*ue\\s*=.*/d \
48-e /.*count_strings.cpp.*nd\\s*=.*/d \
49-e /.*count_strings.cpp.*ths\\s*=.*/d \
50-e /.*polygon_overlay\/README.md.*ist\\s*=.*/d \
51-e /.*_pipeline_filters.h.*nd\\s*=.*/d \
52-e /.*sub_string_finder\/README.md.*ba\\s*=.*/d"
53
54SCAN_RESULT=`codespell --quiet-level=2 --skip "${SKIP_PATTERN}" ${SCAN_TARGET}`
55SCAN_RESULT=`echo -e "${SCAN_RESULT}" | ${IGNORE_COMMAND}`
56echo "${SCAN_RESULT}"
57
58if [[ ! -z ${SCAN_RESULT} ]]; then
59    exit 1
60fi
61