Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (44 sloc) 1.314 kB
c5f98b5 @holdenk Initial collection of shaaady perl scripts to do the spelling correct…
authored
1 #!/usr/bin/perl
2 $| = 1;
3 use LWP::UserAgent;
4 use Text::SpellChecker;
4055828 @holdenk Fix up find errors
authored
5 use Unicorn::Wordlist qw{check_common};
6 use Unicorn::Errorcheck qw{check_php check_shell check_py check_go};
b6d023b @holdenk Start updating the main code
authored
7 use File::Temp;
54014b5 @holdenk Update errorcheck
authored
8 use strict;
c5f98b5 @holdenk Initial collection of shaaady perl scripts to do the spelling correct…
authored
9
54014b5 @holdenk Update errorcheck
authored
10 # Checks for spelling errors
c5f98b5 @holdenk Initial collection of shaaady perl scripts to do the spelling correct…
authored
11 my $ua = new LWP::UserAgent;
12 while (<>) {
54014b5 @holdenk Update errorcheck
authored
13 my $filepath = $_;
180cc37 @holdenk fix code
authored
14 chomp ($filepath);
15 $filepath =~ s/^\///;
054cd8c @holdenk More shiny
authored
16 my $url = "https://raw.github.com/".$filepath;
180cc37 @holdenk fix code
authored
17 $url =~ s/\/tree\/(.*?)\//\/master\//;
c5f98b5 @holdenk Initial collection of shaaady perl scripts to do the spelling correct…
authored
18 my $res = $ua->get($url);
180cc37 @holdenk fix code
authored
19 my $rt = $res->decoded_content;
b6d023b @holdenk Start updating the main code
authored
20 my $tempfile = File::Temp->new();
4055828 @holdenk Fix up find errors
authored
21 my $tempfileName = $tempfile->filename;
b6d023b @holdenk Start updating the main code
authored
22 open (my $out, ">$tempfileName");
23 print $out $rt;
24 close ($out);
180cc37 @holdenk fix code
authored
25 #Skip tests
26 if ($filepath =~ /obsolete/i) {
27 print "skipping $filepath\n";
28 next;
29 }
b6d023b @holdenk Start updating the main code
authored
30 if ($filepath =~ /\/README.(txt|m|p).*?/i && check_common($tempfileName, $rt)) {
180cc37 @holdenk fix code
authored
31 print "spelling: ".$url."\n";
54014b5 @holdenk Update errorcheck
authored
32 }
b6d023b @holdenk Start updating the main code
authored
33 if ($filepath =~ /\.php/i && check_php($tempfileName, $rt)) {
180cc37 @holdenk fix code
authored
34 print "php: ".$url."\n";
54014b5 @holdenk Update errorcheck
authored
35 }
b6d023b @holdenk Start updating the main code
authored
36 if ($rt =~ /\#\!\/bin\/.*?sh/i && check_shell($tempfileName, $rt)) {
180cc37 @holdenk fix code
authored
37 print "shell ".$url."\n";
54014b5 @holdenk Update errorcheck
authored
38 }
b6d023b @holdenk Start updating the main code
authored
39 if ($filepath =~ /\.py/i && check_py($tempfileName, $rt)) {
180cc37 @holdenk fix code
authored
40 print "py ".$url."\n";
54014b5 @holdenk Update errorcheck
authored
41 }
b6d023b @holdenk Start updating the main code
authored
42 if ($filepath =~ /\.go/i && check_go($tempfileName, $rt)) {
180cc37 @holdenk fix code
authored
43 print "go ".$url."\n;"
c5f98b5 @holdenk Initial collection of shaaady perl scripts to do the spelling correct…
authored
44 }
45 }
Something went wrong with that request. Please try again.