Ejemplo n.º 1
0
def analyze(request, project_id):
    project = get_object_or_404(Project, pk=project_id)
    result_analysis = code_analysis(project)

    analysis = Analysis()
    analysis.project = project
    analysis.pep8 = result_analysis['pep8']['percentage_errors']
    analysis.pyflakes = result_analysis['pyflakes']['percentage_errors']
    analysis.clonedigger = result_analysis['clonedigger']['percentage_errors']
    analysis.jshint = result_analysis['jshint']['percentage_errors']
    analysis.csslint = result_analysis['csslint']['percentage_errors']
    analysis.result = result_analysis
    analysis.save()

    return HttpResponse('done')
Ejemplo n.º 2
0
def run_task(request, project_id, task):
    project = get_object_or_404(Project, pk=project_id)
    errors = code_analysis(project, task=task)

    analysis = Analysis.objects.filter(
        project_id=project_id).order_by('-date_executed')[0]

    try:
        analysis_task = getattr(analysis, task)
    except AttributeError:
        raise Http404

    analysis_task = errors['total_errors']
    analysis.save()

    return HttpResponse(analysis_task)