refactor: select all lint rules#35
Merged
Merged
Conversation
Reviewer's GuideThis PR refactors the Ruff lint config to use a catch-all rule, modernizes type hints to PEP 585 generics, cleans up test parameterization and benchmarks for consistency, switches to named boolean flags in parse_url_encoded_dict calls, and trims redundant badges in the README. Class diagram for updated type hints in benchmarks.pyclassDiagram
class parse_url_encoded_form_data {
+parse_url_encoded_form_data(encoded_data: bytes) dict[str, Any]
}
class bench_qsl {
+bench_qsl(runner: pyperf.Runner) None
}
class bench_qs {
+bench_qs(runner: pyperf.Runner) None
}
parse_url_encoded_form_data --> "defaultdict[str, list[Any]]" DefaultDict
parse_url_encoded_form_data --> "loads" JSONDecode
bench_qsl --> "pyperf.Runner" Runner
bench_qs --> "pyperf.Runner" Runner
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The new PEP585-style generics (e.g. list[tuple[str, str]]) aren’t supported on Python 3.8 as declared in your config—either revert to typing.List/Tuple or bump the minimum Python version.
- In the README code snippet you imported
listfrom typing, which is invalid—switch that import toList(or remove it and use the built-in list) to avoid errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new PEP585-style generics (e.g. list[tuple[str, str]]) aren’t supported on Python 3.8 as declared in your config—either revert to typing.List/Tuple or bump the minimum Python version.
- In the README code snippet you imported `list` from typing, which is invalid—switch that import to `List` (or remove it and use the built-in list) to avoid errors.
## Individual Comments
### Comment 1
<location> `benchmarks.py:38-40` </location>
<code_context>
def parse_url_encoded_form_data(encoded_data: bytes) -> Dict[str, Any]:
"""Parse an url encoded form data into dict of parsed values"""
- decoded_dict: DefaultDict[str, List[Any]] = defaultdict(list)
+ decoded_dict: DefaultDict[str, list[Any]] = defaultdict(list)
for k, v in parse_qsl(encoded_data.decode(), keep_blank_values=True):
</code_context>
<issue_to_address>
**issue:** Using built-in generic types for defaultdict may impact compatibility with older Python versions.
This type annotation is only supported in Python 3.9 and above; consider using the older syntax if you need compatibility with earlier versions.
</issue_to_address>
### Comment 2
<location> `README.md:130` </location>
<code_context>
def parse_url_encoded_form_data(encoded_data: bytes) -> Dict[str, Any]:
"""Parse an url encoded form data into dict of parsed values"""
- decoded_dict: DefaultDict[str, List[Any]] = defaultdict(list)
+ decoded_dict: DefaultDict[str, list[Any]] = defaultdict(list)
</code_context>
<issue_to_address>
**issue (typo):** Change 'an url' to 'a url' in the docstring for correct grammar.
Replace 'an' with 'a' before 'url' in the docstring for grammatical accuracy.
```suggestion
"""Parse a url encoded form data into dict of parsed values"""
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: Winston H. <56998716+winstxnhdw@users.noreply.github.com>
JacobCoffee
approved these changes
Nov 25, 2025
Member
|
thanks @winstxnhdw ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As mentioned here, we default to selecting all lint rules.
cc: @JacobCoffee
Summary by Sourcery
Modernize project configuration and code style by defaulting to all Ruff lint rules, adopting PEP 585 generics throughout, cleaning up test parametrization, and synchronizing documentation with these changes.
Enhancements:
Documentation: