diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2012-04-16 18:38:10 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2012-04-17 10:56:59 +0200 |
commit | 8c0316955f6a3d19393e0e00e1ac475c1a782369 (patch) | |
tree | 0286abb02571006b5881e64e2ca105d1cd734d84 /scripts | |
parent | 979d8f4d2bc2ac6699845f5a6766eb5d6e0131b2 (diff) |
Update mytasks to new coding style
Fix some false positives while at it.
Change-Id: I253a2931f866ba192cbc398b784ef851f35ccfb1
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mytasks.pl | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/mytasks.pl b/scripts/mytasks.pl index 1e28a22162..5cf774048c 100644 --- a/scripts/mytasks.pl +++ b/scripts/mytasks.pl @@ -41,20 +41,28 @@ sub checkLine { if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /^ *\t */) { print "$file\t$row\tWARNING\tTabs used to indent.\n"; } - if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /^\s*{$/) { + if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /^\s+{$/) { print "$file\t$row\tWARNING\tOpening bracket found all alone on a line.\n"; } if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /{.*[^\s].*$/) { - if ($line !~ /{\s+\/\*/) + if ($line !~ /\{\s+\/\*/ && $line !~ /^\s*\{ \}$/ && $line !~ /^namespace .* \}$/) { print "$file\t$row\tWARNING\tText found after opening bracket.\n"; } } - if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /[a-zA-Z0-9_]([*&])[^\/]/) { - print "$file\t$row\tWARNING\tUse \"TYPE ${1}NAME\" (currently the space between TYPE and $1 is missing).\n"; + if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /[a-zA-Z0-9_]\*[^\/]/) { + next if $line =~ /SIGNAL\(/; + next if $line =~ /SLOT\(/; + print "$file\t$row\tWARNING\tUse \"TYPE *NAME\" (currently the space between TYPE and * is missing).\n"; } - if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /[*&]\s+/) { - next if ($line =~ /^\s*\*\s+/); + if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /[a-zA-Z0-9_]&[^&]/) { + print "$file\t$row\tWARNING\tUse \"TYPE &NAME\" (currently the space between TYPE and & is missing).\n"; + } + if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /\*\s+/) { + next if ($line =~ /^\s*\*\*?\s+/); next if ($line =~ /\/\*/); - print "$file\t$row\tWARNING\tUse \"TYPE ${1}NAME\" (currently there is a space between $1 and NAME).\n"; + print "$file\t$row\tWARNING\tUse \"TYPE *NAME\" (currently there is a space between * and NAME).\n"; + } + if ($file =~ /(.cpp|.c|.cxx|.h)$/ && $line =~ /[^&]&\s+/) { + print "$file\t$row\tWARNING\tUse \"TYPE &NAME\" (currently there is a space between & and NAME).\n"; } } |