From 03c5c60a261d3f0f6323b995be40b7973e30cfdf Mon Sep 17 00:00:00 2001 From: Julian Hyde Date: Thu, 5 Jan 2012 23:55:56 +0000 Subject: [PATCH] Enable svn keyword substitution on some more files. git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@484 c6a108a4-781c-0410-a6c6-c2d559e19af0 --- buildOnJdk.bat | 2 +- buildOnJdk.sh | 2 +- checkFile.awk | 45 ++++++++++++++++---- checkFile.sh | 4 +- src/org/olap4j/query/LevelSelectionImpl.java | 4 +- subfloor.xml | 2 +- 6 files changed, 44 insertions(+), 15 deletions(-) diff --git a/buildOnJdk.bat b/buildOnJdk.bat index 31fbfa4..c9dc7b8 100755 --- a/buildOnJdk.bat +++ b/buildOnJdk.bat @@ -1,5 +1,5 @@ @echo off -rem $Id: //open/mondrian/buildOnJdk.bat#2 $ +rem $Id$ rem rem Licensed to Julian Hyde under one or more contributor license rem agreements. See the NOTICE file distributed with this work for diff --git a/buildOnJdk.sh b/buildOnJdk.sh index b0d1e64..5948709 100755 --- a/buildOnJdk.sh +++ b/buildOnJdk.sh @@ -1,5 +1,5 @@ # -# $Id: //open/mondrian/buildOnJdk.sh#2 $ +# $Id$ # # Licensed to Julian Hyde under one or more contributor license # agreements. See the NOTICE file distributed with this work for diff --git a/checkFile.awk b/checkFile.awk index 3ef4112..b2eac0c 100644 --- a/checkFile.awk +++ b/checkFile.awk @@ -33,7 +33,7 @@ function _matchFile(fname) { || fname ~ "/fennel/" \ || fname ~ "/extensions/" \ || fname ~ "/com/sqlstream/" \ - || !lenient; + || strict > 0; } function _isCpp(fname) { return fname ~ /\.(cpp|h)$/; @@ -109,7 +109,7 @@ BEGIN { quot = sprintf("%c", 34); lf = sprintf("%c", 13); pattern = apos "(\\" apos "|[^" apos "])" apos; - if (0) printf "maxLineLength=%s lenient=%s\n", maxLineLength, lenient; + if (0) printf "maxLineLength=%s strict=%s\n", maxLineLength, strict; } FNR == 1 { if (fname) { @@ -229,7 +229,6 @@ FNR == 1 { thisImport = $2; gsub(/;/, "", thisImport); gsub(/\*/, "", thisImport); - importGroup = "zzzzzzzzzzzzzzzzz"; if (thisPackage ~ /^mondrian.*/ && thisImport ~ /^mondrian.*/ \ || thisPackage ~ /^org.olap4j.*/ && thisImport ~ /^org.olap4j.*/) { @@ -257,7 +256,7 @@ FNR == 1 { if (!previousLineWasEmpty) { error(fname, FNR, "Expected blank line between import groups"); } else if (prevImportGroup > importGroup) { - error(fname, FNR, "Import group out of sequence" importGroup prevImportGroup); + error(fname, FNR, "Import group out of sequence (should precede " prevImportGroup ")"); } } else if (prevImport \ && prevImport > thisImport \ @@ -269,6 +268,34 @@ FNR == 1 { prevImport = thisImport; prevImportGroup = importGroup; } +/^\/\/ Copyright .* Julian/ && strict { + if ($0 !~ /-2012/) { + error(fname, FNR, "copyright is not current"); + } +} +/(static|public|private|protected|final|abstract)/ && !/import/ && strict > 1 { + # Order of qualifiers: "public/private/protected static final abstract class ..." + s2 = s; + gsub(/\(.*$/, "", s2); + if (s2 ~ /abstract .*final/) { + error(fname, FNR, "'final' must come before 'abstract'"); + } + if (s2 ~ /final .*static/) { + error(fname, FNR, "'static' must come before 'final'"); + } + if (s2 ~ /abstract .*static/) { + error(fname, FNR, "'static' must come before 'abstract'"); + } + if (s2 ~ /static .*(public|protected|private)/) { + error(fname, FNR, "'public/private/protected' must come before 'static'"); + } + if (s2 ~ /final .*(public|protected|private)/) { + error(fname, FNR, "'public/private/protected' must come before 'final'"); + } + if (s2 ~ /abstract .*(public|protected|private)/) { + error(fname, FNR, "'public/private/protected' must come before 'abstract'"); + } +} /^$/ { if (matchFile && previousLineEndedInOpenBrace) { error(fname, FNR, "Empty line following open brace"); @@ -504,7 +531,7 @@ match(s, /([]A-Za-z0-9() ] *)(+|-|\*|\^|\/|%|=|==|+=|-=|\*=|\/=|>=|<=|!=|&|&&|\| else if (a[2] == "&" && isCpp && s ~ /&[^ ]/) {} # ignore case "foo(&x)" in c++ else if (isCpp && s ~ /\" in c++ - else if (lenient && fname ~ /(fennel)/ && a[1] = ",") {} # not enabled yet + else if (strict < 2 && fname ~ /(fennel)/ && a[1] = ",") {} # not enabled yet else { error(fname, FNR, "operator '" a[2] "' must be followed by space"); } @@ -518,8 +545,8 @@ match(s, /( )(,)/, a) { } match(s, / (+|-|\*|\/|==|>=|<=|!=|<<|<<<|>>|&|&&|\|\||\?|:)$/, a) || \ match(s, /(\.|->)$/, a) { - if (lenient && fname ~ /(aspen)/ && a[1] != ":") {} # not enabled yet - else if (lenient && fname ~ /(fennel|farrago|aspen)/ && a[1] = "+") {} # not enabled yet + if (strict < 2 && fname ~ /(aspen)/ && a[1] != ":") {} # not enabled yet + else if (strict < 2 && fname ~ /(fennel|farrago|aspen)/ && a[1] = "+") {} # not enabled yet else if (a[1] == ":" && s ~ /(case.*|default):$/) { # ignore e.g. "case 5:" } else if ((a[1] == "*" || a[1] == "&") && isCpp && s ~ /^[[:alnum:]:_ ]* [*&]$/) { @@ -623,7 +650,7 @@ s ~ /{/ { gsub(/[^(]/, "", opens); closes = s; gsub(/[^)]/, "", closes); - if (0 && lenient && fname ~ /aspen/) {} # not enabled + if (0 && strict < 2 && fname ~ /aspen/) {} # not enabled else if (length(closes) > length(opens)) { error(fname, FNR, "Open brace should be on new line (function call/decl spans several lines)"); } @@ -694,7 +721,7 @@ length($0) > maxLineLength \ if (funDeclStartLine < FNR \ && $0 !~ /^ *{$/) { - if (lenient && fname ~ /aspen/) {} # not enabled + if (strict < 2 && fname ~ /aspen/) {} # not enabled else error(fname, FNR, "Open brace should be on new line (function decl spans several lines)"); } funDeclStartLine = 0; diff --git a/checkFile.sh b/checkFile.sh index 35b4fa5..8e256f4 100755 --- a/checkFile.sh +++ b/checkFile.sh @@ -1,5 +1,5 @@ #!/bin/bash -# $Id: //open/mondrian-release/3.2/bin/checkFile.sh#2 $ +# $Id$ # # Licensed to Julian Hyde under one or more contributor license # agreements. See the NOTICE file distributed with this work for @@ -44,6 +44,8 @@ usage() { echo "--lenient" echo " Does not apply rules to components which are not known to" echo " be in compliance. The perforce trigger uses this option." + echo "--strict" + echo " Stricter than usual; the opposite of lenient." } doCheck() { diff --git a/src/org/olap4j/query/LevelSelectionImpl.java b/src/org/olap4j/query/LevelSelectionImpl.java index b01a42f..70e9be6 100644 --- a/src/org/olap4j/query/LevelSelectionImpl.java +++ b/src/org/olap4j/query/LevelSelectionImpl.java @@ -1,5 +1,5 @@ /* -// $Id: LevelSelectionImpl.java 399 2011-02-03 20:53:50Z pstoellberger $ +// $Id$ // // Licensed to Julian Hyde under one or more contributor license // agreements. See the NOTICE file distributed with this work for @@ -28,7 +28,7 @@ * Abstract implementation of {@link Selection}. * * @author pstoellberger - * @version $Id: LevelSelectionImpl.java 454 2011-05-15 20:53:50Z pstoellberger $ + * @version $Id$ * @since Feb 3, 2011 */ class LevelSelectionImpl extends AbstractSelection { diff --git a/subfloor.xml b/subfloor.xml index 405d038..e681f6a 100644 --- a/subfloor.xml +++ b/subfloor.xml @@ -1,6 +1,6 @@