Skip to content

Commit 47939e5

Browse files
authored
Merge branch 'main' into fix/broken-markdown-links
2 parents 4d971cb + d5147d9 commit 47939e5

5 files changed

Lines changed: 51 additions & 5 deletions

File tree

.github/workflows/pr-check-primary-codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
egress-policy: audit
4343

4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.3.5
45+
uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.3.5
4646
with:
4747
languages: ${{ matrix.language }}
4848
build-mode: ${{ matrix.build-mode }}
@@ -66,6 +66,6 @@ jobs:
6666
run: uv sync --all-extras --dev
6767

6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.3.5
69+
uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.3.5
7070
with:
7171
category: "/language:${{matrix.language}}"

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ We welcome blog posts! Whether you're sharing a tutorial, case study, or your ex
106106
| [Rebasing](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/rebasing.md) | Keeping branch updated |
107107
| [Merge Conflicts](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/merge_conflicts.md) | Resolving conflicts |
108108
| [Types](docs/sdk_developers/types.md) | Python type hints |
109-
| [Linting](docs/sdk_developers/linting.md) | Code quality tools |
109+
| [Linting](docs/sdk_developers/ruff.md) | Code quality tools |
110110

111111
---
112112

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ print(f"Balance: {balance.hbars} HBAR")
7272
- **[Rebasing Guide](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/rebasing.md)** - Keep your branch up-to-date
7373
- **[Merge Conflicts Guide](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/guides/issue-progression/for-developers/merge_conflicts.md)** - Resolve conflicts
7474
- **[Typing Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/types.md)** - Python type hints
75-
- **[Linting Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/linting.md)** - Code quality tools
75+
- **[Linting Guide](https://github.com/hiero-ledger/hiero-sdk-python/blob/main/docs/sdk_developers/ruff.md)** - Code quality tools
7676

7777
### Hedera Network Resources
7878

docs/sdk_developers/ruff.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,33 @@ uv run ruff check . && uv run ruff format --check .
100100
}
101101
```
102102

103+
104+
## 🛠️ Handling Linting Issues
105+
106+
### Manual vs. Automatic Fixes
107+
108+
Ruff is smart, but it won't change your code if it might break logic.
109+
110+
- **Auto-Fixed:** Unused imports, unsorted imports (Isort-style), and basic whitespace.
111+
112+
- **Manual Action Required:** Complex issues like unused function arguments (`ARG001`), overly complex logic (`C901`), or missing docstrings. You must refactor these yourself based on the terminal output.
113+
114+
115+
### Ignoring Rules (Suppressing Warnings)
116+
117+
Sometimes, a linter rule conflicts with a specific technical requirement. You can tell Ruff to ignore a line using the `# noqa` comment followed by the error code.
118+
119+
```python
120+
# Ignore a specific error on a line
121+
import unused_module # noqa: F401
122+
123+
# Ignore multiple errors on a line
124+
x = 1 # noqa: E701, F841
125+
```
126+
Each error has a code. You can look up the full details of any code in the [Ruff Documentation](https://docs.astral.sh/ruff/rules/).
127+
128+
> **Global Ignore:** To disable linting for an entire file (e.g., an auto-generated file), add `# ruff: noqa` to the very top
129+
103130
## 📝 Example Output
104131
**When issues are found:**
105132

docs/sdk_developers/setup.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ This guide walks you through setting up your development environment for contrib
88
- [Installation](#installation)
99
- [Installing from PyPI](#installing-from-pypi)
1010
- [Installing from Source](#installing-from-source)
11-
- [Local Editable Installation](#local-editable-installation)
11+
- [Install Dependencies](#install-dependencies)
12+
- [Installing Optional Dependencies](#installing-optional-dependencies)
13+
- [Pre-Commit Tool Setup](#pre-commit-tool-setup)
1214
- [Generate Protocol Buffers](#generate-protocol-buffers)
1315
- [Environment Setup](#environment-setup)
1416
- [Setup Checklist](#examples)
@@ -178,6 +180,9 @@ uv sync --dev --all-extras
178180

179181
To maintain high code quality and security, this repository uses `re-commit` hooks. These hooks automatically run checks (like `Ruff` for linting and `Gitleaks` for security) every time you attempt to commit code.
180182

183+
### Installation
184+
---
185+
181186
**Option 1: Using `uv` (Recommended)**
182187

183188
`uv` is recommended because it manages pre-commit within your project’s locked environment, ensuring your local linting matches the CI exactly.
@@ -210,6 +215,20 @@ Once installed, `git commit` will automatically trigger the checks.
210215
- If they **pass**: Your commit is created normally.
211216
- If they **fail**: The hooks will often fix the files for you (e.g., `Ruff` reformatting). Simply `git add` the changed files and commit again.
212217

218+
219+
### Manual Execution
220+
---
221+
To run the hooks manually at any time:
222+
223+
```
224+
# Run against only changed files
225+
uv run pre-commit run
226+
227+
# Run against every file in the repository
228+
uv run pre-commit run --all-files
229+
```
230+
231+
213232
## Generate Protocol Buffers
214233

215234
The SDK uses protocol buffers to communicate with the Hedera network. Generate the Python code from the protobuf definitions:

0 commit comments

Comments
 (0)