def test_create_repository(self): testcases = [{ 'url': 'github.com/mingrammer/awesome-finder', 'name': 'awesome-finder', 'username': '******', }, { 'url': 'github.com/django/django', 'name': 'django', 'username': '******', }] for tc in testcases: repo = create_repository(tc['url']) self.assertEqual(repo.url, tc['url']) self.assertEqual(repo.name, tc['name']) self.assertEqual(repo.username, tc['username'])
def test_create_repository(self): testcases = [ { 'url': 'github.com/mingrammer/sorting', 'name': 'sorting', 'username': '******', }, { 'url': 'github.com/django/django', 'name': 'django', 'username': '******', } ] for tc in testcases: repo = create_repository(tc['url']) self.assertEqual(repo.url, tc['url']) self.assertEqual(repo.name, tc['name']) self.assertEqual(repo.username, tc['username'])
def report(repo_url): repo = create_repository(repo_url) if repo is None: flash('Given repository does not exists or could not be accessed') return redirect(url_for('index')) if is_cached(repo): results = mongo.db.repositories.find_one({'url': repo.url}) else: path = clone(repo) results = analyze(path) repo.save_analysis_results(results) cache(repo) clear(path) results = repo.to_document() return render_template('report/results.html', report=results)
def report(repo_url): repo = create_repository(repo_url) if repo is None: flash('Given repository does not exists or could not be accessed') return redirect(url_for('index')) if is_cached(repo): results = mongo.db.repositories.find_one({'url': repo.url}) else: path = clone(repo) count_analyzer = CountAnalyzer() pep8_analyzer = PEP8LintAnalyzer() pyflakes_analyzer = PyflakesLintAnalyzer() license_analyzer = LicenseAnalyzer() count_analyzer.run(path) pep8_analyzer.run(path) pyflakes_analyzer.run(path) license_analyzer.run(path) pep8_analyzer.calculate_score(count_analyzer.total_line_count) pyflakes_analyzer.calculate_score(count_analyzer.total_line_count) repo.save_analysis_results({ **count_analyzer.to_document(), **pep8_analyzer.to_document(), **pyflakes_analyzer.to_document(), **license_analyzer.to_document(), 'report_grade': calculate_report_grade(pep8_analyzer, pyflakes_analyzer) }) cache(repo) clear(path) results = repo.to_document() return render_template('report/results.html', report=results)
def setUp(self): self.repositories = get_repo_collection() self.repo = create_repository('github.com/mingrammer/sorting')
def setUp(self): self.repositories = get_repo_collection() self.repo = create_repository('github.com/mingrammer/awesome-finder')