示例#1
0
def analyze_project(request, project_id):
    project = Project.objects.get(id=project_id)

    pep8_analyzer = PEP8Analyzer(project)
    result_pep8 = pep8_analyzer.analyze()
    pep8_badge = PEP8Achievement(result_pep8)

    clone_digger = ClonneDiggerAnalyzer(project)
    clone_digger_result = clone_digger.analyze()
    clone_digger_achievement = CloneDiggerAchivement(clone_digger_result)

    context = {}
    context['pep8_achievement'] = pep8_badge.get_achievement()
    context['clone_digger_achievement'] = clone_digger_achievement.get_achievement()

    return TemplateResponse(request, "project/result.html", context)
    def test_get_clonnedigger_report_from_project(self):
        project = Project.objects.create(url="media/sources/fake-github.tar.gz")
        analyzer = ClonneDiggerAnalyzer(project)

        self.assertAlmostEquals(19.24, analyzer.analyze())