enisn/AutoFilterer

View on GitHub

Showing 12 of 17 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    public virtual IQueryable<TEntity> ApplyFilterTo<TEntity>(IQueryable<TEntity> query)
    {
        var parameter = Expression.Parameter(typeof(TEntity), "x");

        var exp = BuildExpression(typeof(TEntity), parameter);
Severity: Major
Found in src/AutoFilterer/Types/FilterBase.cs and 1 other location - About 1 hr to fix
src/AutoFilterer.Dynamics/DynamicFilter.cs on lines 48..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method BuildExpression has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public virtual Expression BuildExpression(Type entityType, Expression body)
    {
        Expression finalExpression = body;
        var _type = this.GetType();
        foreach (var filterProperty in _type.GetProperties())
Severity: Minor
Found in src/AutoFilterer/Types/FilterBase.cs - About 1 hr to fix

    Method BuildExpression has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public Expression BuildExpression(Type entityType, Expression body)
        {
            Expression finalExpression = body;
    
            foreach (var key in this.Keys)
    Severity: Minor
    Found in src/AutoFilterer.Dynamics/DynamicFilter.cs - About 1 hr to fix

      Method BuildExpression has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public virtual Expression BuildExpression(Expression body, PropertyInfo targetProperty, PropertyInfo filterProperty, object value)
          {
              return GetRangeComparison();
      
              BinaryExpression GetRangeComparison()
      Severity: Minor
      Found in src/AutoFilterer/Types/Range.cs - About 1 hr to fix

        Method GetFilterDtoCode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            internal string GetFilterDtoCode(string className, IEnumerable<IPropertySymbol> properties,
                string @namespace = null)
            {
                var start = $@"
        using System;
        Severity: Minor
        Found in src/AutoFilterer.Generators/FilterGenerator.cs - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      case Sorting.Descending:
                          return orderByDescending.MakeGenericMethod(typeof(TSource), property.Type).Invoke(null, parameters: new object[] { source, lambda }) as IOrderedQueryable<TSource>;
          Severity: Minor
          Found in src/AutoFilterer/Types/OrderableBase.cs and 1 other location - About 35 mins to fix
          src/AutoFilterer/Types/OrderableBase.cs on lines 42..43

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      case Sorting.Ascending:
                          return orderBy.MakeGenericMethod(typeof(TSource), property.Type).Invoke(null, parameters: new object[] { source, lambda }) as IOrderedQueryable<TSource>;
          Severity: Minor
          Found in src/AutoFilterer/Types/OrderableBase.cs and 1 other location - About 35 mins to fix
          src/AutoFilterer/Types/OrderableBase.cs on lines 45..46

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 63.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (StartsWith != null)
                      expression = expression.Combine(new StringFilterOptionsAttribute(StringFilterOption.StartsWith) { Comparison = Compare }.BuildExpression(expressionBody, targetProperty, filterProperty, StartsWith), CombineWith);
          Severity: Major
          Found in src/AutoFilterer/Types/StringFilter.cs and 3 other locations - About 30 mins to fix
          src/AutoFilterer/Types/StringFilter.cs on lines 65..66
          src/AutoFilterer/Types/StringFilter.cs on lines 68..69
          src/AutoFilterer/Types/StringFilter.cs on lines 74..75

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (EndsWith != null)
                      expression = expression.Combine(new StringFilterOptionsAttribute(StringFilterOption.EndsWith) { Comparison = Compare }.BuildExpression(expressionBody, targetProperty, filterProperty, EndsWith), CombineWith);
          Severity: Major
          Found in src/AutoFilterer/Types/StringFilter.cs and 3 other locations - About 30 mins to fix
          src/AutoFilterer/Types/StringFilter.cs on lines 65..66
          src/AutoFilterer/Types/StringFilter.cs on lines 68..69
          src/AutoFilterer/Types/StringFilter.cs on lines 71..72

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (Equals != null)
                      expression = expression.Combine(new StringFilterOptionsAttribute(StringFilterOption.Equals) { Comparison = Compare }.BuildExpression(expressionBody, targetProperty, filterProperty, Equals), CombineWith);
          Severity: Major
          Found in src/AutoFilterer/Types/StringFilter.cs and 3 other locations - About 30 mins to fix
          src/AutoFilterer/Types/StringFilter.cs on lines 68..69
          src/AutoFilterer/Types/StringFilter.cs on lines 71..72
          src/AutoFilterer/Types/StringFilter.cs on lines 74..75

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (Contains != null)
                      expression = expression.Combine(new StringFilterOptionsAttribute(StringFilterOption.Contains) { Comparison = Compare }.BuildExpression(expressionBody, targetProperty, filterProperty, Contains), CombineWith);
          Severity: Major
          Found in src/AutoFilterer/Types/StringFilter.cs and 3 other locations - About 30 mins to fix
          src/AutoFilterer/Types/StringFilter.cs on lines 65..66
          src/AutoFilterer/Types/StringFilter.cs on lines 71..72
          src/AutoFilterer/Types/StringFilter.cs on lines 74..75

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this method.
          Open

                      return OperatorComparisonAttribute.Equal.BuildExpression(expressionBody, targetProperty, filterProperty, value);
          Severity: Major
          Found in src/AutoFilterer/Attributes/CompareToAttribute.cs - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language