Beispiel #1
0
        static bool AreAnyFiltersDefined(TrunkBotConfiguration.PlasticSCM botConfig)
        {
            if (botConfig.IsApprovedCodeReviewFilterEnabled)
            {
                return(true);
            }

            if (string.IsNullOrWhiteSpace(botConfig.StatusAttribute.Name))
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(botConfig.StatusAttribute.ResolvedValue))
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        public static bool CheckValidPlasticFields(
            TrunkBotConfiguration.PlasticSCM botConfig,
            out string errorMessage)
        {
            errorMessage = string.Empty;

            string fieldNameBeingChecked = "Branch lifecycle and automatic labels";

            if (botConfig == null)
            {
                errorMessage = BuildFieldError(fieldNameBeingChecked);
                return(false);
            }

            if (!AreAnyFiltersDefined(botConfig))
            {
                errorMessage = BuildNoFiltersEnabledErrorMessage(fieldNameBeingChecked);
                return(false);
            }

            string propertyErrorMessage = null;

            if (!CheckValidStatusPropertyFieldsForPlasticAttr(
                    botConfig.IsApprovedCodeReviewFilterEnabled,
                    botConfig.StatusAttribute,
                    "of the status attribute for Plastic config",
                    out propertyErrorMessage))
            {
                errorMessage += propertyErrorMessage;
            }

            string labelPropertiesErrorMessage = null;

            if (!CheckValidAutomaticLabelFields(
                    botConfig.IsAutoLabelEnabled, botConfig.AutomaticLabelPattern,
                    out labelPropertiesErrorMessage))
            {
                errorMessage += labelPropertiesErrorMessage;
            }

            return(string.IsNullOrEmpty(errorMessage));
        }