Beispiel #1
0
    private static string LintName(lintErrorTypes lType)
    {
        string LintName = "";

        LintAbbr(lType, LintName);
        return(LintName);
    }
Beispiel #2
0
    private static bool CheckNoLint(string tFileName, lintErrorTypes lType = lintErrorTypes.ltUnkn, string vLine = "")
    {
        bool   CheckNoLint = false;
        int    I           = 0;
        string L           = "";
        int    A           = 0;

        string CA = "";
        string cP = "";
        string Cb = "";

        CheckNoLint = false;
        if (LintAbbr(lType) == "")
        {
            CheckNoLint = true; // Disable lint type
            return(CheckNoLint);
        }

        CA = lintTag_NoLint;
        cP = lintTag_NoLint + lintTag_Div;
        Cb = lintTag_NoLint + lintTag_Div + UCase(LintAbbr(lType));

        if (IsInStr(vLine, Mid(CA, 2)) && !IsInStr(vLine, Mid(cP, 2)))
        {
            CheckNoLint = true;
            return(CheckNoLint);
        }
        if (IsInStr(vLine, Mid(Cb, 2)))
        {
            CheckNoLint = true;
            return(CheckNoLint);
        }

        A = LintModuleFirstLine(tFileName);
        for (I = A; I < A + lintTag_ScanRange; I++)
        {
            L = UCase(ReadFile(tFileName, I, 1));
            if (lType == lintErrorTypes.ltUnkn)
            {
                if (LMatch(L, CA) && !LMatch(L, cP))
                {
                    CheckNoLint = true;
                    return(CheckNoLint);
                }
            }
            else
            {
                if (LMatch(L, Cb))
                {
                    CheckNoLint = true;
                    return(CheckNoLint);
                }
            }
        }
        return(CheckNoLint);
    }
private static string AddErrStr(ref string ErrStr, string FileName, string LineNo, string vLine, string Msg, lintErrorTypes lType) {
  string AddErrStr = "";
  Static(ErrCnt(As(Long)));
  if (CheckNoLint(FileName(), lType, vLine)) {
    return AddErrStr;

  }

  if (ErrStr == "") {
    ErrCnt = 0;
  }
  ErrCnt = ErrCnt + 1;
  if (ErrCnt > lintLint_MaxErrors) {
    if (Right(ErrStr, 4) != " >>>") {
      ErrStr = ErrStr + vbCrLf + "<<< Max Error Count Exceeded >>>";
    }
    return AddErrStr;

  }
  if (ErrStr != "") {
    ErrStr = ErrStr + vbCrLf;
  }
  ErrStr = ErrStr + LintFileShort(FileName()) + " (Line " + LineNo + "): " + LintAbbr(lType) + " - " + Msg;
  return AddErrStr;
}
private static string LintAbbr(lintErrorTypes lType, out string TypeName) {
  string LintAbbr = "";
// if this function returns "", the lint type is ignored.  Add the following after the normal lint type to disable:
// : LintAbbr = ""
  switch(lType) {
    case lintErrorTypes.ltLErr:
      LintAbbr = "LErr";
      TypeName = "Lint Runtime Error";
      break;
    case lintErrorTypes.ltIdnt:
      LintAbbr = "Idnt";
      TypeName = "Indent";
      break;
    case lintErrorTypes.ltDECL:
      LintAbbr = "Decl";
      TypeName = "Declaration";
      break;
    case lintErrorTypes.ltDEPR:
      LintAbbr = "Depr";
      TypeName = "Deprecated";
      break;
    case lintErrorTypes.ltSTOP:
      LintAbbr = "STOP";
      TypeName = "Stop Encountered";
      break;//: LintAbbr = IIf(Not LintForBuild, LintAbbr, "")
    case lintErrorTypes.ltWITH:
      LintAbbr = "WITH";
      TypeName = "With Statement";
      break;
    case lintErrorTypes.ltVarN:
      LintAbbr = "VarN";
      TypeName = "Variable Name";
      break;
    case lintErrorTypes.ltArgN:
      LintAbbr = "ArgN";
      TypeName = "Argument Name";
      break;
    case lintErrorTypes.ltFunN:
      LintAbbr = "FunN";
      TypeName = "Function Name";
      break;
    case lintErrorTypes.ltCtlN:
      LintAbbr = "CtlN";
      TypeName = "Control Name";
      break;
    case lintErrorTypes.ltObjN:
      LintAbbr = "ObjN";
      TypeName = "Object Name";
      break;
    case lintErrorTypes.ltSelf:
      LintAbbr = "Self";
      TypeName = "Self Reference";
      break;
    case lintErrorTypes.ltType:
      LintAbbr = "Type";
      TypeName = "Data Type";
      break;
    case lintErrorTypes.ltWhtS:
      LintAbbr = "WhtS";
      TypeName = "White Space";
      break;
    case lintErrorTypes.ltOptn:
      LintAbbr = "Optn";
      TypeName = "Option";
      break;
    case lintErrorTypes.ltBadC:
      LintAbbr = "BadC";
      TypeName = "Bad Code";

      break;//: LintAbbr = IIf(Not LintForBuild, LintAbbr, "")
    case lintErrorTypes.ltNTyp:
      LintAbbr = "NTyp";
      TypeName = "No Type";
      break;
    case lintErrorTypes.ltNOpD:
      LintAbbr = "NOpD";
      TypeName = "No Default For Optional";
      LintAbbr = "";

      break;
    default:
      LintAbbr = "UNKN";
      TypeName = "Unknown";
break;
}
  return LintAbbr;
}