Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added my own efm_perl.pl, the one that comes with vim is more than 10…

… years old according to its comments
  • Loading branch information...
commit 7129df2cf41edb2d77e45e1d4cdedadc03642523 1 parent 279b334
Alan Young authored March 29, 2012
9  Makefile
@@ -3,13 +3,14 @@ PREFIX?=$(HOME)/.vim
3 3
 FTPLUGIN=$(PREFIX)/ftplugin
4 4
 INDENT=$(PREFIX)/indent
5 5
 SYNTAX=$(PREFIX)/syntax
  6
+TOOLS=$(PREFIX)/tools
6 7
 
7 8
 default:
8 9
 	@echo There is no default target.
9 10
 	@echo Some handle targets: test, install
10 11
 
11 12
 dirs:
12  
-	mkdir -p $(FTPLUGIN) $(INDENT) $(SYNTAX)
  13
+	mkdir -p $(FTPLUGIN) $(INDENT) $(SYNTAX) $(TOOLS)
13 14
 
14 15
 install: dirs
15 16
 	cp ftplugin/perl.vim  $(FTPLUGIN)
@@ -23,6 +24,7 @@ install: dirs
23 24
 	cp syntax/tt2.vim     $(SYNTAX)
24 25
 	cp syntax/tt2html.vim $(SYNTAX)
25 26
 	cp syntax/xs.vim      $(SYNTAX)
  27
+	cp tools/efm_perl.pl  $(TOOLS)
26 28
 
27 29
 symlinks: dirs
28 30
 	ln -sf $(PWD)/ftplugin/perl.vim  $(FTPLUGIN)
@@ -36,8 +38,9 @@ symlinks: dirs
36 38
 	ln -sf $(PWD)/syntax/tt2.vim     $(SYNTAX)
37 39
 	ln -sf $(PWD)/syntax/tt2html.vim $(SYNTAX)
38 40
 	ln -sf $(PWD)/syntax/xs.vim      $(SYNTAX)
  41
+	ln -sf $(PWD)/tools/efm_perl.pl  $(TOOLS)
39 42
 
40  
-tarball: 
  43
+tarball:
41 44
 	tar czvf vim-perl.tar.gz \
42 45
 		ftplugin/perl.vim \
43 46
 		ftplugin/perl6.vim \
@@ -50,6 +53,8 @@ tarball:
50 53
 		syntax/perl6.vim \
51 54
 		syntax/pod.vim \
52 55
 		syntax/xs.vim \
  56
+		\
  57
+		tools/efm_perl.pl \
53 58
 
54 59
 test:
55 60
 	prove -rv t
68  tools/efm_perl.pl
... ...
@@ -0,0 +1,68 @@
  1
+#!/usr/bin/perl
  2
+
  3
+# This is shamelessly ripped from $VIMRUNTIME/tools/efm_perl.pl (which was last
  4
+# updated in 2001 according to the version history--but I'm willing to accept
  5
+# that someone has probably made changes to it since then.) Check that file for
  6
+# details and historical information.
  7
+
  8
+use strict;
  9
+use warnings;
  10
+
  11
+use Cwd;
  12
+use File::Basename;
  13
+
  14
+die "Too many arguments!\n" if @ARGV > 1;
  15
+
  16
+my $file = shift or die "No filename to check!\n";
  17
+my $dir  = dirname( $file ) . '/lib';
  18
+my $cwd  = cwd() . '/lib';
  19
+
  20
+my $error = qr{(.*)\sat\s(.*)\sline\s(\d+)(\.|,\snear\s\".*\"?)};
  21
+
  22
+# Error messages to be skipped.
  23
+my @skip = (
  24
+
  25
+  '"DB::single" used only once: possible typo',
  26
+  'BEGIN failed--compilation aborted',
  27
+
  28
+);
  29
+
  30
+my $skip = join '|', @skip;
  31
+
  32
+# Thanks to
  33
+#
  34
+# http://blogs.perl.org/users/ovid/2011/01/warningsunused-versus-ppi.html for
  35
+# the 'warnings::unused' trick.
  36
+#
  37
+# https://github.com/Ovid/DB--Color.git for the 'circular::require' trick
  38
+
  39
+# Note: Most of the following modules need to be installed, most are not
  40
+# included in core.
  41
+
  42
+my @checks;
  43
+
  44
+push @checks, '-M-circular::require' if `perldoc -l circular::require 2> /dev/null`;
  45
+push @checks, '-M-indirect'          if `perldoc -l indirect 2> /dev/null`;
  46
+push @checks, '-Mwarnings::method'   if `perldoc -l warnings::method 2> /dev/null`;
  47
+push @checks, '-Mwarnings::unused'   if `perldoc -l warnings::unused 2> /dev/null`;
  48
+
  49
+# uninit is not included in 5.10 and later
  50
+push @checks, '-Muninit'             if ( $] < 5.010 ) && `perldoc -l uninit 2> /dev/null`;
  51
+
  52
+my $checks = join ' ', @checks;
  53
+
  54
+my ( $message, $extracted_file, $lineno, $rest );
  55
+
  56
+for my $line ( `perl -I $dir -I $cwd @checks -c $file 2>&1` ) {
  57
+
  58
+  chomp $line;
  59
+  next if $line =~ /$skip/;
  60
+  $line =~ s/([()])/\\$1/g;
  61
+
  62
+  if ( ( $message, $extracted_file, $lineno, $rest ) = $line =~ /^$error$/ ) {
  63
+
  64
+    $message .= $rest if ($rest =~ s/^,//);
  65
+    print "$file:$lineno:$message\n";
  66
+
  67
+  }
  68
+}

0 notes on commit 7129df2

Please sign in to comment.
Something went wrong with that request. Please try again.