Badgerati/Edison

View on GitHub
Edison.Engine/Repositories/ReflectionRepository.cs

Summary

Maintainability
C
1 day
Test Coverage

Class ReflectionRepository has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

    [InjectionInterface(typeof(IReflectionRepository))]
    public class ReflectionRepository : IReflectionRepository
    {

        #region Constants
Severity: Minor
Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 2 hrs to fix

    Method HasValidCategories has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public bool HasValidCategories(MemberInfo member, IList<string> includedCategories, IList<string> excludedCategories, bool testFixtureDefault = true)
            {
                // if no categories are passed, just return true
                if (EnumerableHelper.IsNullOrEmpty(includedCategories) && EnumerableHelper.IsNullOrEmpty(excludedCategories))
                {
    Severity: Minor
    Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 1 hr to fix

      Method GetMethods has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public IEnumerable<MethodInfo> GetMethods<T>(Type type,
                  IList<string> includedCategories = default(List<string>),
                  IList<string> excludedCategories = default(List<string>),
                  IList<string> tests = default(List<string>),
                  string suite = null) where T : Attribute
      Severity: Minor
      Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

                        return testFixtureDefault;
        Severity: Major
        Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return false;
          Severity: Major
          Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return fixtureCategories.Any() && HasValidCategories(fixture, includedCategories, excludedCategories, false);
            Severity: Major
            Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return true;
              Severity: Major
              Found in Edison.Engine/Repositories/ReflectionRepository.cs - About 30 mins to fix

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

                            if (!EnumerableHelper.IsNullOrEmpty(excludedCategories) && categories.Any(c => excludedCategories.Any(e => e.Equals(c.Name, StringComparison.InvariantCultureIgnoreCase))))
                            {
                                return false;
                            }
                Severity: Minor
                Found in Edison.Engine/Repositories/ReflectionRepository.cs and 1 other location - About 40 mins to fix
                Edison.Engine/Repositories/ReflectionRepository.cs on lines 198..201

                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 68.

                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

                            if (!EnumerableHelper.IsNullOrEmpty(includedCategories) && categories.Any(c => includedCategories.Any(i => i.Equals(c.Name, StringComparison.InvariantCultureIgnoreCase))))
                            {
                                return true;
                            }
                Severity: Minor
                Found in Edison.Engine/Repositories/ReflectionRepository.cs and 1 other location - About 40 mins to fix
                Edison.Engine/Repositories/ReflectionRepository.cs on lines 204..207

                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 68.

                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

                        public ExpectedExceptionAttribute GetExpectedException(MethodInfo method)
                        {
                            var exceptionAttribute = method.GetCustomAttributes().OfType<ExpectedExceptionAttribute>();
                
                            return EnumerableHelper.IsNullOrEmpty(exceptionAttribute)
                Severity: Minor
                Found in Edison.Engine/Repositories/ReflectionRepository.cs and 1 other location - About 30 mins to fix
                Edison.Engine/Repositories/ReflectionRepository.cs on lines 272..279

                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 61.

                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

                        public SlackAttribute GetSlackChannel(MethodInfo method)
                        {
                            var slackAttribute = method.GetCustomAttributes().OfType<SlackAttribute>();
                
                            return EnumerableHelper.IsNullOrEmpty(slackAttribute)
                Severity: Minor
                Found in Edison.Engine/Repositories/ReflectionRepository.cs and 1 other location - About 30 mins to fix
                Edison.Engine/Repositories/ReflectionRepository.cs on lines 258..265

                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 61.

                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

                There are no issues that match your filters.

                Category
                Status