Skip to content

Conversation

rainwaters11
Copy link

Summary

Adds docs/STYLE_GUIDE.md to formalize style decisions not covered by Black:

  • Short, imperative snake_case function names (PEP 8)
  • Exceptions for in-protocol errors
  • Runtime checks via ensure(...); assert only for invariants/bug catching
  • Typing: avoid # type: ignore; if unavoidable, require an error code + reason

Enforcement (config only)

  • mypy: warn_unused_ignores = True, show_error_codes = True, enable_error_code = ignore-without-code
  • (Optional) Ruff: enable PGH003 if maintainers prefer

Scope

Docs + config only; no refactors.

Why

Keeps formatting in Black, while making remaining conventions explicit and enforceable with gentle CI checks.

Closes #237.

- Add STYLE_GUIDE.md reference to CONTRIBUTING.md
- Enable mypy error codes and ignore-without-code enforcement
- Add PGH003 (blanket-type-ignore) to ruff linter rules
- Fix type ignore comments to include specific error codes
- Add logs/ to .gitignore to exclude test execution logs

These changes enforce more precise type ignore comments and improve
code quality by requiring specific mypy error codes.
@rainwaters11
Copy link
Author

I’ve opened a PR to add docs/STYLE_GUIDE.md and enable mypy checks that prevent blanket type: ignore. It documents the function-naming, exceptions vs runtime checks, and ignore policy you listed. Config-only enforcement; no code refactors. Happy to add Ruff PGH003 if the team prefers.

@bomanaps
Copy link

bomanaps commented Oct 2, 2025

Hello @SamWilsn please can we get a review on this, thank you

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.08%. Comparing base (26c7daf) to head (972f361).
⚠️ Report is 6 commits behind head on forks/osaka.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##           forks/osaka    #1447   +/-   ##
============================================
  Coverage        86.07%   86.08%           
============================================
  Files              743      743           
  Lines            44072    44072           
  Branches          3891     3891           
============================================
+ Hits             37936    37938    +2     
+ Misses            5659     5656    -3     
- Partials           477      478    +1     
Flag Coverage Δ
unittests 86.08% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Avoid using EIP numbers in identifiers.
- If necessary, there is a custom dictionary `whitelist.txt`.

See [docs/STYLE_GUIDE.md](docs/STYLE_GUIDE.md) for rules not covered by Black (naming, ensure/assert, and typing ignore policy).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget to add this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sam,

Just wanted to follow up on the PR. I've pushed the final changes, which should resolve your review comments.

Here's a quick summary of what's included in the latest commits:

The complete STYLE_GUIDE.md has been added to the docs.

The CONTRIBUTING.md file is now updated to reference the new style guide.

The mypy.ini and pyproject.toml files have been enhanced to enforce the new rules.

The .gitignore file has been updated.

Everything should be up to date on the branch now and ready for your review. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I still don't see a STYLE_GUIDE.md?

- Add docs/STYLE_GUIDE.md with formalized style rules
- Remove /docs from .gitignore to allow documentation files
- Keep logs/ in .gitignore to exclude test execution logs

The STYLE_GUIDE.md was previously ignored due to /docs in .gitignore.
@rainwaters11
Copy link
Author

rainwaters11 commented Oct 8, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document code and style conventions

4 participants