protected override void InternalHandle(Output result, string args, DependencyGraph graph)
        {
            var projctsFiltered = FilterLibs(graph, args);

            IDictionary<Library, int> components;
            graph.StronglyConnectedComponents(out components);

            var circularDependencies = components.Select(c => new { Proj = c.Key, Group = c.Value })
                .GroupBy(c => c.Group)
                .Where(g => g.Count() > 1);

            bool found = false;
            foreach (var g in circularDependencies)
            {
                var libs = g.Select(i => i.Proj)
                    .ToList();

                var projsSet = new HashSet<Library>(libs);

                if (!projsSet.Intersect(projctsFiltered)
                    .Any())
                    continue;

                found = true;

                libs.Sort(Library.NaturalOrdering);

                result.AppendLine("Circular dependency:");
                result.IncreaseIndent();

                foreach (var lib in libs)
                {
                    var proj = lib as Project;
                    if (proj != null)
                        result.AppendLine("{0} (project path: {1})", GetName(proj), proj.ProjectPath);
                    else
                        result.AppendLine(GetName(lib));
                }

                result.DecreaseIndent();
                result.AppendLine();
            }

            if (!found)
                result.AppendLine("No circular dependency found");
        }
        public override List<OutputEntry> Process(DependencyGraph graph)
        {
            var result = new List<OutputEntry>();

            IDictionary<Library, int> components;
            graph.StronglyConnectedComponents(out components);

            var circularDependencies = components.Select(c => new { Proj = c.Key, Group = c.Value })
                .GroupBy(c => c.Group)
                .Where(g => g.Count() > 1);

            foreach (var g in circularDependencies)
            {
                var projs = g.Select(i => i.Proj)
                    .ToList();
                projs.Sort(Library.NaturalOrdering);

                var projsSet = new HashSet<Library>(projs);

                var deps = graph.Edges.Where(e => projsSet.Contains(e.Source) && projsSet.Contains(e.Target));

                var message = new OutputMessage();
                message.Append("Circular dependency found between projects ");

                var first = true;
                foreach (var proj in projs)
                {
                    if (first)
                        first = false;
                    else
                        message.Append(", ");

                    message.Append(proj, OutputMessage.ProjInfo.Name);
                }

                result.Add(new CircularDependencyRuleMatch(Severity, message, this, deps));
            }

            return result;
        }