Permalink
Browse files

Fix up find errors

  • Loading branch information...
holdenk committed Sep 8, 2012
1 parent b6d023b commit 40558280e2edd1c87cfe725c2fb854b2439ba61c
Showing with 20 additions and 10 deletions.
  1. +1 −1 README
  2. +2 −2 Unicorn/Django.pm
  3. +12 −3 Unicorn/Errorcheck.pm
  4. +3 −3 find_errors.pl
  5. +2 −1 targets2.pl
View
2 README
@@ -1,5 +1,5 @@
A very simple github bot. Uses an accout of the same name. It provides spelling corrections for README files and other simple suggestions.
-Requires pfff for the php code fixing to work.
+Requires pfff & php for the php code fixing to work.
See:
https://twitter.com/#!/HoldensUnicorn
https://github.com/holdensmagicalunicorn
View
@@ -31,15 +31,15 @@ sub fix_django_settings {
#We want to grab all of the DATABASE_ lines sitting together
my %shineys;
if ($lines[$j] =~ /DATABASE\_(.*)/) {
- for my ($k = $j; $k < $#lines && $lines[$k] =~ /DATABASE\_(.*?)\s*\=/ ; ++$k) {
+ for (my $k = $j; $k < $#lines && $lines[$k] =~ /DATABASE\_(.*?)\s*\=/; $k) {
if ($lines[$k] =~ /DATABASES\_(.*?)\s*\=\s*(.*)/) {
$lines[$k] = "$1 : $2";
}
}
}
}
- $rt = join($line,'\n');
+ $rt = join(@lines,'\n');
}
}
return $rt;
View
@@ -1,7 +1,8 @@
package Unicorn::Errorcheck;
use strict;
-use php;
-use shell;
+use Unicorn::PHP qw( check_php fix_php);
+use Unicorn::Shell qw( check_shell fix_shell);
+use Unicorn::Django qw( check_django_settings fix_django_settings );
sub check_go {
my $file = shift @_;
@@ -22,7 +23,15 @@ sub fix_cpp {
return $rt;
}
+sub check_py {
+ return check_django_settings(@_);
+}
+
+sub fix_py {
+ return fix_django_settings(@_);
+}
+
use base 'Exporter';
-our @EXPORT = qw{check_php fix_php check_go fix_go check_cpp fix_cpp check_shell fix_shell};
+our @EXPORT = qw{check_php fix_php check_go fix_go check_cpp fix_cpp check_shell fix_shell check_py fix_py};
1;
View
@@ -2,8 +2,8 @@
$| = 1;
use LWP::UserAgent;
use Text::SpellChecker;
-use wordlist qw{check_common};
-use errorcheck qw{check_php check_shell check_py check_go};
+use Unicorn::Wordlist qw{check_common};
+use Unicorn::Errorcheck qw{check_php check_shell check_py check_go};
use File::Temp;
use strict;
@@ -16,7 +16,7 @@
my $res = $ua->get($url);
my $rt = $res->as_string();
my $tempfile = File::Temp->new();
- my $tempfileName = $fh->filename;
+ my $tempfileName = $tempfile->filename;
open (my $out, ">$tempfileName");
print $out $rt;
close ($out);
View
@@ -17,12 +17,13 @@
handle_search("PHP","spliti","(.*?\.php)\$");
handle_search("PHP","ip2long","(.*?\.php)\$");
handle_search("PHP","mysql_db_query","(.*?\.php)\$");
+handle_search("PHP","hash_hmac","(.*?\>php)\$");
#django
handle_search("Python","\"'ENGINE'%3A+'sqlite3'\"","(.*?settings.*?\.py)");
#bash
handle_search("Shell","bash","(.*?\/tree\/.*?\.)");
#go
-handle_search("Go","nil","(.*\.go)");
+#handle_search("Go","nil","(.*\.go)");
my @links;
sub handle_search() {
my $language = shift @_;

0 comments on commit 4055828

Please sign in to comment.