morrisjdev/FileContextCore

View on GitHub
FileContextCore/Query/Internal/FileContextProjectionBindingExpressionVisitor.cs

Summary

Maintainability
A
0 mins
Test Coverage

Method Visit has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
Wontfix

        public override Expression Visit(Expression expression)
        {
            if (expression == null)
            {
                return null;

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method Visit has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

        public override Expression Visit(Expression expression)
        {
            if (expression == null)
            {
                return null;

    File FileContextProjectionBindingExpressionVisitor.cs has 265 lines of code (exceeds 250 allowed). Consider refactoring.
    Wontfix

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Linq.Expressions;
    using Microsoft.EntityFrameworkCore.Diagnostics;

      Method VisitExtension has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

              protected override Expression VisitExtension(Expression extensionExpression)
              {
                  if (extensionExpression is EntityShaperExpression entityShaperExpression)
                  {
                      EntityProjectionExpression entityProjectionExpression;

        Method VisitNew has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

                protected override Expression VisitNew(NewExpression newExpression)
                {
                    if (newExpression.Arguments.Count == 0)
                    {
                        return newExpression;

          Avoid deeply nested control flow statements.
          Wontfix

                                          if (subquery.ResultCardinality == ResultCardinality.Enumerable)
                                          {
                                              return AddCollectionProjection(subquery, null, subquery.ShaperExpression.Type);
                                          }

            Avoid too many return statements within this method.
            Wontfix

                                return new ProjectionBindingExpression(_queryExpression, _projectionMembers.Peek(), expression.Type);

              Avoid too many return statements within this method.
              Wontfix

                                      return base.Visit(expression);

                Avoid too many return statements within this method.
                Wontfix

                                        return null;

                  Avoid too many return statements within this method.
                  Wontfix

                              return base.Visit(expression);

                    Avoid too many return statements within this method.
                    Wontfix

                                        return new ProjectionBindingExpression(_queryExpression, _queryExpression.AddToProjection(translation), expression.Type);

                      Avoid too many return statements within this method.
                      Wontfix

                                                      return new SingleResultShaperExpression(
                                                          new ProjectionBindingExpression(
                                                              _queryExpression,
                                                              _queryExpression.AddSubqueryProjection(subquery, out var innerShaper),
                                                              typeof(ValueBuffer)),

                        There are no issues that match your filters.

                        Category
                        Status