<commit_before>#!/usr/bin/env python
# List all TODOs in the repository (all lines containing "TODO:")

if __name__ == '__main__':
    from subprocess import Popen, PIPE
    from common import getreporoot
    from os.path import join
    import re

    print __file__
    IGNOREPATT = (
        'devilry/static/jslibs/.+',
        'devilry/static/superadminmedia/.+',
        'devilry/devilryadmin/cmd_todolist.py'
    )

    def ignore(fn):
        for patt in IGNOREPATT:
            if re.match(patt, fn):
                return True

    reporoot = getreporoot()
    p = Popen(['git', 'grep', '-l', 'TODO:'], stdout=PIPE, cwd=reporoot)
    stdout, stderr = p.communicate()
    matchingfiles = stdout.split()
    for fn in matchingfiles:
        if ignore(fn):
            continue
        print '{0}:'.format(fn)
        for lineno, line in enumerate(open(join(reporoot, fn))):
            line = line.strip()
            if 'TODO:' in line:
                print '  Line {0:>5}: {1}'.format(lineno, line)<commit_msg>Made todolist show relative paths<commit_after>#!/usr/bin/env python
# List all TODOs in the repository (all lines containing "TODO:")

if __name__ == '__main__':
    from subprocess import Popen, PIPE
    from common import getreporoot
    from os import getcwd, chdir
    from os.path import join, relpath, abspath
    import re

    print __file__
    IGNOREPATT = (
        'devilry/static/jslibs/.+',
        'devilry/static/superadminmedia/.+',
        'devilry/devilryadmin/cmd_todolist.py'
    )

    def ignore(fn):
        for patt in IGNOREPATT:
            if re.match(patt, fn):
                return True

    reporoot = getreporoot()
    p = Popen(['git', 'grep', '-l', 'TODO:'], stdout=PIPE, cwd=reporoot)
    stdout, stderr = p.communicate()
    matchingfiles = stdout.split()

    cwd = getcwd()
    chdir(reporoot)
    absmatchinfiles = [abspath(fn) for fn in matchingfiles]
    chdir(cwd)

    for rootrelpath, path in zip(matchingfiles, absmatchinfiles):
        if ignore(rootrelpath):
            continue
        print
        print '{0}:'.format(relpath(path))
        for lineno, line in enumerate(open(join(reporoot, path))):
            line = line.strip()
            if 'TODO:' in line:
                print '  Line {0:>5}: {1}'.format(lineno, line)
{'fraction_non_alphanumeric': 0.12206776715899217, 'fraction_numerical': 0.0034752389226759338, 'mean_word_length': 2.381791483113069, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1349081', 'n_tokens_mistral': 800, 'n_tokens_neox': 761, 'n_words': 197}