Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:htrgouvea/zarn into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
htrgouvea committed Jan 4, 2025
2 parents c09fb12 + 76767b1 commit 363d846
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
25 changes: 24 additions & 1 deletion lib/Zarn/Engine/Source_to_Sink.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,32 @@ package Zarn::Engine::Source_to_Sink {
'rules=s' => \$rules
);


if ($ast && $rules) {
my @absence = grep { $_->{type} && $_->{type} eq 'absence' } $rules->@*;
for my $rule (@absence) {
my $category = $rule -> {category};
my $title = $rule -> {name};
my $message = $rule -> {message};
foreach my $token ($rule -> {sample} -> @*) {
if ($ast->content() !~ m/$token/xms ) {
push @results, {
category => $category,
title => $title,
message => $message,
line_sink => 'n/a',
rowchar_sink => 'n/a',
line_source => 'n/a',
rowchar_source => 'n/a'
};
}
}
}

my @presence = grep { !($_->{type}) || $_->{type} eq 'presence' } $rules->@*;

foreach my $token (@{$ast -> find('PPI::Token') || []}) {
foreach my $rule (@{$rules}) {
foreach my $rule (@presence) {
my @sample = $rule -> {sample} -> @*;
my $category = $rule -> {category};
my $title = $rule -> {name};
Expand Down
2 changes: 1 addition & 1 deletion lib/Zarn/Helper/Rules.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ package Zarn::Helper::Rules {
}
}

1;
1;
4 changes: 2 additions & 2 deletions zarn.pl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sub main {
);

if (@analysis) {
$analysis[0]->{'file'} = $file;
map { $_->{file} = $file } @analysis;
}

push @results, @analysis;
Expand Down Expand Up @@ -87,4 +87,4 @@ sub main {
return 0;
}

main();
main();

0 comments on commit 363d846

Please sign in to comment.