Skip to content

Conversation

@haydenbaker
Copy link
Contributor

Description of changes:

  • Adds a batch of new rules - I, T, UP, C4, PIE, and RUF
  • There is a commit for each rule with its changes if you want to see the specific changes a rule made
    • some changes were made by hand (i.e. they didn't have autofix)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@haydenbaker haydenbaker requested a review from a team as a code owner February 26, 2025 17:25
Copy link
Contributor

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

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

Minor formatting comments, I think we may be missing configuration for ruff in most of the projects.

Comment on lines 24 to 25
from aws_event_stream.events import Byte, EventMessage, Long, Short

Copy link
Contributor

Choose a reason for hiding this comment

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

These are first party imports from the same package, I'd expect it to be where it was at previously. Did we not fully configure the settings for I to recognize this as a first-party import? We may need to configure src like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we'll have to add that to each subprojects toml file if we want them to be recognized as 1p.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

the `response`. If multiple `read_before_execution` methods throw exceptions,
the latest will be used and earlier ones will be logged and dropped.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be raising NotImplementedError rather than just passing? Having the functions be no-ops seems odd.

Copy link
Contributor

Choose a reason for hiding this comment

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

They very specifically need to be no-ops. The usage is something like

for interceptor in interceptors:
    interceptor.read_before_execution(...)

But not every implementation will implement all of these hooks. So if we had them throwing not implemented then we'd have to catch and ignore that, adding a bunch of useless thrashing

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this explicitly be return None then as a default if we're not expecting all of these to be implemented? Having a completely bare function is abnormal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Apparently this has already been a hotly debated topic that ruff has taken an opinionated stance on. It feels weird, but we can go with it if people feel strongly about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah iirc there are some that prefer pass some that prefer ... and so on. Functions have to have some sort of statement to be valid, but that statement can be the doc string. I really don't care so long as it doesn't impact performance.

@haydenbaker haydenbaker force-pushed the haydenbaker/add-new-ruff-rules branch from 335fd2a to 1f5b93d Compare February 26, 2025 17:38
from dataclasses import dataclass
from io import BytesIO
from struct import pack, unpack
from types import MappingProxyType
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL

)

Document: TypeAlias = (
type Document = (
Copy link
Contributor

@JordonPhillips JordonPhillips Feb 26, 2025

Choose a reason for hiding this comment

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

I forgot this was still here - probably needs to be deleted (that can be done later)

@haydenbaker haydenbaker merged commit b0043d0 into develop Feb 28, 2025
1 check passed
@haydenbaker haydenbaker deleted the haydenbaker/add-new-ruff-rules branch February 28, 2025 16:48
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.

3 participants