CaffGeek/MBACNationals

View on GitHub
Aggregates/Participant/ParticipantCommandHandlers.cs

Summary

Maintainability
F
3 days
Test Coverage

Method Handle has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, UpdateParticipant command)
        {
            var agg = al(command.Id);

            if (agg.Name != command.Name)
Severity: Major
Found in Aggregates/Participant/ParticipantCommandHandlers.cs - About 4 hrs to fix

    File ParticipantCommandHandlers.cs has 338 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using Edument.CQRS;
    using Events.Participant;
    using MBACNationals.Participant.Commands;
    using MBACNationals.ReadModels;
    using System;
    Severity: Minor
    Found in Aggregates/Participant/ParticipantCommandHandlers.cs - About 4 hrs to fix

      Method Handle has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, CreateParticipant command)
              {
                  var agg = al(command.Id);
      
                  if (agg.EventsLoaded > 0)
      Severity: Minor
      Found in Aggregates/Participant/ParticipantCommandHandlers.cs - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    if (agg.Package == null
                        || agg.Package.ManitobaDinner != command.Package.ManitobaDinner
                        || agg.Package.ManitobaDance != command.Package.ManitobaDance
                        || agg.Package.FinalBanquet != command.Package.FinalBanquet
                        || agg.Package.Transportation != command.Package.Transportation
        Severity: Critical
        Found in Aggregates/Participant/ParticipantCommandHandlers.cs - About 1 hr to fix

          Method Handle has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
          Open

                  public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, UpdateParticipant command)
                  {
                      var agg = al(command.Id);
          
                      if (agg.Name != command.Name)
          Severity: Minor
          Found in Aggregates/Participant/ParticipantCommandHandlers.cs - About 1 hr to fix

          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 Handle has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, UpdateParticipantProfile command)
                  {
                      var agg = al(command.Id);
          
                      yield return new ParticipantProfileChanged
          Severity: Minor
          Found in Aggregates/Participant/ParticipantCommandHandlers.cs - About 1 hr to fix

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

                        if (agg.Gender != command.Gender)
                        {
                            yield return new ParticipantGenderReassigned
                            {
                                Id = command.Id,
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 1 other location - About 2 hrs to fix
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 145..155

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

            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 (agg.YearsQualifying != command.YearsQualifying)
                        {
                            yield return new ParticipantYearsQualifyingChanged
                            {
                                Id = command.Id,
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 1 other location - About 2 hrs to fix
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 101..111

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

            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

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

                        if (agg.Name != command.Name)
                        {
                            yield return new ParticipantRenamed
                            {
                                Id = command.Id,
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 1 other location - About 1 hr to fix
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 89..99

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

            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

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

                        if (agg.Name != command.Name)
                        {
                            yield return new ParticipantRenamed
                            {
                                Id = command.Id,
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 1 other location - About 1 hr to fix
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 230..240

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

            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

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

                            yield return new ParticipantGuestPackageChanged
                            {
                                Id = command.Id,
                                ManitobaDinner = command.Package.ManitobaDinner,
                                ManitobaDance = command.Package.ManitobaDance,
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 1 other location - About 1 hr to fix
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 71..82

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

            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

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

                            yield return new ParticipantGuestPackageChanged
                            {
                                Id = command.Id,
                                ManitobaDinner = command.Package.ManitobaDinner,
                                ManitobaDance = command.Package.ManitobaDance,
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 1 other location - About 1 hr to fix
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 199..210

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

            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

                    public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, AssignAlternateToTeam command)
                    {
                        var agg = al(command.Id);
            
                        yield return new ParticipantDesignatedAsAlternate
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 3 other locations - About 35 mins to fix
            Aggregates/Contingent/ContingentCommandHandlers.cs on lines 84..94
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 382..392
            Aggregates/Tournament/TournamentCommandHandlers.cs on lines 77..87

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

            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

                    public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, ReorderParticipant command)
                    {
                        var agg = al(command.Id);
            
                        yield return new ParticipantQualifyingPositionChanged
            Severity: Major
            Found in Aggregates/Participant/ParticipantCommandHandlers.cs and 3 other locations - About 35 mins to fix
            Aggregates/Contingent/ContingentCommandHandlers.cs on lines 84..94
            Aggregates/Participant/ParticipantCommandHandlers.cs on lines 265..275
            Aggregates/Tournament/TournamentCommandHandlers.cs on lines 77..87

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

            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