Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruff for linting, remove flake8, remove isort #114

Merged
merged 35 commits into from
Jan 3, 2023

Conversation

gsheni
Copy link
Contributor

@gsheni gsheni commented Dec 30, 2022

  • Added ruff for running linting
  • Added ruff commands to Makefile
  • Added ruff to pre-commit
  • Removed variables in unit tests that were unused (maybe some of these should be asserted?)
  • Removed flake8 as dev dependency, since ruff does this, but faster
  • Remove isort as dev dependency, since ruff has the same function, but faster

@gsheni gsheni changed the title Add ruff for linting and remove flake8 Add ruff for linting, remove flake8, remove isort Dec 30, 2022
@gsheni gsheni marked this pull request as ready for review December 30, 2022 21:19
pyproject.toml Outdated
@@ -115,3 +107,25 @@ requires = [
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.ruff]
# Never enforce `E501` (line length violations), lines cannot be > 79 chars
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this what we want? does it enforce any line length violations?

Copy link
Contributor Author

@gsheni gsheni Jan 2, 2023

Choose a reason for hiding this comment

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

  • By default ruff does enforce line length violations (lines cannot be greater than 88 characters).
  • When I ran ruff, I got the below violations. These seemed like a lot, and many of them were just minor things.
  • I can fix all of these violations if you want. Here is a preview of the needed changes (bb215e4)
  • However, this might make it annoying for developers going forward. Therefore, I figured line length violation could be ignored for now.
ruff gridstatus/
gridstatus/base.py:84:89: E501 Line too long (128 > 88 characters)
gridstatus/base.py:86:89: E501 Line too long (134 > 88 characters)
gridstatus/base.py:88:89: E501 Line too long (158 > 88 characters)
gridstatus/caiso.py:74:89: E501 Line too long (128 > 88 characters)
gridstatus/caiso.py:76:89: E501 Line too long (134 > 88 characters)
gridstatus/caiso.py:78:89: E501 Line too long (158 > 88 characters)
gridstatus/caiso.py:144:89: E501 Line too long (114 > 88 characters)
gridstatus/caiso.py:145:89: E501 Line too long (136 > 88 characters)
gridstatus/caiso.py:177:89: E501 Line too long (185 > 88 characters)
gridstatus/caiso.py:207:89: E501 Line too long (165 > 88 characters)
gridstatus/caiso.py:210:89: E501 Line too long (136 > 88 characters)
gridstatus/caiso.py:244:89: E501 Line too long (201 > 88 characters)
gridstatus/caiso.py:336:89: E501 Line too long (97 > 88 characters)
gridstatus/caiso.py:338:89: E501 Line too long (159 > 88 characters)
gridstatus/caiso.py:349:89: E501 Line too long (174 > 88 characters)
gridstatus/caiso.py:388:89: E501 Line too long (97 > 88 characters)
gridstatus/caiso.py:393:89: E501 Line too long (151 > 88 characters)
gridstatus/caiso.py:526:89: E501 Line too long (97 > 88 characters)
gridstatus/caiso.py:547:89: E501 Line too long (98 > 88 characters)
gridstatus/caiso.py:554:89: E501 Line too long (108 > 88 characters)
gridstatus/caiso.py:585:89: E501 Line too long (99 > 88 characters)
gridstatus/caiso.py:652:89: E501 Line too long (97 > 88 characters)
gridstatus/caiso.py:661:89: E501 Line too long (187 > 88 characters)
gridstatus/caiso.py:706:89: E501 Line too long (97 > 88 characters)
gridstatus/caiso.py:716:89: E501 Line too long (195 > 88 characters)
gridstatus/decorators.py:101:89: E501 Line too long (112 > 88 characters)
gridstatus/decorators.py:102:89: E501 Line too long (99 > 88 characters)
gridstatus/ercot.py:69:89: E501 Line too long (116 > 88 characters)
gridstatus/ercot.py:100:89: E501 Line too long (118 > 88 characters)
gridstatus/ercot.py:140:89: E501 Line too long (93 > 88 characters)
gridstatus/ercot.py:145:89: E501 Line too long (102 > 88 characters)
gridstatus/ercot.py:311:89: E501 Line too long (135 > 88 characters)
gridstatus/ercot.py:314:89: E501 Line too long (105 > 88 characters)
gridstatus/ercot.py:362:89: E501 Line too long (95 > 88 characters)
gridstatus/ercot.py:367:89: E501 Line too long (93 > 88 characters)
gridstatus/ercot.py:383:89: E501 Line too long (170 > 88 characters)
gridstatus/ercot.py:473:89: E501 Line too long (102 > 88 characters)
gridstatus/ercot.py:498:89: E501 Line too long (108 > 88 characters)
gridstatus/ercot.py:598:89: E501 Line too long (96 > 88 characters)
gridstatus/ercot.py:739:89: E501 Line too long (101 > 88 characters)
gridstatus/ercot.py:762:89: E501 Line too long (100 > 88 characters)
gridstatus/isone.py:26:89: E501 Line too long (110 > 88 characters)
gridstatus/isone.py:150:89: E501 Line too long (106 > 88 characters)
gridstatus/isone.py:213:89: E501 Line too long (104 > 88 characters)
gridstatus/isone.py:222:89: E501 Line too long (96 > 88 characters)
gridstatus/isone.py:254:89: E501 Line too long (110 > 88 characters)
gridstatus/isone.py:283:89: E501 Line too long (125 > 88 characters)
gridstatus/isone.py:305:89: E501 Line too long (94 > 88 characters)
gridstatus/isone.py:307:89: E501 Line too long (129 > 88 characters)
gridstatus/isone.py:320:89: E501 Line too long (113 > 88 characters)
gridstatus/isone.py:348:89: E501 Line too long (108 > 88 characters)
gridstatus/isone.py:466:89: E501 Line too long (119 > 88 characters)
gridstatus/isone.py:473:89: E501 Line too long (114 > 88 characters)
gridstatus/isone.py:474:89: E501 Line too long (117 > 88 characters)
gridstatus/isone.py:514:89: E501 Line too long (102 > 88 characters)
gridstatus/isone.py:535:89: E501 Line too long (95 > 88 characters)
gridstatus/isone.py:574:89: E501 Line too long (96 > 88 characters)
gridstatus/isone.py:600:89: E501 Line too long (92 > 88 characters)
gridstatus/miso.py:114:89: E501 Line too long (126 > 88 characters)
gridstatus/miso.py:131:89: E501 Line too long (137 > 88 characters)
gridstatus/miso.py:253:89: E501 Line too long (108 > 88 characters)
gridstatus/miso.py:276:89: E501 Line too long (109 > 88 characters)
gridstatus/miso.py:277:89: E501 Line too long (250 > 88 characters)
gridstatus/nyiso.py:20:89: E501 Line too long (109 > 88 characters)
gridstatus/nyiso.py:237:89: E501 Line too long (127 > 88 characters)
gridstatus/nyiso.py:240:89: E501 Line too long (100 > 88 characters)
gridstatus/nyiso.py:246:89: E501 Line too long (94 > 88 characters)
gridstatus/nyiso.py:350:89: E501 Line too long (91 > 88 characters)
gridstatus/nyiso.py:431:89: E501 Line too long (139 > 88 characters)
gridstatus/nyiso.py:660:89: E501 Line too long (117 > 88 characters)
gridstatus/nyiso.py:664:89: E501 Line too long (139 > 88 characters)
gridstatus/nyiso.py:671:89: E501 Line too long (152 > 88 characters)
gridstatus/pjm.py:150:89: E501 Line too long (113 > 88 characters)
gridstatus/pjm.py:185:89: E501 Line too long (120 > 88 characters)
gridstatus/pjm.py:215:89: E501 Line too long (183 > 88 characters)
gridstatus/pjm.py:216:89: E501 Line too long (197 > 88 characters)
gridstatus/pjm.py:219:89: E501 Line too long (171 > 88 characters)
gridstatus/pjm.py:226:89: E501 Line too long (98 > 88 characters)
gridstatus/pjm.py:228:89: E501 Line too long (151 > 88 characters)
gridstatus/pjm.py:229:89: E501 Line too long (143 > 88 characters)
gridstatus/pjm.py:231:89: E501 Line too long (207 > 88 characters)
gridstatus/pjm.py:440:89: E501 Line too long (93 > 88 characters)
gridstatus/spp.py:30:89: E501 Line too long (122 > 88 characters)
gridstatus/spp.py:31:89: E501 Line too long (128 > 88 characters)
gridstatus/spp.py:162:89: E501 Line too long (106 > 88 characters)
gridstatus/spp.py:250:89: E501 Line too long (101 > 88 characters)
gridstatus/spp.py:251:89: E501 Line too long (92 > 88 characters)
gridstatus/spp.py:252:89: E501 Line too long (94 > 88 characters)
gridstatus/spp.py:279:89: E501 Line too long (102 > 88 characters)
gridstatus/spp.py:555:89: E501 Line too long (124 > 88 characters)
gridstatus/spp.py:585:89: E501 Line too long (113 > 88 characters)
gridstatus/tests/test_viz.py:23:89: E501 Line too long (90 > 88 characters)
gridstatus/utils.py:242:89: E501 Line too long (89 > 88 characters)
gridstatus/viz.py:9:89: E501 Line too long (116 > 88 characters)

Copy link
Collaborator

@kmax12 kmax12 Jan 2, 2023

Choose a reason for hiding this comment

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

the line length fixes that are currently in the PR don't seem too bad. that is with the 88 character limit, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed all line lengths.

Copy link
Collaborator

@kmax12 kmax12 left a comment

Choose a reason for hiding this comment

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

never heard of ruff before. PR looks good and seems to have fixed on issues in the codebase.

just one question and than we can merge this in

Thanks!

gridstatus/caiso.py Outdated Show resolved Hide resolved
gridstatus/pjm.py Outdated Show resolved Hide resolved
@kmax12
Copy link
Collaborator

kmax12 commented Jan 3, 2023

btw, in case you haven't figured out, we're having a lot of problems with the tests. don't be alarmed if you see tests failing.

@gsheni
Copy link
Contributor Author

gsheni commented Jan 3, 2023

@kmax12 yah I figured. :-)
I built docs locally and the API Reference looks good now. Let me know if I missed anything.

@kmax12
Copy link
Collaborator

kmax12 commented Jan 3, 2023

sounds good. will take a look in the morning

Copy link
Collaborator

@kmax12 kmax12 left a comment

Choose a reason for hiding this comment

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

This looks great! Really improved the look of the API reference in the docs and definitely caught some bad coding in the library.

The only thing Im hesitant on is the line length linting. In general I like it, but I hate having to add # noqa in some many places. Will keep thinking if there is a better way to approach this

For now, looks good to merge. Thank you!!

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