-
Notifications
You must be signed in to change notification settings - Fork 7
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
Added Travis CI Configuration #94
Conversation
.travis.yml
Outdated
install: | ||
- pip install -r requirements.txt | ||
script: | ||
- pyflakes assigner/**/*.py assigner/*.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be pyflakes assigner
-- pyflakes
(and pylint
) take the name of a python module to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this isn't like flake8 at all.
- pip install -r requirements.txt | ||
script: | ||
- pyflakes assigner | ||
- pylint assigner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave pylint
commented out until I fix all the remaining warnings! I'll start working on that but it'll be a bit (got some 5201 stuff to do first).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already did it, sorry. It's soothing as hell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're a madman!
name was being shadowed by an instance var.
@LinuxMercedes I'd appreciate it if you could run this branch through a few tests on gitlabs. I can only confirm so much. |
assigner/baserepo.py
Outdated
"""Make a Gitlab POST request""" | ||
if not params: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love a better way to do this. Per pylint, default parameters that are objects are shared across all invocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true, although in this case it's not a problem and perhaps even cuts down on the amount of garbage allocated (although frankly I'm really not worried about that for Assigner 😄).
The reason why it's not a problem is that this function doesn't carry state in the default params
or payload
objects -- the default payload
object just stays empty, and the default params
object just has the private_token
key which is updated every time around. I suppose we could worry about requests.post
modifying them but it doesn't seem to right now.
In short: I'm ok with telling pylint
to ignore that error in these cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, I will go back and update this.
@@ -422,7 +456,7 @@ def new(cls, base_repo, semester, section, username, token): | |||
return cls.from_url(result["http_url_to_repo"], token) | |||
|
|||
@classmethod | |||
def name(cls, semester, section, assignment, user): | |||
def build_name(cls, semester, section, assignment, user): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method had some weird conflict with Repo.name set in init. I highly doubt this ever caused a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't work anyway... functions were missing args.
pylint==1.8.1 | ||
wrapt==1.10.11 | ||
python-utils==2.2.0 | ||
tqdm==4.19.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing :|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah dang, can you add a step in the release steps in CONTRIBUTING.md
for updating requirements.txt
?
@@ -436,18 +470,3 @@ def name(cls, semester, section, assignment, user): | |||
def push(self, base_repo, branch="master"): | |||
"""Push base_repo code to this repo""" | |||
base_repo.push_to(self, branch) | |||
|
|||
|
|||
if __name__ == "__main__": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed this wasn't being used and was for testing / from the old one file assigner.
@LinuxMercedes @michaelwisely confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that all can go!
result.ref.name, str(result.old_commit)[:8], str(result.ref.commit)[:8] | ||
)]) | ||
output.add_row([ | ||
row, sec, sid, name, "{}: {} -> {}".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time I see this line, the {}: {} -> {}
bit fills me with hope that I've somehow stumbled into a haskell codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it looks like a js lambda for me :D
Holy crap this is nice! I'll run it through its paces tomorrow morning. |
CHANGELOG.md
Outdated
@@ -1,5 +1,7 @@ | |||
## Devel | |||
|
|||
- Removed lint, removed old baserepo standalone code, and added travis config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to split this into two things? (lint/old code & travis)
I'm no stickler for "one change per PR"
assigner/baserepo.py
Outdated
|
||
def _gl_get(self, path, params={}): | ||
return self.__class__._cls_gl_get( | ||
self.url_base, path, self.token, params | ||
) | ||
|
||
def _gl_post(self, path, payload={}, params={}): | ||
def _gl_post(self, path, payload={}, _=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should actually probably be passing params
through to _cls_gl_post
here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done. This is when happens when you fix lint without reading code.
pylintrc
Outdated
@@ -143,6 +143,7 @@ disable=print-statement, | |||
too-many-statements, | |||
attribute-defined-outside-init, | |||
redefined-builtin, | |||
dangerous-default-value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep this warning on by default; in general it's correct. In baserepo.py
we can do something like #pylint: disable=dangerous-default-value
to silence just those warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I agree.
I've poked this some and it seems to work just fine! I'll probably run it through its paces on 5201 homework 1 before I'm comfortable merging it, though. @brhoades does this fix any bugs or is it "just" syntax changes? If it's the latter, I will probably just roll this into the next release, whenever that happens. |
CONTRIBUTING.md
Outdated
@@ -21,6 +21,7 @@ Before merging: | |||
- Describe the change in `CHANGELOG.md` | |||
- Make sure `pyflakes assigner` passes with no errors/warnings | |||
- Check `pylint assigner` and make sure it's not too egregious. (Eventually we'll get the code to a point where there are no messages from `pylint`...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should change this to require pylint
to pass now that you've done all the work!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Made dangerous-default-args a warning again.
There was some bug that pylint claimed to find where BaseRepo.name = "" was overriding StudentRepo.name(), but since the latter is a classmethod this was a nonissue. |
@brhoades Can you clean the commit history up some and then let's merge this! |
I'll just squash on merge. |
WIP: Not sure if this is done, I need Travis to pick up this branch first.
Cool, pyflakes works. I'll add flake8 and do linting for an hour.
Fixes #81 and fixes #80