impactlab / eemeter

‼️ MOVED TO https://github.com/openeemeter/eemeter - Core computation engine for the Open Energy Efficiency Meter
https://eemeter.readthedocs.io/
MIT License
25 stars 13 forks source link

fixing some "broken windows" #132

Open crolfe opened 8 years ago

crolfe commented 8 years ago

Hi there!

I have been reading through the tests, and noticed a few rough edges that should be fairly easy to clean up. Primarily, these are things that would normally get flagged by an automated linting tool: unused imports, incorrect line lengths, undefined variables etc. I have also come across a few tests that either do not make any assertions, or would not run because they have been redefined in a file (e.g. test_project_attributes in tests/test_meter_library.py)

What I propose is the following:

This will touch a number of files, so please advise if I should start from a different branch than master to avoid conflicts. I am happy to take this on if you would like to see this addressed.

P.S. in case you were wondering on my inspiration for the title: https://blog.codinghorror.com/the-broken-window-theory/

philngo commented 8 years ago

Hey, thanks for the interest! These suggestions are great, and fit nicely with a couple of other issues (setting up coverage, using tox, etc) on our timeline that will help us avoid code rot and make this library better for developers and users.

Lets have you start from the develop branch, rather than master. We're working on an sprint right now toward v0.4, which will have some breaking API changes - so the three items you've mentioned, i.e. adding pytest-flake8 and resolving PEP8 issues, and adding assertions to tests missing assertions - will be very helpful in making sure that we get things in tip-top shape for v0.4

crolfe commented 8 years ago

Thanks for the quick response. I have started a branch off develop and will let you know if I have any questions as I move along.

By the way, is there any preference for a max line length? 80 columns has been the standard for quite a while, but sometimes 120 can be OK too. At my current workplace we are strict about 80, which can feel a bit restrictive, but I find it forces you to be succinct and seems more readable.

philngo commented 8 years ago

Max line length of 80 is great. I went ahead and out of curiosity installed pytest-flake8 locally yesterday so that I could run py.test --flake8 to see what it would flag, and I'm happy with the default < 80 column limit it imposes. The lines it flagged did seem a bit long, so let's move forward with that.

crolfe commented 8 years ago

I have opened a pull request, but I would like to call attention to a couple of things, which are currently marked with TODOs: