Commit 49a650fb authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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.
parent 1320da67
#!/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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment