Skip to content

Conversation

@utdrmac
Copy link

@utdrmac utdrmac commented Mar 18, 2025

This is a work-in-progress branch to slowly add some common code standards using Ruff. As to not make one massive branch, this PR only fixes pycodingstyle rules, and basic code-error checks from pyflakes. You can see these rules in effect inside ruff.toml.

Checking is simple: ruff check to check the entire codebase.

Over time, more rules can be added. Inside ruff.toml, commented out, you can see the ruleset/ignores I typically use in my projects.

@HotNoob HotNoob changed the base branch from main to v1.1.9 March 18, 2025 20:43
discovery_enabled : bool = False
json : bool = False
reconnect_delay : int = 7
''' seconds '''
Copy link
Owner

Choose a reason for hiding this comment

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

''' is prefered over # for commenting variable defs for my ide.

image

doesnt show on my ide when hovering variables.

minor thing

if not self.protocolSettings.validate_registry_entry(entry, current_value):
raise ValueError("Invalid value in register. unsafe to write") #i need to figure out a better error handler for theese.

# if not self.protocolSettings.validate_registry_entry(entry, current_value):
Copy link
Owner

Choose a reason for hiding this comment

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

i would like to keep this in.
adding a transport setting to handle disabling this would be the "proper" way todo it.

validating the "current value" is important for detecting the accuracy of the register definitions. ie, making sure your not writting to the wrong reigster.

maybe a

allow_unsafe_writes = True

setting could be added.

Copy link
Author

Choose a reason for hiding this comment

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

Woops. That was my hack to get writing to work in that other issue. I'll revert.


size = len(packet)
crc = computeCRC(packet)
crc2 = calculate_crc(packet,size)
Copy link
Owner

Choose a reason for hiding this comment

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

hmm. i'm not sure if i completed the pace transport. i think it's still a work in progress.

Copy link
Author

Choose a reason for hiding this comment

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

I'll put this back then, but comment it out.

@HotNoob
Copy link
Owner

HotNoob commented Mar 18, 2025

looks good. ty for contributing.
i'll have to try out the ruff linting.

@HotNoob HotNoob merged commit 629af3e into HotNoob:v1.1.9 Mar 18, 2025
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.

2 participants