Skip to content

Commit

Permalink
ci: Replace woke with codespell
Browse files Browse the repository at this point in the history
woke has been left with Noriko's and all other PRs not being reviewed for years,
hence we have been using our fork.

Replacing woke with codespell that provides a dictionary for replacing phrasing
with recommended terms:
https://github.com/codespell-project/codespell/blob/main/codespell_lib/data/dictionary_usage.txt

It also supports using custom dictionaries so we can add to the list if we want

For more information about inclusive naming initiative, see
https://inclusivenaming.org/about/

Codespell also checks spelling, which is an advantage for system roles because a
big part of our code is user-facing - task names, debug messages, readmes.

`ignore-multiline-regex` in the `.codespellrc` config allows for disabling
codespell for a block of lines:

```
# codespell:ignore-begin
... codespell will not look at this text.
# codespell:ignore-end
```

Signed-off-by: Sergei Petrosian <[email protected]>
  • Loading branch information
spetrosi committed Feb 6, 2025
1 parent 6d215f7 commit ddad511
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kinds:
skip_list:
- fqcn-builtins
- var-naming[no-role-prefix]
- sanity[cannot-ignore] # wokeignore:rule=sanity
- sanity[cannot-ignore]
exclude_paths:
- tests/roles/
- .github/
Expand Down
5 changes: 5 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codespell]
skip = tests,artifacts*,pylintrc
builtin = usage
ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end
context=0
2 changes: 1 addition & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:
- name: Run ansible-test
uses: ansible-community/ansible-test-gh-action@release/v1
with:
testing-type: sanity # wokeignore:rule=sanity
testing-type: sanity
ansible-core-version: stable-2.17
collection-src-directory: ${{ github.workspace }}/.tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }}
29 changes: 29 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Codespell configuration is within .codespellrc
---
name: Codespell
on: # yamllint disable-line rule:truthy
- pull_request
permissions:
contents: read
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get variable with regex values
id: regexvar
run: |
curl -L -s -o dictionary_usage.txt https://raw.githubusercontent.com/codespell-project/codespell/refs/heads/main/codespell_lib/data/dictionary_usage.txt
regexvar=$(sed 's/->.*//g' dictionary_usage.txt | sed 's/$/|/' | tr -d '\n' | sed 's/.$//')
rm dictionary_usage.txt
echo "regexvar=$regexvar" >> "$GITHUB_OUTPUT"
- name: Show errors from codespell as annotation in GitHub Actions
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: spetrosi/actions-codespell@add-regex-input
with:
regex: ${{ steps.regexvar.outputs.regexvar }}
20 changes: 0 additions & 20 deletions .github/workflows/woke.yml

This file was deleted.

8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# timesync

[![ansible-lint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml) [![markdownlint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml) [![shellcheck.yml](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml) [![woke.yml](https://github.com/linux-system-roles/timesync/actions/workflows/woke.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/woke.yml)
[![ansible-lint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/ansible-test.yml) [![codespell.yml](https://github.com/linux-system-roles/timesync/actions/workflows/codespell.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/codespell.yml) [![markdownlint.yml](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/markdownlint.yml) [![shellcheck.yml](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/timesync/actions/workflows/tft_citest_bad.yml)

This role installs and configures an NTP and/or PTP implementation to operate
<!--- wokeignore:rule=slave -->
as an NTP client and/or PTP slave in order to synchronize the system clock with
<!--- wokeignore:rule=master -->
as an NTP client and/or PTP slave in order to synchronize the system clock with <!-- codespell:ignore slave -->
NTP servers and/or grandmasters in PTP domains. Supported NTP/PTP

Check failure on line 7 in README.md

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
implementations are chrony, ntp (the reference implementation) and linuxptp.

Expand Down Expand Up @@ -65,7 +63,6 @@ timesync_ptp_domains:
- number: 0 # PTP domain number
interfaces: [eth0] # List of interfaces in the domain
delay: 0.000010 # Assumed maximum network delay to the
# grandmaster in seconds # wokeignore:rule=master
# (default 100 microsecond)
transport: UDPv4 # Network transport: UDPv4, UDPv6, L2
# (default UDPv4)
Expand Down Expand Up @@ -143,7 +140,6 @@ Install and configure ntp to synchronize the system clock with three NTP servers
```
Install and configure linuxptp to synchronize the system clock with a
<!--- wokeignore:rule=master -->
grandmaster in PTP domain number 0, which is accessible on interface eth0:

Check failure on line 143 in README.md

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
```yaml
Expand Down
2 changes: 0 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
name: phc2sys
state: restarted

# wokeignore:rule=master
- name: Restart timemaster
service:
# wokeignore:rule=master
name: timemaster
state: restarted
10 changes: 0 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@
dest: "{{ timesync_chrony_conf_path }}"
backup: true
mode: "0644"
# wokeignore:rule=master
notify: Restart {{ 'chronyd' if timesync_mode == 1 else 'timemaster' }}

Check failure on line 140 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
when:
- timesync_mode != 2
Expand All @@ -162,7 +161,6 @@
dest: /etc/ntp.conf
backup: true
mode: "0644"
# wokeignore:rule=master
notify: Restart {{ 'ntpd' if timesync_mode == 1 else 'timemaster' }}

Check failure on line 164 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
when:
- timesync_mode != 2
Expand Down Expand Up @@ -217,16 +215,12 @@
- "'linuxptp' in ansible_facts.packages"
- timesync_phc2sys_sysconfig_path | length > 0

# wokeignore:rule=master
- name: Generate timemaster.conf file

Check failure on line 218 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
template:
# wokeignore:rule=master
src: timemaster.conf.j2

Check failure on line 220 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
# wokeignore:rule=master
dest: "{{ timesync_timemaster_config_path }}"

Check failure on line 221 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
backup: true
mode: "0644"
# wokeignore:rule=master
notify: Restart timemaster

Check failure on line 224 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
when:
- timesync_mode == 3
Expand Down Expand Up @@ -327,10 +321,8 @@
- not __disable_result.msg is match(
'Could not find the requested service phc2sys:')

# wokeignore:rule=master
- name: Disable timemaster

Check failure on line 324 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
vars:
# wokeignore:rule=master
__timemstr: timemaster

Check failure on line 326 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

master ==> primary, leader, active, writer, coordinator, parent, manager, main
service:
name: "{{ __timemstr }}"
Expand Down Expand Up @@ -379,10 +371,8 @@
- timesync_mode == 2
- timesync_mode2_hwts

# wokeignore:rule=master
- name: Enable timemaster
service:
# wokeignore:rule=master
name: timemaster
state: started
enabled: true
Expand Down
1 change: 0 additions & 1 deletion templates/ptp4l.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{{ "system_role:timesync" | comment(prefix="", postfix="") }}

[global]
{# wokeignore:rule=slave #}
slaveOnly 1
domainNumber {{ timesync_ptp_domains[0].number }}
time_stamping {{ 'hardware' if timesync_mode2_hwts else 'software' }}
Expand Down
1 change: 0 additions & 1 deletion templates/timemaster.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ ptp4l_option hybrid_e2e 1
{% endif %}

{% endfor %}
{# wokeignore:rule=master #}
[timemaster]
ntp_program {{ 'ntpd' if timesync_ntp_provider == 'ntp' else 'chronyd' }}

Expand Down
1 change: 0 additions & 1 deletion vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony/chrony.conf"
timesync_ntp_sysconfig_path: "/etc/default/ntp"
timesync_ptp4l_sysconfig_path: ""
timesync_phc2sys_sysconfig_path: ""
# wokeignore:rule=master
timesync_timemaster_config_path: "/etc/linuxptp/timemaster.conf"
1 change: 0 additions & 1 deletion vars/RedHat_10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf
1 change: 0 additions & 1 deletion vars/RedHat_6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf
1 change: 0 additions & 1 deletion vars/RedHat_7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf
1 change: 0 additions & 1 deletion vars/RedHat_8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf
1 change: 0 additions & 1 deletion vars/RedHat_9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf
1 change: 0 additions & 1 deletion vars/SL-Micro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf
1 change: 0 additions & 1 deletion vars/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ timesync_chrony_conf_path: "/etc/chrony.conf"
timesync_ntp_sysconfig_path: /etc/sysconfig/ntpd
timesync_ptp4l_sysconfig_path: /etc/sysconfig/ptp4l
timesync_phc2sys_sysconfig_path: /etc/sysconfig/phc2sys
# wokeignore:rule=master
timesync_timemaster_config_path: /etc/timemaster.conf

0 comments on commit ddad511

Please sign in to comment.