-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* return feature to remove blank lines and comments * add samples to perform tests * pushing some tools to help during debug tasks * skip false positives - draft function * improve taint analysis function * drafting new rules * update sarif output with new variables * apply design pattern practices to a better code compreension * remove Data::Dumper * fixed sarif * remove unecessary variables * remove old file * remove samples * create some unit tests * update rules on linter * resolv linter warnings * resolv linter warnings * new module * remove tools/ * tdy * update perltidyrc * new line * deleted tests/Sarif.t * remove blank lines * checking if the name of file that does exists --------- Co-authored-by: Heitor <[email protected]>
- Loading branch information
Showing
15 changed files
with
181 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
severity = 3 | ||
severity = 1 | ||
|
||
[-TestingAndDebugging::RequireUseStrict] | ||
[-TestingAndDebugging::RequireUseWarnings] | ||
[-TestingAndDebugging::RequireUseWarnings] | ||
[-CodeLayout::RequireTidyCode] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use File::Temp qw(tempdir); | ||
use File::Path qw(make_path); | ||
use File::Spec; | ||
use File::Basename; | ||
use File::Find; | ||
use File::Slurp; | ||
use Zarn::Helper::Files; | ||
|
||
my $temp_dir = tempdir(CLEANUP => 1); | ||
|
||
my @dirs = ( | ||
File::Spec->catdir($temp_dir, 'dir1'), | ||
File::Spec->catdir($temp_dir, 'dir2', '.git'), | ||
); | ||
|
||
my @files = ( | ||
File::Spec->catfile($temp_dir, 'dir1', 'file1.pm'), | ||
File::Spec->catfile($temp_dir, 'dir1', 'file2.t'), | ||
File::Spec->catfile($temp_dir, 'dir1', 'file3.pl'), | ||
File::Spec->catfile($temp_dir, 'dir2', 'file4.pm'), | ||
File::Spec->catfile($temp_dir, 'dir2', 'file5.txt'), | ||
File::Spec->catfile($temp_dir, 'dir2', '.git', 'file6.pm'), | ||
); | ||
|
||
foreach my $dir (@dirs) { | ||
make_path($dir); | ||
} | ||
|
||
foreach my $file (@files) { | ||
write_file($file, "use strict;\n"); | ||
} | ||
|
||
my @expected_files = ( | ||
File::Spec->catfile($temp_dir, 'dir1', 'file1.pm'), | ||
File::Spec->catfile($temp_dir, 'dir1', 'file2.t'), | ||
File::Spec->catfile($temp_dir, 'dir1', 'file3.pl'), | ||
File::Spec->catfile($temp_dir, 'dir2', 'file4.pm'), | ||
); | ||
|
||
my @found_files = Zarn::Helper::Files->new($temp_dir, '.git'); | ||
@found_files = sort @found_files; | ||
@expected_files = sort @expected_files; | ||
|
||
is_deeply(\@found_files, \@expected_files, 'Perl files correctly found in the source directory'); | ||
|
||
my $no_source = Zarn::Helper::Files->new(); | ||
is($no_source, 0, 'Returns 0 when no source directory is provided'); | ||
|
||
done_testing(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use Zarn::Helper::Rules; | ||
use File::Temp qw(tempfile); | ||
|
||
my $yaml_content = <<'END_YAML'; | ||
--- | ||
rules: | ||
- rule1 | ||
- rule2 | ||
- rule3 | ||
END_YAML | ||
|
||
|
||
my ($fh, $filename) = tempfile(); | ||
print $fh $yaml_content; | ||
close $fh; | ||
|
||
my @expected_rules = ('rule1', 'rule2', 'rule3'); | ||
my @rules = Zarn::Helper::Rules->new($filename); | ||
|
||
my @flattened_rules = map { @$_ } @rules; | ||
is_deeply(\@flattened_rules, \@expected_rules, 'Rules correctly loaded from YAML file'); | ||
|
||
my $no_rules = Zarn::Helper::Rules->new(); | ||
is($no_rules, 0, 'Returns 0 when no rules file is provided'); | ||
|
||
done_testing(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.