diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2010-08-27 17:10:40 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2010-08-27 17:25:25 +0200 |
commit | 49a650fb2505a5bedbd4d8b688e939de62ba5e45 (patch) | |
tree | 55d9ff6bab8e8d84cbc37bd103fa3bef81a81ebb /scripts/mytasks.pl | |
parent | 1320da6784f1bfdb6c52abc7a0ffd516cf0fbf0d (diff) |
Add a task list generator example
* Add a small script that will generate a tasklist by running
"git diff origin/master" and doing some simple checks on the
newly added line.
I run this script like that in the top level Qt creator
source directory:
while true; do scripts/mytasks.pl > qtcreator.tasks ; sleep 600 ; done
This updates the tasklist every 10min. Qt Creator will detect the change
and reload the list.
Diffstat (limited to 'scripts/mytasks.pl')
-rw-r--r-- | scripts/mytasks.pl | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/mytasks.pl b/scripts/mytasks.pl new file mode 100644 index 00000000000..1cceedb9649 --- /dev/null +++ b/scripts/mytasks.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl + +use strict; + +my $date = `date`; +print "# $date"; + +sub escape { + my $text = shift; + $text =~ s/\\/\\\\/g; + $text =~ s/\n/\\n/g; + $text =~ s/\t/\\t/g; + return $text; +} +sub checkLine { + my $line = shift; + my $file = shift; + my $row = shift; + + $file = escape($file); + $row = escape($row); + + if ($line =~ /(FIXME|TODO)(.*)$/) { + print "$file\t$row\tWARNING\t$1$2\n"; + } + if ($line =~ /(qDebug|QDebug>|QtDebug>|<debug>)/) { + print "$file\t$row\tWARNING\tRemove debug code\n"; + } + if ($line =~ /^(<<<<|====|>>>>)/) { + print "$file\n$row\tERROR\tResolve conflict!\n"; + } + if ($line =~ /(Q_SIGNALS|Q_SLOTS)/) { + print "$file\t$row\tWARNING\tPrefer signals and slots over Q_SIGNALS and Q_SLOTS\n"; + } + if ($line =~ /^#\s*(warning|error) (.*)$/) { + print "$file\t$row\t$1\tClean up preprocessor $1:$2\n"; + } +} + +my $filename = ""; +my $pos = 0; + +open(PIPE, "git diff origin/master|"); +while (<PIPE>) { + chomp; + my $line = $_; + print "#$line\n"; + next if ($line =~ /^-/); + if ($line =~ /^\+\+\+ (.*)$/) { + $filename = $1; + $filename =~ s/^b\///; + $pos = 0; + next; + } + next if $filename =~ /^\/dev\/null$/; + if ($line =~ /^@@ -\d+,\d+\s\+(\d+),\d+ @@$/) { + $pos = $1 - 1; + next; + } + $pos = $pos + 1; + if ($line =~ /^\+(.*)/) { + checkLine($1, $filename, $pos); + } +} +close(PIPE); |