File: check-return.pl

package info (click to toggle)
xmlsec1 1.3.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,916 kB
  • sloc: ansic: 100,493; xml: 19,156; sh: 8,079; makefile: 1,186; javascript: 438; perl: 199
file content (23 lines) | stat: -rw-r--r-- 676 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/perl
#
# Usage:
#  egrep -r -A8 -n 'xmlSec.*Error[0-9]?\(' ./src/ | sed 's/ //g' | perl ./scripts/check-return.pl
# 

my $has_return = 0;
my $where = "";
foreach my $line ( <STDIN> ) {
    chomp( $line );
    if($line eq "--" || $line eq '}' || $line eq 'continue' || $line eq 'break') {
        if(not $has_return) {
            print("FOUND MISSING RETURN: $where\n");
        }    
        $has_return = 0;
        $where = "";
    } elsif($line =~ /.*Error.*/ && $where eq "") {
        # print("Found error: $line\n");
        $where = $line
    } elsif($line =~ /.*goto.*/ || $line =~ /.*return.*/ || $line =~ /.*ignoreerror.*/) {
        $has_return = 1;
    }
}