elishalom / netcodemetrics

Other
33 stars 13 forks source link

Lambda expressions let extension fail #2

Open Meerownymous opened 7 years ago

Meerownymous commented 7 years ago

If a class is using a lambda expression for a function, the analysis fails. The class does not show the complexity numbers near the code.

Example:

    public class SpecProgram : Program
    {
        private readonly Program _program;
        private readonly Dialect _dialect;

        public SpecProgram(Program program) : this(program, new SpecDialect())
        { }

        public SpecProgram(Program program, Dialect dialect)
        {
            _program = program;
            _dialect = dialect;
        }

        public string Key() => _program.Key(); //This leads to failure, removing it makes the analysis work

        public ICollection<Command> Commands()
        {
            return _program.Commands()
                .Select(c => 
                    new SpecCommand(c, _dialect)
                ).ToList<Command>();
        }

        public ICollection<Instruction> Parameters()
        {
            return _program.Parameters();
        }
    }