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.
get-woke/woke#252

woke has a limitation that doesn't allow ignoring lines of code, codespell
allows for this.

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 Jan 24, 2025
1 parent 471130d commit 3b58da3
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = tests,artifacts*
builtin = clear,rare,usage
skip = tests,artifacts*,pylintrc
builtin = usage
ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ Changelog
- Add workarounds for known issues in SQL Server 2022
- Use delay=3 timeout=40 in wait_for module to avoid unreachable server

- Imrpove performance by intputting multiple SQL files with loop internaly (#116)
- Improve performance by intputting multiple SQL files with loop internally (#116)
- Make it possible to input multiple file with loop internally
- Rename task file and vars for clarity
- Make regex for files extension search more strict
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The role uses `sqlcmd` for the following tasks:
By default, installs and uses the latest version 18.

You can set this variable to `[17, 18]` to install two versions in parallel.
In the case when this variable contains multiple elements, the role instals both but uses latest provided version.
In the case when this variable contains multiple elements, the role installs both but uses latest provided version.

The role does not remove mssql-tools packages if you unset a version with this variable.

Expand Down Expand Up @@ -310,7 +310,7 @@ Type: `bool`
### Inputting SQL Scripts Example Playbooks

#### Inputting SQL script files and content to SQL Server

<!-- codespell:ignore-begin -->
```yaml
- hosts: all
vars:
Expand Down Expand Up @@ -358,6 +358,7 @@ Type: `bool`
END
GO
```
<!-- codespell:ignore-end -->

## Installing Additional Packages

Expand Down Expand Up @@ -795,7 +796,7 @@ Type: `string`

#### mssql_ha_master_key_password

The password to set for the master key used with the certificate.
The password to set for the master key used with the certificate. <!-- codespell:ignore master -->

Default: `null`

Expand Down Expand Up @@ -1570,6 +1571,7 @@ Type: `string`

#### Configuring AD integration with general parameters

<!-- codespell:ignore-begin -->
```yaml
- name: Configure with AD server authentication
hosts: all
Expand Down Expand Up @@ -1607,11 +1609,13 @@ Type: `string`
PRINT 'A <mydomain>\<myADlogin> login already exists, skipping'
END
```
<!-- codespell:ignore-end -->

#### Configuring AD integration with a pre-created keytab file

If you received a pre-created keytab file and want the role to use it, set variables like in this example:

<!-- codespell:ignore-begin -->
```yaml
- name: Configure with AD server authentication with a pre-created keytab file
hosts: all
Expand Down Expand Up @@ -1649,11 +1653,13 @@ If you received a pre-created keytab file and want the role to use it, set varia
PRINT 'A <mydomain>\<myADlogin> login already exists, skipping'
END
```
<!-- codespell:ignore-end -->

#### Configuring AD integration without joining to AD

You must join managed host to AD Server yourself prior to running this playbook.

<!-- codespell:ignore-begin -->
```yaml
- name: Configure with AD server authentication without joining to AD
hosts: all
Expand Down Expand Up @@ -1687,6 +1693,7 @@ You must join managed host to AD Server yourself prior to running this playbook.
PRINT 'A <mydomain>\<myADlogin> login already exists, skipping'
END
```
<!-- codespell:ignore-end -->

## License

Expand Down
4 changes: 2 additions & 2 deletions templates/create_and_back_up_cert.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
SET NOCOUNT ON;

DECLARE @cerExists INT;
EXEC master.dbo.xp_fileexist '{{ __mssql_ha_cert_dest }}', @cerExists OUTPUT;
EXEC master.dbo.xp_fileexist '{{ __mssql_ha_cert_dest }}', @cerExists OUTPUT; {# codespell:ignore master #}
DECLARE @pvkExists INT;
EXEC master.dbo.xp_fileexist '{{ __mssql_ha_private_key_dest }}',
EXEC master.dbo.xp_fileexist '{{ __mssql_ha_private_key_dest }}', {# codespell:ignore master #}
@pvkExists OUTPUT;

IF NOT EXISTS(
Expand Down
2 changes: 1 addition & 1 deletion templates/create_ha_login.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USE master;
USE master; {# codespell:ignore master #}
IF NOT EXISTS (
SELECT name FROM sys.server_principals
WHERE name = '{{ mssql_ha_login }}'
Expand Down
2 changes: 2 additions & 0 deletions templates/create_master_key_encryption.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ IF NOT EXISTS (
WHERE name LIKE '%databaseMasterkey%'
)
BEGIN
{# codespell:ignore-begin #}
PRINT 'Master key does not exist, creating';
CREATE MASTER KEY ENCRYPTION BY PASSWORD =
'{{ mssql_ha_master_key_password }}';
Expand Down Expand Up @@ -32,6 +33,7 @@ dropping master key to re-create it';
CREATE MASTER KEY ENCRYPTION BY PASSWORD =
'{{ mssql_ha_master_key_password }}';
PRINT 'Master key created successfully';
{# codespell:ignore-end #}
{% endif %}
END CATCH
END
12 changes: 6 additions & 6 deletions templates/replicate_db.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ IF NOT EXISTS (
ISNULL(dbrs.synchronization_state, 0) AS [SynchronizationState],
ISNULL(dbrs.is_suspended, 0) AS [IsSuspended],
ISNULL(dbcs.is_database_joined, 0) AS [IsJoined]
FROM master.sys.availability_groups AS AG
LEFT OUTER JOIN master.sys.dm_hadr_availability_group_states as agstates
FROM master.sys.availability_groups AS AG {# codespell:ignore master #}
LEFT OUTER JOIN master.sys.dm_hadr_availability_group_states as agstates {# codespell:ignore master #}
ON AG.group_id = agstates.group_id
INNER JOIN master.sys.availability_replicas AS AR
INNER JOIN master.sys.availability_replicas AS AR {# codespell:ignore master #}
ON AG.group_id = AR.group_id
INNER JOIN master.sys.dm_hadr_availability_replica_states AS arstates
INNER JOIN master.sys.dm_hadr_availability_replica_states AS arstates {# codespell:ignore master #}
ON AR.replica_id = arstates.replica_id AND arstates.is_local = 1
INNER JOIN master.sys.dm_hadr_database_replica_cluster_states AS dbcs
INNER JOIN master.sys.dm_hadr_database_replica_cluster_states AS dbcs {# codespell:ignore master #}
ON arstates.replica_id = dbcs.replica_id
LEFT OUTER JOIN master.sys.dm_hadr_database_replica_states AS dbrs
LEFT OUTER JOIN master.sys.dm_hadr_database_replica_states AS dbrs {# codespell:ignore master #}
ON dbcs.replica_id = dbrs.replica_id
AND dbcs.group_database_id = dbrs.group_database_id
WHERE dbcs.database_name = '{{ item }}'
Expand Down

0 comments on commit 3b58da3

Please sign in to comment.