private string GetVariableNameFeedback() { if (string.IsNullOrEmpty(NewName)) { return(string.Empty); } if (_forbiddenNames.Any(name => name.Equals(NewName, StringComparison.OrdinalIgnoreCase))) { return(string.Format(RubberduckUI.AssignedByValDialog_NewNameAlreadyUsedFormat, NewName)); } if (VariableNameValidator.StartsWithDigit(NewName)) { return(RubberduckUI.AssignedByValDialog_DoesNotStartWithLetter); } if (VariableNameValidator.HasSpecialCharacters(NewName)) { return(RubberduckUI.AssignedByValDialog_InvalidCharacters); } if (VariableNameValidator.IsReservedIdentifier(NewName)) { return(string.Format(RubberduckUI.AssignedByValDialog_ReservedKeywordFormat, NewName)); } if (!VariableNameValidator.IsMeaningfulName(NewName)) { return(string.Format(RubberduckUI.AssignedByValDialog_QuestionableEntryFormat, NewName)); } return(string.Empty); }
private string GetVariableNameFeedback() { if (string.IsNullOrEmpty(NewName)) { return(string.Empty); } if (_isConflictingName(NewName)) { return(string.Format(RubberduckUI.AssignedByValDialog_NewNameAlreadyUsedFormat, NewName)); } if (VariableNameValidator.StartsWithDigit(NewName)) { return(RubberduckUI.AssignedByValDialog_DoesNotStartWithLetter); } if (VariableNameValidator.HasSpecialCharacters(NewName)) { return(RubberduckUI.AssignedByValDialog_InvalidCharacters); } if (VariableNameValidator.IsReservedIdentifier(NewName)) { return(string.Format(RubberduckUI.AssignedByValDialog_ReservedKeywordFormat, NewName)); } if (!VariableNameValidator.IsMeaningfulName(NewName)) { return(string.Format(RubberduckUI.AssignedByValDialog_QuestionableEntryFormat, NewName)); } return(string.Empty); }