I would have two questions related to cyclomatic complexity:Can I use this metric for a whole app? I guess I cannot, as it would be incredibly large number, considering functions calling functions etc. Is it just for module/method/unit?In Visual Studio, for starting app with just calling the Main method, the cyclomatic complexity value is 2. Why? There is just one possible way if I run the program - it ends.
Why is the cyclomatic complexity equal to two for a simple Hello World?
programming languages;theory;metrics
The cyclomatic complexity of the most basic console application is 2 for a simple reason: aside the Main() method, there is also a constructor. It's like writing:public class Program{    public Program()    {    }    public static void Main()    {    }}The first path is to create a new instance of the Program class. This path is taken by default to launch the application.The second path is to call the static method Program.Main(). This path can be taken if the application is used as an ordinary library by another application.Note that this applies to any non-static class having a static method. For example:public class Hello{    // Even if the constructor was omitted, it will still be added by the compiler.    public static void SayHello()    {    }}will have a cyclomatic complexity of 2 as well.Also note that if you really want to have an application with a cyclomatic complexity of 1, you simply declare Program class as static, as in the following piece of code. I have no idea why the default template in Visual Studio forgets to add both public and static keywords.public static class Program //  See, we replaced a non-static class by a static one{    static void Main(string[] args)    {    }}As for your first question, you don't use cyclomatic complexity as the sole factor. Maintainability index, with its quite tricky formula, is a better metric, but even maintainability index is not something you can fully trust and rely on to say that a piece of code is good or bad.It's not disturbing to have a cyclomatic complexity of a few thousands for a small project, and it doesn't make too much sense to use it for class, assembly or project scope; what would be much more disturbing is to obtain a high cyclomatic complexity for a specific method.