Skip to content

Commit 985210c

Browse files
pre-commit: SwiftLint: Disable failing tests #781
2 parents 763f307 + 57e282e commit 985210c

36 files changed

+9732
-9676
lines changed

.codespellrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[codespell]
2+
count = True
3+
ignore-words-list = ans,deriver,inout,packag
4+
skip = *.js,*WordLists.swift,.git,Carthage,.build,build

.github/workflows/macOS-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
spm:
3030
name: Swift Package Manager 5.7
3131
runs-on: macOS-12
32-
concurrency:
32+
concurrency:
3333
group: spm-${{ github.run_id }}
3434
cancel-in-progress: false
3535
steps:
@@ -38,7 +38,11 @@ jobs:
3838
run: |
3939
pip3 install --upgrade pip
4040
pip3 install codespell
41-
codespell --count --ignore-words-list=ans,deriver,inout,packag --skip="*.js,*WordLists.swift"
41+
codespell # See .codespellrc for args
42+
- name: SwiftLint
43+
run: |
44+
# Adding --fix flag makes CI print only errors that cannot be fixed automatically
45+
swiftlint --fix
4246
- name: Resolve dependencies
4347
run: swift package resolve
4448
- name: Build

.github/workflows/pre-commit.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# https://pre-commit.com
2+
# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file.
3+
# Using pre-commit.ci is even better than using GitHub Actions for pre-commit.
4+
name: pre-commit
5+
on:
6+
pull_request:
7+
branches: [develop]
8+
push:
9+
branches: [develop]
10+
workflow_dispatch:
11+
jobs:
12+
pre-commit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: 3.x
19+
- run: pip install pre-commit
20+
- run: pre-commit --version
21+
- run: pre-commit install
22+
- run: pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ repos:
1414
- repo: https://github.com/codespell-project/codespell
1515
rev: v2.2.2
1616
hooks:
17-
- id: codespell
18-
args: ["--count --ignore-words-list=ans,deriver,inout,packag --skip=\"*.js,*WordLists.swift,.git,Carthage,.build,build\""]
19-
# SwiftLint is commented out until we fix all SwiftLint warnings and errors.
20-
# https://github.com/web3swift-team/web3swift/pull/756
21-
#- repo: https://github.com/realm/SwiftLint
22-
# rev: 0.50.3
23-
# hooks:
24-
# - id: swiftlint
25-
# args: [--fix, Sources, Tests]
17+
- id: codespell # See .codespellrc for args
18+
# - repo: https://github.com/realm/SwiftLint # Too slow in pre-commit
19+
# rev: 0.50.3
20+
# hooks:
21+
# - id: swiftlint
22+
# args: [--fix, Sources, Tests]

.swiftlint.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,45 @@ excluded:
55
- DerivedData
66
- Pods
77

8+
analyzer_rules:
9+
- unused_import
10+
811
disabled_rules:
12+
- block_based_kvo
13+
- closure_body_length
14+
- computed_accessors_order
15+
- cyclomatic_complexity
16+
- duplicate_imports
17+
- empty_enum_arguments
18+
- empty_string
19+
- file_length
20+
- for_where
21+
- force_cast
22+
- force_try
23+
- force_unwrapping
24+
- function_body_length
925
- function_parameter_count
1026
- identifier_name
27+
- implicit_getter
28+
- implicitly_unwrapped_optional
29+
- indentation_width
30+
- large_tuple
31+
- legacy_objc_type
1132
- line_length
1233
- multiple_closures_with_trailing_closure
1334
- nesting
35+
- orphaned_doc_comment
36+
- operator_whitespace
37+
- return_arrow_whitespace
38+
- shorthand_operator
1439
- todo
40+
- trailing_closure
41+
- type_body_length
1542
- type_name
43+
- unneeded_break_in_switch
44+
- unused_optional_binding
45+
- vertical_parameter_alignment
46+
- xctfail_message
1647

1748
opt_in_rules:
1849
- closure_body_length
@@ -27,15 +58,14 @@ opt_in_rules:
2758
- static_operator
2859
- trailing_closure
2960
- unneeded_parentheses_in_closure_argument
30-
- unused_import
3161
- weak_delegate
3262

3363
# force warnings
3464
force_cast: error
35-
force_try: error
65+
force_try: error
3666

3767
custom_rules:
38-
commented_out_code:
68+
commented_out_code:
3969
included: .*\.swift # regex that defines paths to include during linting. optional.
4070
excluded: .*Test(s)?\.swift # regex that defines paths to exclude during linting. optional
4171
name: Commented out code # rule name. optional.

CONTRIBUTION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Please take it from the [roadmap](https://hackmd.io/G5znP3xAQY-BVc1X8Y1jSg) or f
1717
1818
## Codestyle guideline
1919
- `swiftlint` check should goes with no warnings.
20-
- Here’s some more detailed and human readable code style [guidelines](https://hackmd.io/8bACoAnTSsKc55Os596yCg "") (you can add there some suggestion if you’d like to).
20+
- Here’s some more detailed and human readable code style [guidelines](https://hackmd.io/8bACoAnTSsKc55Os596yCg "") (you can add there some suggestion if you’d like to).
2121
- We use [swift](https://www.swift.org/documentation/api-design-guidelines/ "") name convention.
2222
## Tests guideline
2323
1. Cover each new public method with tests.
@@ -67,4 +67,4 @@ on:
6767
- [ ] All public method have `///` styled comments.
6868
- [ ] All magic or nonintuitive internal code parts are clearly explained in inline comments.
6969
- [ ] `swiftlint` ran have no warnings.
70-
- [ ] No commented out code lefts in PR.
70+
- [ ] No commented out code lefts in PR.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444

4545
## Core features
4646

47-
- [x] :zap: Swift implementation of [web3.js](https://github.com/ethereum/web3.js/) functionality
48-
- [x] :thought_balloon: Interaction with remote node via **JSON RPC**
47+
- [x] :zap: Swift implementation of [web3.js](https://github.com/ethereum/web3.js/) functionality
48+
- [x] :thought_balloon: Interaction with remote node via **JSON RPC**
4949
- [x] 🔐 Local **keystore management** (`geth` compatible)
50-
- [x] 🤖 Smart-contract **ABI parsing**
50+
- [x] 🤖 Smart-contract **ABI parsing**
5151
- [x] 🔓**ABI decoding** (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)
5252
- [x] 🕸Ethereum Name Service **(ENS) support** - a secure & decentralised way to address resources both on and off the blockchain using simple, human-readable names
53-
- [x] :arrows_counterclockwise: **Smart contracts interactions** (read/write)
53+
- [x] :arrows_counterclockwise: **Smart contracts interactions** (read/write)
5454
- [x]**Infura support**
5555
- [x]**Parsing TxPool** content into native values (ethereum addresses and transactions) - easy to get pending transactions
5656
- [x] 🖇 **Event loops** functionality

Sources/Web3Core/EthereumNetwork/Request/APIRequest+ComputedProperties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// APIRequest+ComputedProperties.swift
3-
//
3+
//
44
//
55
// Created by Yaroslav Yashin on 12.07.2022.
66
//

Sources/Web3Core/EthereumNetwork/Request/APIRequest+Methods.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// APIRequest+Methods.swift
3-
//
3+
//
44
//
55
// Created by Yaroslav Yashin on 12.07.2022.
66
//

Sources/Web3Core/EthereumNetwork/Request/APIRequest+UtilityTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// APIRequest+UtilityTypes.swift
3-
//
3+
//
44
//
55
// Created by Yaroslav Yashin on 12.07.2022.
66
//

0 commit comments

Comments
 (0)