equal
deleted
inserted
replaced
82 { |
82 { |
83 chomp $line; |
83 chomp $line; |
84 next unless $line; |
84 next unless $line; |
85 my @terms = split m{\t+}, $line; |
85 my @terms = split m{\t+}, $line; |
86 die "Rules file not formatted as expected at line $.\n" unless scalar @terms == 2; |
86 die "Rules file not formatted as expected at line $.\n" unless scalar @terms == 2; |
87 push @rules, { regexp => $terms[0], severity => $terms[1] }; |
87 push @rules, { regexp => qr{$terms[0]}, severity => $terms[1] }; |
88 } |
88 } |
89 |
89 |
90 # Iterate through all the lines of all the files in @ARGV |
90 # Iterate through all the lines of all the files in @ARGV |
91 while (my $line = <>) |
91 while (my $line = <>) |
92 { |
92 { |
93 chomp $line; |
93 chomp $line; |
94 foreach my $rule (@rules) |
94 foreach my $rule (@rules) |
95 { |
95 { |
96 if ($line =~ m[$rule->{regexp}]) |
96 if ($line =~ m[$rule->{regexp}]) |
97 { |
97 { |
|
98 last if $rule->{severity} eq "ignore"; |
98 # We found a match |
99 # We found a match |
99 my $failure = bless{ Kids => [ bless { Text => $line }, "Characters" ] }, "failure"; |
100 my $failure = bless{ Kids => [ bless { Text => $line }, "Characters" ] }, "failure"; |
100 # Ensure we have a <failures> tag for this severity |
101 # Ensure we have a <failures> tag for this severity |
101 if (!exists $severityShortcut->{$rule->{severity}}) |
102 if (!exists $severityShortcut->{$rule->{severity}}) |
102 { |
103 { |