Skip to content

Conversation

@MRigal
Copy link
Member

@MRigal MRigal commented Apr 29, 2015

Hi guys,

Several times I ran into some cases where I came across these init() method returning a value, or some unused statements or variables, as well as many pep8 issues. It is never great to make a big change, but since we are now cleaning so many PRs and there will be anyway a big PR with #946 for next version, I thought it could be a good time to clean generally some code.

I took some time to really read once (quickly) all the code line by line. It allowed me also to find some issues or strange behaviour and to add some TODOs.

I would also like to take the opportunity to tackle one other point. We want to be PEP8 conform and this is very good. However one point is at least vague: line length. We have in our code some pieces which are strictly limited to 79 characters and some others to 119.

PEP8 recommends 79 characters, however Django makes some exceptions there: https://docs.djangoproject.com/en/1.8/internals/contributing/writing-code/coding-style/

Should we include the same point in our contribution guidelines? Some PRs have a lot of code doing only line breaks clean-up (which I tried to avoid in this cleaning effort to avoid unnecessary changes). And at the same time, I see a lot of places in the code where we have line breaks that do make the code significantly harder to read. @rozza @DavidBord @thedrow @seglberg @yograterol can I have your opinion on that point?

Review on Reviewable

@MRigal
Copy link
Member Author

MRigal commented Apr 29, 2015

Ah and for sure, this should be rebased and merged last before next release ;-)

@landscape-bot
Copy link

Code Health
Repository health increased by 0.21% when pulling 042cc66 on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@landscape-bot
Copy link

Code Health
Repository health increased by 0.25% when pulling d34c8ee on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.51%) to 91.19% when pulling 042cc66 on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.61%) to 91.09% when pulling d34c8ee on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@rozza
Copy link
Contributor

rozza commented Apr 30, 2015

👍 great work and much needed.

Generally I try to be as pragmatic as possible and value readability over strict conformance. When it comes to line length wise I'd vote for the longer length - we've come a long way from teletypes and early video terminals!

@MRigal
Copy link
Member Author

MRigal commented Apr 30, 2015

Thanks for your input Ross! I am exactly on the same line than you.

I submitted a slightly updated version in the latest commit, I propose to everybody to review and comment it

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.61%) to 91.08% when pulling b9eeaae on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@landscape-bot
Copy link

Code Health
Repository health increased by 0.25% when pulling c90f70d on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

1 similar comment
@landscape-bot
Copy link

Code Health
Repository health increased by 0.25% when pulling c90f70d on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.16%) to 91.53% when pulling c90f70d on MRigal:fix/various-fixes into 3f14958 on MongoEngine:master.

@DavidBord
Copy link
Contributor

I am with @rozza

@mmellison
Copy link
Contributor

As I agree with readability > strict adherence - however I personally prefer the pep8 style of <= 79 characters. Simply because I work from the road so much that when I only have my laptop screen to work with, I will open multiple files side by side (and I shudder when I see horizontal scrolling :P). But at the end of the day if it comes down to it, I can turn on line wrapping.

@landscape-bot
Copy link

Code Health
Repository health increased by 0.29% when pulling c90f70d on MRigal:fix/various-fixes into 7f442f7 on MongoEngine:master.

@MRigal MRigal mentioned this pull request May 13, 2015
@MRigal
Copy link
Member Author

MRigal commented Jun 11, 2015

For sure I can rebase, but as I said on top, I thought this would be the "last merged PR" before we make the next release

@MRigal MRigal added this to the 0.10 milestone Jun 12, 2015
@MRigal MRigal force-pushed the fix/various-fixes branch from c90f70d to 0aeb1ca Compare June 23, 2015 22:50
@landscape-bot
Copy link

Code Health
Repository health increased by 0.05% when pulling 0aeb1ca on MRigal:fix/various-fixes into 4c80154 on MongoEngine:master.

@landscape-bot
Copy link

Code Health
Repository health increased by 0.05% when pulling 839bc99 on MRigal:fix/various-fixes into 4c80154 on MongoEngine:master.

MRigal added a commit that referenced this pull request Jun 24, 2015
Pep8, code clean-up and 0.10.0 changelog finalisation
@MRigal MRigal merged commit 45cb991 into MongoEngine:master Jun 24, 2015
@MRigal
Copy link
Member Author

MRigal commented Jun 24, 2015

You're welcome, I wasn't the only one to work on it! I have made this release: https://github.com/MongoEngine/mongoengine/releases/tag/v0.10.0
But I don't think I can submit it to PyPi, could you @thedrow do it or teach me how to do it? Alternatively, we may think to integrate an automatic submission possibility via Travis, like following: http://docs.travis-ci.com/user/deployment/pypi/

@MRigal
Copy link
Member Author

MRigal commented Jun 24, 2015

ufff... release amateur... sorry. I'm not very experienced in it :-)
I guess I've fixed it now, let's see if Travis restarts the build and puts it then to PyPi

@MRigal
Copy link
Member Author

MRigal commented Jun 24, 2015

Yes, I saw! Cool :-)

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.

7 participants