Skip to content

Commit 6f4be90

Browse files
authored
Merge pull request #2249 from annietllnd/main
Tools updates
2 parents 365b787 + 15c4acb commit 6f4be90

File tree

9 files changed

+165
-199
lines changed

9 files changed

+165
-199
lines changed

.github/workflows/content-checks.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ jobs:
5959
name: spellcheck-output
6060
path: spellcheck-output.txt
6161
retention-days: 5 # Default is 90 days
62+
- name: Scan for profanities
63+
run: |
64+
pip install better_profanity
65+
python tools/profanity.py
66+
cat profanity_log.txt
67+
68+
- name: Export profanities
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: profanities
72+
path: profanity_log.txt
73+
retention-days: 5
6274

6375
- name: Scan for malware
6476
run: |

.github/workflows/external-links.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/maintenance.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/workflows/profanity.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/test-lp.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test Learning Path
22
on: pull_request
33
env:
44
HUGO_VERSION: 0.130.0
5-
5+
66
jobs:
77
Test-Pull-Request:
88
runs-on: ubuntu-24.04-arm
@@ -58,6 +58,11 @@ jobs:
5858
- name: Install dependencies
5959
if: steps.changed-markdown-files.outputs.any_changed == 'true'
6060
run: pip install -r tools/requirements.txt
61+
- name: Validate _index.md files
62+
if: steps.changed-markdown-files.outputs.any_changed == 'true'
63+
run: |
64+
echo "Checking YAML fields for changed learning paths..."
65+
python3 tools/verify_index_fields.py ${{ steps.changed-markdown-files.outputs.all_changed_files }}
6166
- name: Run test suite for all changed .md files
6267
id: run-suite
6368
if: steps.changed-markdown-files.outputs.any_changed == 'true'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package-lock.json
88
.vscode
99
.env
1010
startup.sh
11+
data/
1112

1213
# macOS files
1314
*.DS_Store
@@ -22,4 +23,4 @@ z_local_saved/
2223
*.xml
2324

2425
# CTags symbol index
25-
tags
26+
tags

.profanity_ignore.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@ XX
22
-kill
33
kill
44
KVM
5-
#IO_L3N_T0_DQS_AD1N_35
6-
172.X.X.X
5+
kvm
6+
X.X.X
7+
.xx.
8+
.xxx.
79
naked
10+
facial
11+
Facial
12+
screw
13+
len
14+
LEN
15+
test
16+
TEST
17+
Test
18+
--strip-
819
(x=x
920
**VM
1021
Kill
1122
slave
1223
Slave
24+
A55
25+
a55
26+
455

tools/profanity.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def load_excluded_words(file_path):
88

99
def scan_for_profanities(directory, log_file, excluded_words_file=None):
1010
exclude_words = None
11+
profanities = None
1112
if excluded_words_file:
1213
exclude_words = load_excluded_words(excluded_words_file)
1314

@@ -17,23 +18,21 @@ def scan_for_profanities(directory, log_file, excluded_words_file=None):
1718
if file.endswith('.md'): # Read only markdown files
1819
file_path = os.path.join(root, file)
1920
with open(file_path, 'r') as code_file:
21+
profanities = None
2022
content = code_file.read()
2123
if exclude_words:
2224
excluded_content = content
2325
for word in exclude_words:
2426
excluded_content = excluded_content.replace(word, '')
2527
if profanity.contains_profanity(excluded_content):
26-
f.write(f"Profanity found in file: {file_path}\n")
27-
f.write("Profanities found: ")
2828
profanities = set(word for word in excluded_content.split() if profanity.contains_profanity(word))
29-
f.write(", ".join(profanities))
30-
f.write("\n\n")
3129
else:
3230
if profanity.contains_profanity(content):
33-
f.write(f"Profanity found in file: {file_path}\n")
34-
f.write("Profanities found: ")
3531
profanities = set(word for word in content.split() if profanity.contains_profanity(word))
36-
f.write(", ".join(profanities))
37-
f.write("\n\n")
32+
if profanities:
33+
f.write(f"Profanity found in file: {file_path}\n")
34+
f.write("Profanities found: ")
35+
f.write(", ".join(profanities))
36+
f.write("\n\n")
3837

39-
scan_for_profanities("./content/", "./profanity_log.txt", excluded_words_file="./.profanity_ignore.yml")
38+
scan_for_profanities("./content/", "./profanity_log.txt", excluded_words_file="./.profanity_ignore.yml")

0 commit comments

Comments
 (0)