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

Added Travis CI Configuration #94

Merged
merged 12 commits into from
Jan 23, 2018
Merged

Added Travis CI Configuration #94

merged 12 commits into from
Jan 23, 2018

Conversation

brhoades
Copy link
Member

@brhoades brhoades commented Jan 18, 2018

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

.travis.yml Outdated
install:
- pip install -r requirements.txt
script:
- pyflakes assigner/**/*.py assigner/*.py
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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).

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

You're a madman!

@brhoades
Copy link
Member Author

@LinuxMercedes I'd appreciate it if you could run this branch through a few tests on gitlabs. I can only confirm so much.

"""Make a Gitlab POST request"""
if not params:
Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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):
Copy link
Member Author

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.

Copy link
Member Author

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
Copy link
Member Author

Choose a reason for hiding this comment

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

This was missing :|

Copy link
Member

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__":
Copy link
Member Author

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?

Copy link
Member

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(
Copy link
Member

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

Copy link
Member Author

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

@LinuxMercedes LinuxMercedes added this to the Quality Code milestone Jan 19, 2018
@LinuxMercedes
Copy link
Member

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.
Copy link
Member

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"


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):
Copy link
Member

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...

Copy link
Member Author

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,
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I agree.

@LinuxMercedes
Copy link
Member

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`...)
Copy link
Member

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!!!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@brhoades
Copy link
Member Author

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.

@LinuxMercedes
Copy link
Member

@brhoades Can you clean the commit history up some and then let's merge this!

@brhoades brhoades changed the title WIP: Added Travis CI Configuration Added Travis CI Configuration Jan 23, 2018
@brhoades
Copy link
Member Author

I'll just squash on merge.

@brhoades brhoades merged commit 9f427b3 into master Jan 23, 2018
@LinuxMercedes LinuxMercedes deleted the fb-travis branch February 7, 2018 02:41
@LinuxMercedes LinuxMercedes removed this from the Quality Code milestone Dec 22, 2018
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.

Travis-CI integration Pass pylint with no messages
2 participants