public static void Check(string startBlock, Watchdog wd) { if (startBlock.Contains("enum ")) { var enumName = CamelCaseCSharpWatchdog.GetPossibleBlockIdentifier("enum", startBlock); if (enumName.Length > 2 && char.IsLower(enumName, 0)) { wd.IncreaseCount((int)ErrorCodes.PascalCaseError); // TODO: The line report is inaccurate, as several lines may have passed. // HACK: Assuming the next line and using CheckedLinesOfCode + 1. // if (wd.woff != null) { wd.woff(string.Format("{0}: '{1}' (line {2})", wd.errorCodeStrings[(int)ErrorCodes.PascalCaseError], enumName, wd.checkedLinesThisFile)); } } } return; }
public static void Check(string statement, Watchdog wd) { var possibleIdentifier = CamelCaseCSharpWatchdog.GetPossibleIdentifier(statement); // TODO: Use central reserved words list. // if (possibleIdentifier != "" && possibleIdentifier != "if" && possibleIdentifier != "else" && possibleIdentifier != "while" && possibleIdentifier != "foreach" && possibleIdentifier != "for" && !statement.Contains("using") && possibleIdentifier != "get" && possibleIdentifier != "set" && possibleIdentifier != "try" && possibleIdentifier != "catch" && possibleIdentifier != "delegate" && possibleIdentifier != "public" && possibleIdentifier != "switch") { if (!statement.Contains("const ") && possibleIdentifier.Length > 2 && char.IsUpper(possibleIdentifier, 0)) { wd.IncreaseCount((int)ErrorCodes.CamelCaseError); // TODO: The line report is inaccurate, as several lines may have passed. // HACK: Assuming the next line and using CheckedLinesOfCode + 1. // if (wd.woff != null) { wd.woff(string.Format("{0}: '{1}' (line {2})", wd.errorCodeStrings[(int)ErrorCodes.CamelCaseError], possibleIdentifier, wd.checkedLinesThisFile + 1)); } } } return; }