Anonymous avatar Anonymous committed 413b9cd

add check for $Id$; various fixes

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12810 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

Comments (0)

Files changed (1)

 # - presence of a LF character at the end of the file (missing-lf)
 # - maximum line length of 80 characters (long-line)
 # - presence of a copyright header (missing-header)
+# - absence of a leftover "$Id$" string (svn-keyword)
 
 # Exceptions are handled with a SVN property: "ocaml:typo".
 # Its value for a given file is a comma-separated list of rule names,
 #   from the "tabs" rule.
 # - Any file whose name matches one of the following patterns is
 #   automatically exempt from the "missing-header" rule.
-#     */.depend
+#     */.depend*
 #     */.ignore
 #     *.mlpack
 #     *.mllib
+#     *.mltop
 #     *.odocl
 #     *.clib
 #     */unmaintained/*
     esac
     h(){ rules="missing-header,$rules"; }
     case "$f" in
-      */.depend|*/.ignore) h;;
-      *.mlpack|*.mllib|*.odocl|*.itarget|*.clib) h;;
+      */.depend*|*/.ignore) h;;
+      *.mlpack|*.mllib|*.mltop|*.odocl|*.itarget|*.clib) h;;
       */unmaintained/*|*/experimental/*) h;;
       *.reference) h;;
     esac
       '
         function err(name, msg) {
           ++ counts[name];
-          if (!index(("," rules svnrules ","), ("," name ",")) \
+          if (("," rules svnrules ",") !~ ("[, ]" name "[, ]") \
               && counts[name] <= 10){
             printf ("%s:%d.%d:", file, NR, RSTART + RLENGTH);
             printf (" [%s] %s\n", name, msg);
           err("white-at-eol", "whitespace at end of line");
         }
 
+        match($0, /\$Id\$/) {
+          err("svn-keyword", "SVN keyword marker");
+        }
+
         length($0) > 80 {
           RSTART = 81;
           RLENGTH = 0;
           err("long-line", "line is over 80 characters");
         }
 
-        3 <= NR && NR <= 8 \
+        3 <= NR && NR <= 5 \
         && (/ OCaml / || / ocamlbuild / || / OCamldoc /) {
-          header_ocaml = 1;
+          header_ocaml = NR;
         }
 
-        7 <= NR && NR <= 12 && / Copyright / && header_ocaml {
+        header_ocaml && header_ocaml + 4 <= NR && NR <= header_ocaml + 6 \
+        && / Copyright / {
           header_copyright = 1;
         }
 
           if (!(header_ocaml && header_copyright)){
             err("missing-header", "missing copyright header");
           }
-          split(svnrules, r, ",");
+          split(svnrules, r, "[, ]");
           for (i in r){
             name = r[i];
             if (name != "" && !counts[name]){
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.