public override IEnumerable <Result> Execute(Release release)
        {
            var res    = new List <Result>();
            var helper = new StageHelper();

            foreach (var obj in release.Objects)
            {
                foreach (var el in obj.ApplicationDefinition.Elements.Where(i => !string.IsNullOrWhiteSpace(i.Type) && i.Type.ToLowerInvariant().Contains("html")))
                {
                    var atts = el.Attributes.Where(i => i.IsInUse).ToList();
                    var max  = GetMaxCount();
                    if (atts.Count <= max)
                    {
                        continue;
                    }
                    var uses = helper.ElementUses(el, obj);
                    if (uses.Count() <= 0)
                    {
                        continue;
                    }
                    res.Add(new Result()
                    {
                        Type            = ResultType.Warning,
                        Parent          = obj.Name,
                        Page            = "Application Modeller",
                        Scope           = "Object",
                        RuleName        = Name,
                        RuleDescription = GetRuleDescription(),
                        Message         = string.Format("Too many attributes are used to identify the element {0}, a total of {1} are in used, and the max allowed is {2}. List attributes {3}. Element is used {4} times in stages {5}"
                                                        , el.Name, atts.Count, max, string.Join(", ", atts.Select(i => i.Name)), uses.Count(), string.Join(",", uses.Select(i => i.Name)))
                    });
                }
            }
            return(res);
        }
Exemplo n.º 2
0
 public override IEnumerable<Result> Execute(Release release)
 {
     var res = new List<Result>();
     var helper = new StageHelper();
     foreach (var obj in release.Objects)
     {
         foreach (var el in obj.ApplicationDefinition.Elements.Where(i => i.Type.ToLowerInvariant().Contains("html")))
         {
             foreach (var at in el.Attributes)
             {
                 if (at.Name.ToLowerInvariant() == "purl" && at.IsInUse)
                 {
                     var uses = helper.ElementUses(el, obj);
                     if (uses.Count() <= 0) continue;
                     res.Add(new Result()
                     {
                         Type = ResultType.Error,
                         Parent = obj.Name,
                         Page = "Application Modeller",
                         Scope = "Object",
                         RuleName = Name,
                         RuleDescription = GetRuleDescription(),
                         Message = string.Format(@"Parent Url is being used for element ""{0}"" the element is being used {1} times in these stages {2}", 
                         el.Name, uses.Count(), string.Join(",", uses.Select(i => i.Name)))
                     });
                 }
             }
         }
     }
     return res;
 }
Exemplo n.º 3
0
        private IEnumerable <object> GetElements(Release release)
        {
            var res    = new List <object>();
            var helper = new StageHelper();

            foreach (var obj in release.Objects)
            {
                foreach (var el in obj.ApplicationDefinition.Elements)
                {
                    var stages = helper.ElementUses(el, obj);
                    foreach (var att in el.Attributes.Where(i => i.IsInUse))
                    {
                        res.Add(new
                        {
                            Object   = obj.Name,
                            Element  = el.Name,
                            Type     = el.Type,
                            Name     = att.Name,
                            DataType = att.DataType,
                            Value    = att.Value,
                            UseCount = stages.Count()
                        });
                    }
                }
            }
            return(res);
        }