Skip to content

Commit

Permalink
feat: add typos-cli ci check (#1126)
Browse files Browse the repository at this point in the history
**Motivation:**  

We frequently receive PRs for minor typo fixes. Recently, we addressed
most of the typos in the repository (see #1119). However, this only
corrects typos up to this point and does not prevent new typos from
being introduced in the future.

**Modifications:**  

- Added a CI workflow to check for typos using
[typos-cli](https://github.com/crate-ci/typos).

**Result:**  

Typos will now be automatically detected and linted.
  • Loading branch information
0xClandestine authored Feb 19, 2025
1 parent c9b1242 commit 7a05fa3
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 5 deletions.
68 changes: 68 additions & 0 deletions .github/configs/typos-cli.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[files]
extend-exclude = [
"**/lib/**",
"**/docs/images/**",
# Not present locally, but is in remote (github).
"**/doc/**"
]
ignore-hidden = true
ignore-files = true
ignore-dot = true
ignore-vcs = true
ignore-global = true
ignore-parent = true

[default]
binary = false
check-filename = true
check-file = true
unicode = true
ignore-hex = true
identifier-leading-digits = false
locale = "en"
extend-ignore-identifiers-re = []
extend-ignore-words-re = []
extend-ignore-re = []

[default.extend-identifiers]

# Weird syntax, but this how you ignore corrections for certain words.
[default.extend-words]
strat = "strat"
froms = "froms"

[type.go]
extend-glob = []
extend-ignore-identifiers-re = []
extend-ignore-words-re = []
extend-ignore-re = []

[type.go.extend-identifiers]
flate = "flate"

[type.go.extend-words]

[type.sh]
extend-glob = []
extend-ignore-identifiers-re = []
extend-ignore-words-re = []
extend-ignore-re = []

[type.sh.extend-identifiers]
ot = "ot"
stap = "stap"

[type.sh.extend-words]

[type.py]
extend-glob = []
extend-ignore-identifiers-re = []
extend-ignore-words-re = []
extend-ignore-re = []

[type.py.extend-identifiers]
NDArray = "NDArray"
arange = "arange"
EOFError = "EOFError"

[type.py.extend-words]
12 changes: 12 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ permissions:
contents: read
pull-requests: read

env:
CLICOLOR: 1

jobs:
typos:
name: Typo Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
with:
config: .github/configs/typos-cli.toml

commitlint:
name: Commit Linting
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ gha-docker:

storage-report:
bash "bin/storage-report.sh" "docs/storage-report/"

fix-typos:
typos --config .github/configs/typos-cli.toml --write-changes
6 changes: 3 additions & 3 deletions certora/specs/core/Slasher.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ methods {
function get_previous_node_exists(address, uint256) external returns (bool) envfree;
function get_previous_node(address, uint256) external returns (uint256) envfree;
function get_list_head(address) external returns (uint256) envfree;
function get_lastest_update_block_at_node(address, uint256) external returns (uint256) envfree;
function get_lastest_update_block_at_head(address) external returns (uint256) envfree;
function get_latest_update_block_at_node(address, uint256) external returns (uint256) envfree;
function get_latest_update_block_at_head(address) external returns (uint256) envfree;
function get_linked_list_entry(address operator, uint256 node, bool direction) external returns (uint256) envfree;

// nodeDoesExist(address operator, uint256 node) returns (bool) envfree
Expand Down Expand Up @@ -134,7 +134,7 @@ is always at the 'HEAD' position in the linked list
invariant listHeadHasSmallestValueOfLatestUpdateBlock(address operator, uint256 node)
(
get_list_exists(operator) && get_next_node_exists(operator, get_list_head(operator)) =>
get_lastest_update_block_at_head(operator) <= get_lastest_update_block_at_node(operator, get_next_node(operator, get_list_head(operator)))
get_latest_update_block_at_head(operator) <= get_latest_update_block_at_node(operator, get_next_node(operator, get_list_head(operator)))
)
*/

Expand Down
2 changes: 1 addition & 1 deletion src/test/integration/IntegrationChecks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ contract IntegrationCheckUtils is IntegrationBase {
assertFalse(delegationManager.isDelegated(address(staker)),
"check_Undelegate_State: staker should not be delegated");
assert_ValidWithdrawalHashes(withdrawals, withdrawalRoots,
"check_Undelegate_State: calculated withdrawl should match returned root");
"check_Undelegate_State: calculated withdrawals should match returned roots");
assert_AllWithdrawalsPending(withdrawalRoots,
"check_Undelegate_State: stakers withdrawal should now be pending");
assert_Snap_Added_QueuedWithdrawals(staker, withdrawals,
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/EigenPodManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ contract EigenPodManagerUnitTests_ShareUpdateTests is EigenPodManagerUnitTests {
}

function testFuzz_removeShares(uint224 sharesToAdd, uint224 sharesToRemove) public {
// Constain inputs
// Constrain inputs
cheats.assume(sharesToRemove <= sharesToAdd);
uint256 sharesAdded = sharesToAdd * GWEI_TO_WEI;
uint256 sharesRemoved = sharesToRemove * GWEI_TO_WEI;
Expand Down

0 comments on commit 7a05fa3

Please sign in to comment.