protected override IEnumerable <IInspectionResult> DoGetInspectionResults() { var excel = State.DeclarationFinder.Projects.SingleOrDefault(item => !item.IsUserDefined && item.IdentifierName == "Excel"); if (excel == null) { return(Enumerable.Empty <IInspectionResult>()); } var candidates = UserDeclarations.OfType <FunctionDeclaration>().Where(decl => decl.ParentScopeDeclaration.DeclarationType == DeclarationType.ProceduralModule && VisibleAsUdf.Contains(decl.Accessibility)); return((from function in candidates.Where(decl => ValidCellIdRegex.IsMatch(decl.IdentifierName)) let row = Convert.ToUInt32(ValidCellIdRegex.Matches(function.IdentifierName)[0].Groups["Row"].Value) where row > 0 && row <= MaximumExcelRows && !IsIgnoringInspectionResultFor(function, AnnotationName) select new DeclarationInspectionResult(this, string.Format(InspectionResults.ExcelUdfNameIsValidCellReferenceInspection, function.IdentifierName), function)) .Cast <IInspectionResult>().ToList()); }