CaffGeek/MBACNationals

View on GitHub
ReadModels/TournamentQueries.cs

Summary

Maintainability
D
1 day
Test Coverage

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

using Edument.CQRS;
using Events.Tournament;
using System;
using System.Collections.Generic;
using System.Linq;
Severity: Minor
Found in ReadModels/TournamentQueries.cs - About 4 hrs to fix

    Class TournamentQueries has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public class TournamentQueries : BaseReadModel<TournamentQueries>,
            IReadModel,
            ITournamentQueries,
            ISubscribeTo<TournamentCreated>,
            ISubscribeTo<ChangeNotificationCutoffChanged>,
    Severity: Minor
    Found in ReadModels/TournamentQueries.cs - About 3 hrs to fix

      Method GetGuestPackages has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public List<GuestPackage> GetGuestPackages(string year)
              {
                  var tournament = Tournaments.Single(x => x.Year == year);
                  var guestPackages = GuestPackages.Where(x => x.TournamentId == tournament.Id).ToList();
      
      Severity: Minor
      Found in ReadModels/TournamentQueries.cs - About 1 hr to fix

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

                public List<News> GetNews(string year)
                {
                    var tournament = Tournaments.Single(x => x.Year == year);
                    var news = NewsArticles.Where(x => x.TournamentId == tournament.Id).ToList();
                    return news;
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 2 other locations - About 55 mins to fix
        ReadModels/TournamentQueries.cs on lines 149..154
        ReadModels/TournamentQueries.cs on lines 214..219

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

        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 3 locations. Consider refactoring.
        Open

                public List<Hotel> GetHotels(string year)
                {
                    var tournament = Tournaments.Single(x => x.Year == year);
                    var hotels = Hotels.Where(x => x.TournamentId == tournament.Id).ToList();
                    return hotels;
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 2 other locations - About 55 mins to fix
        ReadModels/TournamentQueries.cs on lines 142..147
        ReadModels/TournamentQueries.cs on lines 214..219

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

        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 3 locations. Consider refactoring.
        Open

                public List<Centre> GetCentres(string year)
                {
                    var tournament = Tournaments.Single(x => x.Year == year);
                    var centres = Centres.Where(x => x.TournamentId == tournament.Id).ToList();
                    return centres;
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 2 other locations - About 55 mins to fix
        ReadModels/TournamentQueries.cs on lines 142..147
        ReadModels/TournamentQueries.cs on lines 149..154

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

        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

                    Hotels.Add(new Hotel
                    {
                        Id = e.HotelId,
                        TournamentId = e.Id,
                        Name = e.Name,
        Severity: Minor
        Found in ReadModels/TournamentQueries.cs and 1 other location - About 45 mins to fix
        ReadModels/ParticipantQueries.cs on lines 175..185

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

        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 void Handle(ChangeNotificationEmailChanged e)
                {
                    var tournament = Tournaments.SingleOrDefault(x => x.Id == e.Id);
                    if (tournament == null) return;
        
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 3 other locations - About 30 mins to fix
        ReadModels/TournamentQueries.cs on lines 259..265
        ReadModels/TournamentQueries.cs on lines 365..371
        ReadModels/TournamentQueries.cs on lines 381..387

        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 4 locations. Consider refactoring.
        Open

                public void Handle(SponsorPositionChanged e)
                {
                    var sponsor = Sponsors.SingleOrDefault(x => x.Id == e.Id);
                    if (sponsor == null) return;
        
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 3 other locations - About 30 mins to fix
        ReadModels/TournamentQueries.cs on lines 365..371
        ReadModels/TournamentQueries.cs on lines 373..379
        ReadModels/TournamentQueries.cs on lines 381..387

        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 4 locations. Consider refactoring.
        Open

                public void Handle(ScoreNotificationEmailChanged e)
                {
                    var tournament = Tournaments.SingleOrDefault(x => x.Id == e.Id);
                    if (tournament == null) return;
        
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 3 other locations - About 30 mins to fix
        ReadModels/TournamentQueries.cs on lines 259..265
        ReadModels/TournamentQueries.cs on lines 365..371
        ReadModels/TournamentQueries.cs on lines 373..379

        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 4 locations. Consider refactoring.
        Open

                public void Handle(ChangeNotificationCutoffChanged e)
                {
                    var tournament = Tournaments.SingleOrDefault(x => x.Id == e.Id);
                    if (tournament == null) return;
        
        Severity: Major
        Found in ReadModels/TournamentQueries.cs and 3 other locations - About 30 mins to fix
        ReadModels/TournamentQueries.cs on lines 259..265
        ReadModels/TournamentQueries.cs on lines 373..379
        ReadModels/TournamentQueries.cs on lines 381..387

        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