PiSupply / PaPiRus

Resources for PaPiRus ePaper eInk displays
https://www.pi-supply.com/product/papirus-epaper-eink-screen-hat-for-raspberry-pi/
Other
346 stars 85 forks source link

feat: flake8 and sonarcloud fixes #225

Open shawaj opened 1 year ago

shawaj commented 1 year ago

Remaining flake8 issues:

File papirus/epd.py...

Warning: ./papirus/epd.py:55:40: W605 invalid escape sequence '\s'
Warning: ./papirus/epd.py:55:44: W605 invalid escape sequence '\d'
Warning: ./papirus/epd.py:55:47: W605 invalid escape sequence '\.'
Warning: ./papirus/epd.py:55:49: W605 invalid escape sequence '\d'
Warning: ./papirus/epd.py:55:53: W605 invalid escape sequence '\s'
Warning: ./papirus/epd.py:55:57: W605 invalid escape sequence '\d'
Warning: ./papirus/epd.py:55:63: W605 invalid escape sequence '\d'
Warning: ./papirus/epd.py:55:67: W605 invalid escape sequence '\s'
Warning: ./papirus/epd.py:55:73: W605 invalid escape sequence '\s'
Warning: ./papirus/epd.py:55:77: W605 invalid escape sequence '\d'
Error: ./papirus/epd.py:55:80: E501 line too long (110 > 79 characters)
Warning: ./papirus/epd.py:55:81: W605 invalid escape sequence '\s'
Warning: ./papirus/epd.py:55:88: W605 invalid escape sequence '\s'
Warning: ./papirus/epd.py:55:92: W605 invalid escape sequence '\d'
Warning: ./papirus/epd.py:55:96: W605 invalid escape sequence '\s'

File papirus/text.py...

Warning: ./papirus/text.py:26:9: F841 local variable 'lineSize' is assigned to but never used

File papirus/textpos.py...

Warning: ./papirus/textpos.py:79:5: C901 'PapirusTextPos.addToImageText' is too complex (13)

File projects/twitter_feed.py...

Warning: ./projects/twitter_feed.py:5:1: F401 'papirus.Papirus' imported but unused
Warning: ./projects/twitter_feed.py:6:1: F401 'papirus.PapirusText' imported but unused
Warning: ./projects/twitter_feed.py:65:9: F821 undefined name 'write_text'
Warning: ./projects/twitter_feed.py:65:20: F821 undefined name 'papirus'
Warning: ./projects/twitter_feed.py:65:44: F821 undefined name 'SIZE'
Warning: ./projects/twitter_feed.py:67:9: F821 undefined name 'papirus'

@ChristopherRush any idea on the ones for twitter_feed.py? As you wrote this, I thought you might be able to have a better idea

shawaj commented 1 year ago

For the papirus/text.py one I'm wondering self.papirus.width on line 38 should actually be lineSize

https://github.com/PiSupply/PaPiRus/blob/0023db4496b22ecb2b5276db1d4860e9e702af52/papirus/text.py#L38

shawaj commented 1 year ago

For the papirus/textpos.py one, I'm thinking to just ignore this for now, and open a new issue on the repo to fix this another time.

Thoughts?

shawaj commented 1 year ago

For the papirus/epd.py issues it looks like we can just use an r string: https://docs.python.org/3/library/re.html

And split the line in two for the line length

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

shawaj commented 1 year ago

I'm not a fan of camelCase (and it seems sonarcloud isn't either! 😂)

However since this was only introduced in #144 I'm going to revert the changes I made on these and dismiss the code smells in sonarcloud 👍