Fix/code quality issues#164
Open
anderslindho wants to merge 8 commits into
Open
Conversation
simon-ess
reviewed
May 13, 2026
Comment on lines
-27
to
-29
| class SourceAddress: | ||
| host: str | ||
| port: int |
Contributor
There was a problem hiding this comment.
Aren't we losing something here? Previously we had a concrete data structure for the source address. Now we do not.
The same is true I suppose of all the properties: we are going from typed properties to non-typed ones, aren't we?
Contributor
Author
There was a problem hiding this comment.
We are, yes, but this was just a hack. No instance of the class was ever used.
Contributor
Author
There was a problem hiding this comment.
I tried another way to do the same, maybe you can try it out @jacomago
jacomago
approved these changes
May 13, 2026
The field existed on CFConfig but was never read from the config adapter, so it was permanently hardcoded to "ENGINEER" with no way to override it per-deployment.
pollreactor.install() was called at module level, replacing the global Twisted reactor as a side effect of any import of recceiver.application. This made import order significant in tests and prevented them from controlling which reactor is used.
Three identical if-self.cancelled / raise CancelledError blocks were scattered through _update_channelfinder with slightly inconsistent messages. Collects the pattern into one place so the cancellation contract is visible and the checks read as one-liners.
…tion CommitTransaction was defined in interfaces.py and used as a type annotation in processor.py, but was never constructed anywhere — the actual runtime value passed is always a Transaction (duck-typed via ITransaction). The annotation was a dead end for any reader following the type. Remove CommitTransaction and SourceAddress (only used by CommitTransaction), extend ITransaction with the aliases/initial/connected attributes that were also defined on CommitTransaction, and annotate processor methods with interfaces.ITransaction to match the real call contract.
- Drop (object) bases on Transaction and CollectionSession - Rename self.T/_ping_timer in CastReceiver and self.T/_flush_deadline, self.C/_commit_chain in CollectionSession — the same name T carried different types in the two classes, making the code harder to follow - Convert remaining .format() strings to f-strings throughout
Rename the module-level logger from _log to log in all recceiver modules so that ruff's G (flake8-logging-format) rules can detect logging calls by variable name. In application.py, the existing twisted.python.log import is aliased to twisted_log to avoid the name collision. Convert all logging calls that used f-strings or str.format to use %-style lazy formatting, and enable the G ruleset in ruff so regressions are caught automatically.
0360a13 to
16ea37f
Compare
Eliminates the duplicated "Protocol error! %s" literal that Sonar flagged as a high-priority code smell (three occurrences in recast.py).
…nsaction docs Annotates Transaction's instance variables and __init__ signature with concrete types so static analysis tools can check callers. Also corrects the stale ITransaction.records_to_add doc (2-tuple, not 3), and narrows the source_address description to the IAddress duck type it actually is.
16ea37f to
0e8023d
Compare
|
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.



No description provided.