Permalink
Browse files

Start updating the main code

  • Loading branch information...
1 parent 501d725 commit b6d023b9db5a896fd4c4f2642a50b108c09bc732 @holdenk committed Sep 8, 2012
Showing with 15 additions and 10 deletions.
  1. +11 −6 find_errors.pl
  2. +4 −4 fix_pandas.pl
View
@@ -4,6 +4,7 @@
use Text::SpellChecker;
use wordlist qw{check_common};
use errorcheck qw{check_php check_shell check_py check_go};
+use File::Temp;
use strict;
# Checks for spelling errors
@@ -14,21 +15,25 @@
$url =~ s/tree/raw/;
my $res = $ua->get($url);
my $rt = $res->as_string();
- $rt." githuub";
+ my $tempfile = File::Temp->new();
+ my $tempfileName = $fh->filename;
+ open (my $out, ">$tempfileName");
+ print $out $rt;
+ close ($out);
#Handle spelling mistakes
- if ($filepath =~ /\/README.(txt|m|p).*?/i && check_common($rt)) {
+ if ($filepath =~ /\/README.(txt|m|p).*?/i && check_common($tempfileName, $rt)) {
print "spelling: ".$url;
}
- if ($filepath =~ /\.php/i && check_php($rt)) {
+ if ($filepath =~ /\.php/i && check_php($tempfileName, $rt)) {
print "php: ".$url;
}
- if ($rt =~ /\#\!\/bin\/.*?sh/i && check_shell($rt)) {
+ if ($rt =~ /\#\!\/bin\/.*?sh/i && check_shell($tempfileName, $rt)) {
print "shell ".$url;
}
- if ($filepath =~ /\.py/i && check_py($rt)) {
+ if ($filepath =~ /\.py/i && check_py($tempfileName, $rt)) {
print "py ".$url;
}
- if ($filepath =~ /\.go/i && check_go($rt)) {
+ if ($filepath =~ /\.go/i && check_go($tempfileName, $rt)) {
print "go ".$url;
}
}
View
@@ -6,9 +6,9 @@
use Data::Dumper;
use strict;
-use wordlist qw{fix_text check_common};
-use errorcheck qw{check_php fix_php check_py fix_py check_go fix_go check_cpp fix_cpp check_shell fix_shell};
-use blacklist qw{ ok_to_update };
+use Unicorn::Wordlist qw{fix_text check_common};
+use Unicorn::Errorcheck qw{check_php fix_php check_py fix_py check_go fix_go check_cpp fix_cpp check_shell fix_shell};
+use Unicorn::Blacklist qw{ ok_to_update };
my $p = Pithub->new;
@@ -166,7 +166,7 @@ sub handle_group {
my $t = do { local $/ = <$in> };
close($in);
#Is there a spelling mistake?
- if ($gate_function->($t)) {
+ if ($gate_function->($file, $t)) {
open (my $out, ">", "$file") or die "Unable to open $file";
print $out $fix_function->($file, $t);
close ($out);

0 comments on commit b6d023b

Please sign in to comment.