EstevanTH / OBD-to-JSON_ELM327

Relay reading OBD data from an ELM327 chip, producing HTTP + WebSocket JSON outputs & CSV log
GNU Lesser General Public License v3.0
9 stars 3 forks source link

Suggestion: follow PEP8 standards for variables and formatting #1

Open RoninDusette opened 5 years ago

RoninDusette commented 5 years ago

Given that python is a space delineated language it is important to keep spacing consistent. Now, there are way too many spaces at least for my taste. Not saying it's wrong, but adhering to the standards would make it much more readable. It still is but ideally 4 spaces should be enough for nesting. Also camel casing shouldn't be used with variables. Words should be separated with underscores if it's a method or variable and classes should be snake cased. It makes it easier for others to contribute (which I wouldn't mind doing.). The method names should be like verb_property (get_pid_name). The main reason these things are useful is that good IDE will recognize them for what they are, help with code completion and intention, doc generators will be ae to parse properly etc. It's super handy to fall in line as it just makes life easier. You can totally do what you like, and I like what you are doing. Again, I wouldn't mind helping as I'm a gearhead and use hp tuners and build some quick cars. Even writing a datalogging app that will spit out hp tuners log files from an android head unit or phone so that you can use something like obdlink mx to log to an android without keeping your expensive mpvi on the car. It's just a suggestion and it really would make dev easier.

EstevanTH commented 4 years ago

Hey @RoninDusette,

Sorry for the time it took me to post this answer. Please know that I am really glad to read from you! I did not browse the PEPs before you sent this message, and I discovered the PEP8 and other great things like type hints.

I needed some time to go ahead and psychologically accept the recommendations. Now that they totally make sense to me (for the sake of quality, popularity and maintainability), I began migrating the existing code by adding new code that conforms to the standards. In the near future, I will do the same for the existing code, which will also be an opportunity to proofread my code once more.

My upcoming CAN-ETH to JSON will be out-of-the-box conform to a maximum of standards' rules.

BTW I really like what you do. I have read the e-book The car's hacker handbook and I have an idea of what your work consists of. I absolutely do not have this level but it's been great to reverse-engineer CAN frames on my Citroën Nemo!

Thanks for your time, cheers! ❤️