Skip to content

Commit

Permalink
ajout des commentaires de get_scores
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemenceAl committed Nov 21, 2018
1 parent 0bbd736 commit 3583f24
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code_score/get_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,29 @@ def get_comments_score(datas_tot):
return datas["nb_comments"]/datas["nb_lines"]*6

def get_syntax_score(datas):
'''returns a score based on the number of comments per line
if the result is equal to 6 it is a very good score'''
score=6*(1-(datas["syntax_errors"]["hooks_errors"]+datas["syntax_errors"]["parenthesis_errors"]+datas["syntax_errors"]["indentations_errors"])/datas["general_numbers"]["nb_lines"])
if score<0:
score=0
return score

def get_style_score(datas):
'''returns a score based on the number of syntax errors per line
if the result is equal to 6 it is a very good score'''
score=(1-datas["syntax_errors"]["snake_case_errors"]/datas["general_numbers"]["nb_lines"])*6
return score

def get_redundancy_score(datas_tot):
'''returns a score based on the number of repeated lines and redundancy coeff per line
if the result is equal to 6 it is a very good score'''
datas=datas_tot["repetitions"]
score=(1-datas["nb_repeated_lines"]/datas_tot["general_numbers"]["nb_lines"])*(1-datas["redundancy_coeff"])*6
return score

def get_plagiarism_score(datas_tot):
'''returns a score based on the number of the highest similarity with a file
if the result is equal to 6 it is a very good score'''
datas=datas_tot["repetitions"]["plagiarism"]
score=(1-datas["similarity_w_closest_file"])*6
return score
Expand Down

0 comments on commit 3583f24

Please sign in to comment.