예제 #1
0
def grade(pull_request):
    if pull_request.travis_build() is None:
        print("travis not build - branch has conflicts")
        return -1
    print(pull_request.travis_build().url())
    pull_request.check_test_modifications()

    scorer = Scorer(pull_request)
    score, comment = scorer.compute()
    print("score:{s} comment:{c}".format(s=score, c=comment))
    return score, comment
예제 #2
0
    students_by_github_username = Student.all_by_github_username(
        SURVEY_DATA_PATH)

    # TODO include (zero) grades for students who don't have an open pull request
    # TODO if a student has multiple pull requests, use the more recent one
    with open(OUTPUT_PATH, 'w', newline='') as csvfile:
        resultwriter = csv.writer(csvfile)
        # this matches the grading spreadsheet template provided by CMS
        resultwriter.writerow(["NetID", "Grade", "Add Comments"])

        # TODO take out the limit
        for r in pull_requests[0:2]:
            pr = PullRequest(r)

            github_username = pr.user()
            print(github_username, end=': ')

            student = students_by_github_username.get(github_username)
            if student == None:
                print("not enrolled.")
                continue
            print(pr.travis_log_url())
            # TODO ensure test files werent modified

            scorer = Scorer(pr)
            scorer.compute()

            net_id = student.net_id
            # TODO put in actual score
            resultwriter.writerow([net_id, 1, ""])