Skip to content

Conversation

@sueszli
Copy link
Contributor

@sueszli sueszli commented Jan 31, 2026

Clear code quality guidelines (especially valuable if code generation tooling is used).

https://lkml.org/lkml/2026/1/7/1888

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.15%. Comparing base (af616a9) to head (75b6cfb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5597   +/-   ##
=======================================
  Coverage   86.15%   86.15%           
=======================================
  Files         393      393           
  Lines       56308    56308           
  Branches     6492     6492           
=======================================
  Hits        48513    48513           
  Misses       6262     6262           
  Partials     1533     1533           

☔ 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.

@sueszli
Copy link
Contributor Author

sueszli commented Feb 1, 2026

Thank you for reviewing!

@sueszli
Copy link
Contributor Author

sueszli commented Feb 1, 2026

Wait, I'm just noticing that we could dedup the README content.

@superlopuh superlopuh added the documentation Documentation label Feb 1, 2026
@superlopuh superlopuh changed the title Create CONTRIBUTING.md documentation: Create CONTRIBUTING.md Feb 1, 2026
Comment on lines +65 to +100
## Code Style

We aim to follow these rules for all changes in this repository:

- Match existing code style and architectural patterns.
- Zero Technical Debt: Fix issues immediately. Never rely on future refactoring.
- Keep it simple: No code > Obvious code > Clever code. Do not abstract prematurely.
- Locality over DRY: Prioritize code locality. Keep related logic close together even if
it results in slight duplication. Prefer lambdas/inline logic over tiny single-use
functions (<5 LoC). Minimize variable scope.
- Self-Describing Code: Minimize comments. Use descriptive variable names and constant
intermediary variables to explain where possible.
- Guard-First Logic: Handle edge cases, invalid inputs and errors at the start of
functions. Return early to keep the "happy path" at the lowest indentation level.
- Flat Structure: Keep if/else blocks small. Avoid nesting beyond two levels if possible.
- Centralize Control Flow: Branching logic belongs in parents. Leaf functions should be
pure logic.
- Fail Fast: Detect unexpected conditions immediately. Raise Exceptions rather than
corrupt state.
- [Ask for forgiveness not permission](https://docs.python.org/3/glossary.html#term-eafp):
Assume valid keys or attributes exist and catch exceptions if the assumption proves
false. Use try-except blocks:

```python
# Good
try:
return mapping[key]
except KeyError:
return default_value

# Bad
if key in mapping:
return mapping[key]
return default_value
```

Copy link
Member

Choose a reason for hiding this comment

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

Let's move this to the end?

Copy link
Member

Choose a reason for hiding this comment

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

Actually now that I think about it, maybe we first move the existing text with minimal changes to a CONTRBUTING.md file, and then add things about code style?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I'll turn this into a draft, move stuff, and we'll take it from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved: #5604

Comment on lines +163 to +177
> [!IMPORTANT]
>
> ### Experimental Pyright Features
>
> xDSL currently relies on an experimental feature of Pyright called TypeForm.
> TypeForm is [in discussion](https://discuss.python.org/t/pep-747-typeexpr-type-hint-for-a-type-expression/55984)
> and will likely land in some future version of Python.
>
> For xDSL to type check correctly using Pyright, please add this to your `pyproject.toml`:
>
> ```toml
> [tool.pyright]
> enableExperimentalFeatures = true
> ```

Copy link
Member

Choose a reason for hiding this comment

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

I would probably duplicate this in the readme, it applies to projects that depend on xDSL also, without it Pyright doesn't typecheck the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made sure to duplicate this line in #5604

@sueszli sueszli marked this pull request as draft February 2, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants