Skip to content

Commit 344208a

Browse files
[MERGE] Integrates Various Improvements (- WIP #199 -)
Impacts PRs: * Includes and Superceeds PR/MR #321 * Includes and Superceeds PR/MR #322 * Includes and Superceeds PR/MR #323 * Includes and Superceeds PR/MR #325 Impacts GHI: - [x] Closes #266 - [x] Closes #272 - [x] Closes #151 ---
3 parents 3bc6f8b + 923ad9d + e0819a9 commit 344208a

File tree

5 files changed

+45
-14
lines changed

5 files changed

+45
-14
lines changed

.github/workflows/CI-BUILD.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ jobs:
163163
- id: check_status
164164
run: |
165165
if [[ "${{ needs.BUILD.result }}" == "success" && "${{ needs.BOOTSTRAP.result }}" == "success" ]]; then
166-
echo "build_success=true" >> $GITHUB_OUTPUT
166+
echo "build_success=true" >> "$GITHUB_OUTPUT"
167167
else
168-
echo "build_success=false" >> $GITHUB_OUTPUT
168+
echo "build_success=false" >> "$GITHUB_OUTPUT"
169169
fi

.github/workflows/CI-MATs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ jobs:
4343
- id: check
4444
run: |
4545
if [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
46-
echo "should_run=true" >> $GITHUB_OUTPUT
46+
echo "should_run=true" >> "$GITHUB_OUTPUT"
4747
else
48-
echo "should_run=false" >> $GITHUB_OUTPUT
48+
echo "should_run=false" >> "$GITHUB_OUTPUT"
4949
fi
5050
- id: get_env
5151
run: |
5252
ENV_VALUE=$(gh api "${{ github.event.workflow_run.artifacts_url }}" --jq '.environment')
5353
if [[ -n "$ENV_VALUE" ]]; then
54-
echo "environment=$ENV_VALUE" >> $GITHUB_OUTPUT
54+
echo "environment=$ENV_VALUE" >> "$GITHUB_OUTPUT"
5555
else
56-
echo "environment=Experimenting" >> $GITHUB_OUTPUT # Default fallback
56+
echo "environment=Experimenting" >> "$GITHUB_OUTPUT" # Default fallback
5757
fi
5858
5959
MATS:
@@ -121,7 +121,7 @@ jobs:
121121
- id: check_status
122122
run: |
123123
if [[ "${{ needs.MATS.result }}" == "success" ]]; then
124-
echo "mats_success=true" >> $GITHUB_OUTPUT
124+
echo "mats_success=true" >> "$GITHUB_OUTPUT"
125125
else
126-
echo "mats_success=false" >> $GITHUB_OUTPUT
126+
echo "mats_success=false" >> "$GITHUB_OUTPUT"
127127
fi

.github/workflows/Tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ jobs:
4242
- id: check
4343
run: |
4444
if [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
45-
echo "should_run=true" >> $GITHUB_OUTPUT
45+
echo "should_run=true" >> "$GITHUB_OUTPUT"
4646
else
47-
echo "should_run=false" >> $GITHUB_OUTPUT
47+
echo "should_run=false" >> "$GITHUB_OUTPUT"
4848
fi
4949
- id: get_env
5050
run: |
5151
ENV_VALUE=$(gh api "${{ github.event.workflow_run.artifacts_url }}" --jq '.environment')
5252
if [[ -n "$ENV_VALUE" ]]; then
53-
echo "environment=$ENV_VALUE" >> $GITHUB_OUTPUT
53+
echo "environment=$ENV_VALUE" >> "$GITHUB_OUTPUT"
5454
else
55-
echo "environment=Experimenting" >> $GITHUB_OUTPUT # Default fallback
55+
echo "environment=Experimenting" >> "$GITHUB_OUTPUT" # Default fallback
5656
fi
5757
5858

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extend-select = ["D", "E"]
1212
# Ignore specific warnings and errors according to CEP-7 style
1313
extend-ignore = ["E117", "D203", "D208", "D212"]
1414
# REQUIRED CEP-7 Custom Exceptions:
15-
# E117, # Over-indented - RECCOMENDED
15+
# E117, # Over-indented - RECOMMENDED
1616
# D208, # Docstring is over-indented - CEP-7
1717
# D203, # 1 blank line required before class docstring - CEP-7
1818
# D212, # Multi-line docstring summary should start at the first line - CEP-7

tests/check_spelling

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ check_command grep ;
127127
check_command python3 ;
128128
test -x "$(command -v codespell)" || exit 0 ; # skip quietly if user has not installed GPL2 stuff.
129129
check_command git ;
130+
check_command sed ;
130131
check_command shlock ;
131132

132133

@@ -135,9 +136,15 @@ SCRIPT_FILE="tests/check_spelling"
135136
# Set codespell options
136137
CODESPELL_OPTIONS="--quiet-level=4 --builtin clear,rare,code -L assertIn"
137138

139+
# Define specific typos to check for (regression tests)
140+
declare -a SPECIFIC_TYPOS=(
141+
"RECCOMENDED:RECOMMENDED"
142+
)
143+
138144
function cleanup() {
139145
rm -f "${LOCK_FILE}" 2>/dev/null || : ; wait ;
140146
# unset when done
147+
unset SPECIFIC_TYPOS 2>/dev/null || : ;
141148
unset LOCK_FILE 2>/dev/null || : ;
142149
hash -d shlock 2>/dev/null || : ;
143150
}
@@ -195,11 +202,35 @@ if [[ "$1" == "--fix" ]]; then
195202
fi
196203

197204
# THIS IS THE ACTUAL TEST
198-
# Iterate over files and run codespell
205+
# Iterate over files
199206
# shellcheck disable=SC2086
200207
for FILE in $FILES_TO_CHECK; do
208+
# Part 1: Run codespell
201209
printf "::group::%s\n" "Checking ${FILE}" ;
210+
printf "::debug::%s\n" "Running codespell tests for typos." ;
202211
{ codespell $CODESPELL_OPTIONS "${FILE}" || EXIT_CODE=$? ;} 2>/dev/null ; wait ;
212+
# Part 2: Run specific regression tests for known typos
213+
printf "::debug::%s\n" "Running regression tests for specific typos." ;
214+
for TYPO_PAIR in "${SPECIFIC_TYPOS[@]}"; do
215+
# Split the pair into typo and correction
216+
TYPO="${TYPO_PAIR%%:*}"
217+
CORRECTION="${TYPO_PAIR##*:}"
218+
219+
# Check for the specific typo
220+
if grep -q "$TYPO" "$FILE" 2>/dev/null; then
221+
printf "::error file=%s,title=Regression Test Failed::%s\n" "${FILE}" "Found typo '$TYPO' (should be '$CORRECTION')" >&2
222+
EXIT_CODE=2
223+
224+
# Auto-correct if --fix is provided
225+
if [[ "$1" == "--fix" ]]; then
226+
if sed -i "s/$TYPO/$CORRECTION/g" "${FILE}" 2>/dev/null; then
227+
printf "::notice file=%s,title=Auto-corrected::%s\n" "$FILE" "Fixed typo '$TYPO' to '$CORRECTION'"
228+
fi
229+
fi
230+
fi
231+
unset TYPO 2>/dev/null || : ;
232+
unset CORRECTION 2>/dev/null || : ;
233+
done
203234
printf "::endgroup::\n" ;
204235
done
205236

0 commit comments

Comments
 (0)