Skip to content
Extraits de code Groupes Projets
validity_check.py 1,01 ko
Newer Older
  • Learn to ignore specific revisions
  • import csv
    import sys
    
    if __name__ == "__main__":
    
    
        JENK = 'no-contact-jenkins-ingi@uclouvain.be'
    
        modified_lines = sys.argv[1]
        author = sys.argv[2]
        modifs = modified_lines.split('\n')
    
        if len(modifs) != 2:
            print("You modify wrong number of lines !")
            exit(1)
    
        curr_line = modifs[1].split(',')
    
        prev_line = modifs[1].split(',')
    
    
        if len(curr_line) != 4:
            print('You broke file format by suppressing/adding "," !\n')
            exit(1)
    
    
        author = author.lower()
    
        if author not in curr_line[0] and (author not in prev_line[0]) and author not in JENK :
    
            print("You modify the line of another student or use a different email than the one written !\n")
            exit(1)
    
        for i in range(0,4):
            if prev_line[i] != curr_line[i] :
    
                print('You modify your data !\n')
                exit(1)
    
        answer = curr_line[3].lower()
        if answer != 'oui' and answer !=' oui' and answer !='oui ':
            print('You have to write "oui" in the last column !\n')