dolittle/DotNET.SDK

View on GitHub

Showing 230 of 230 total issues

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

public class ConventionProjectionBuilder<TProjection> : ICanTryBuildProjection
    where TProjection : ReadModel, new()
{
    readonly ProjectionModelId _identifier;
    const string MethodName = "On";
Severity: Minor
Found in Source/Projections/Builder/ConventionProjectionBuilder.cs - About 2 hrs to fix

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

        public async Task Handle(IReverseCallHandler<TRequest, TResponse> handler, CancellationToken cancellationToken)
        {
            ThrowIfConnectionNotEstablished();
            ThrowIfAlreadyStartedHandling();
            lock (_handleLock)
    Severity: Major
    Found in Source/Services/ReverseCallClient.cs - About 2 hrs to fix

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

          static void CheckProjectionAttributePresent(SyntaxNodeAnalysisContext context, INamedTypeSymbol projectionClass)
          {
              var hasAttribute = projectionClass.GetAttributes()
                  .Any(attribute => attribute.AttributeClass?.ToDisplayString().Equals(DolittleTypes.ProjectionAttribute, StringComparison.Ordinal) == true);
      
      
      Severity: Major
      Found in Source/Analyzers/ProjectionsAnalyzer.cs and 1 other location - About 2 hrs to fix
      Source/Analyzers/AggregateAnalyzer.cs on lines 110..124

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

      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

          static void CheckAggregateRootAttributePresent(SyntaxNodeAnalysisContext context, INamedTypeSymbol aggregateClass)
          {
              var hasAttribute = aggregateClass.GetAttributes()
                  .Any(attribute => attribute.AttributeClass?.ToDisplayString().Equals(DolittleTypes.AggregateRootAttribute, StringComparison.Ordinal) == true);
      
      
      Severity: Major
      Found in Source/Analyzers/AggregateAnalyzer.cs and 1 other location - About 2 hrs to fix
      Source/Analyzers/ProjectionsAnalyzer.cs on lines 159..173

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

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

          static void CheckOnMethods(SyntaxNodeAnalysisContext context, INamedTypeSymbol projectionType)
          {
              var members = projectionType.GetMembers();
              var onMethods = members.Where(_ => _.Name.Equals("On")).OfType<IMethodSymbol>().ToArray();
              var eventTypesHandled = new HashSet<ITypeSymbol>(SymbolEqualityComparer.Default);
      Severity: Major
      Found in Source/Analyzers/ProjectionsAnalyzer.cs - About 2 hrs to fix

        Method RunProcessorForeverUntilCancelledWithGracefulDisconnect has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async Task RunProcessorForeverUntilCancelledWithGracefulDisconnect<TIdentifier, TClientMessage, TServerMessage, TRegisterArguments, TRegisterResponse,
                TRequest, TResponse>(
                IEventProcessor<TIdentifier, TRegisterArguments, TRequest, TResponse> eventProcessor,
                IAmAReverseCallProtocol<TClientMessage, TServerMessage, TRegisterArguments, TRegisterResponse, TRequest, TResponse> protocol,
                CancellationToken shutdownToken)
        Severity: Major
        Found in Source/Events.Processing/EventProcessors.cs - About 2 hrs to fix

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

              public override void IterationSetup()
              {
                  base.IterationSetup();
                  var client = GetConnectedClient(_ => _
                      .WithEventTypes(_ => _.Register<AnEvent>().Register<LastEvent>())
          Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay.cs on lines 14..23
          Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_ten_aggregate_roots.cs on lines 15..24

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

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

              public override void IterationSetup()
              {
                  base.IterationSetup();
                  var client = GetConnectedClient(_ => _
                      .WithEventTypes(_ => _.Register<AnEvent>().Register<LastEvent>())
          Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_four_aggregate_roots.cs on lines 15..24
          Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_ten_aggregate_roots.cs on lines 15..24

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

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

              public override void IterationSetup()
              {
                  base.IterationSetup();
                  var client = GetConnectedClient(_ => _
                      .WithEventTypes(_ => _.Register<AnEvent>().Register<LastEvent>())
          Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay.cs on lines 14..23
          Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_four_aggregate_roots.cs on lines 15..24

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

          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

              static ProjectionSignature<TProjection> ResponseTypeReturn(MethodInfo method, ProjectionParametersType parametersType)
              {
                  return parametersType switch
                  {
                      ProjectionParametersType.EventOnly
          Severity: Major
          Found in Source/Projections/Builder/ProjectionSignatureFactory.cs and 1 other location - About 2 hrs to fix
          Source/Projections/Builder/ProjectionSignatureFactory.cs on lines 184..198

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

          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

              static ProjectionSignature<TProjection> VoidReturnType(MethodInfo method, ProjectionParametersType parametersType)
              {
                  return parametersType switch
                  {
                      ProjectionParametersType.EventOnly
          Severity: Major
          Found in Source/Projections/Builder/ProjectionSignatureFactory.cs and 1 other location - About 2 hrs to fix
          Source/Projections/Builder/ProjectionSignatureFactory.cs on lines 150..164

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

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

              public static bool TryToExecutionContext(this PbExecutionContext source, out ExecutionContext executionContext, [NotNullWhen(false)] out Exception? error)
              {
                  executionContext = default;
          
                  if (source == default)
          Severity: Minor
          Found in Source/Protobuf/ExecutionContextExtensions.cs - About 1 hr to fix

            Method Connect has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public async Task<IDolittleClient> Connect(DolittleClientConfiguration configuration, CancellationToken cancellationToken = default)
                {
                    if (IsConnected)
                    {
                        throw new CannotConnectDolittleClientMultipleTimes();
            Severity: Minor
            Found in Source/SDK/DolittleClient.cs - About 1 hr to fix

              Method TryAddConventionOnMethods has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  bool TryAddConventionOnMethods(
                      ProjectionModelId identifier,
                      IEnumerable<MethodInfo> methods,
                      IEventTypes eventTypes,
                      IDictionary<EventType, IProjectionMethod<TProjection>> eventTypesToMethods,
              Severity: Minor
              Found in Source/Projections/Builder/ConventionProjectionBuilder.cs - About 1 hr to fix

                Method ProcessSubscriptionRequest has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async Task<SubscribeResponse> ProcessSubscriptionRequest(Subscription subscription, SubscriptionRequest request, CancellationToken cancellationToken)
                    {
                        SubscribeResponse response = null;
                        await _retryEventSubscription(subscription, _logger, async () =>
                        {
                Severity: Minor
                Found in Source/EventHorizon/EventHorizons.cs - About 1 hr to fix

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

                  using Dolittle.SDK.Common.ClientSetup;
                  
                  namespace Dolittle.SDK.Events.Filters.Builders.Partitioned;
                  
                  /// <summary>
                  Source/Events.Filters/Builders/Unpartitioned/UnpartitionedEventFilterBuilder.cs on lines 4..32

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

                  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

                  using Dolittle.SDK.Common.ClientSetup;
                  
                  namespace Dolittle.SDK.Events.Filters.Builders.Unpartitioned;
                  
                  /// <summary>
                  Source/Events.Filters/Builders/Partitioned/PartitionedEventFilterBuilder.cs on lines 4..32

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

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

                      bool TryConvert(
                          Runtime.Events.Contracts.CommittedAggregateEvents.Types.CommittedAggregateEvent source,
                          EventSourceId eventSourceId,
                          AggregateRootId aggregateRootId,
                          [NotNullWhen(true)] out CommittedAggregateEvent? result,
                  Severity: Minor
                  Found in Source/Events/Store/Converters/AggregateEventToSDKConverter.cs - About 1 hr to fix

                    Method TryAddDecoratedOnMethods has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        bool TryAddDecoratedOnMethods(
                            ProjectionModelId identifier,
                            IEnumerable<MethodInfo> methods,
                            IDictionary<EventType, IProjectionMethod<TProjection>> eventTypesToMethods,
                            IClientBuildResults buildResults)
                    Severity: Minor
                    Found in Source/Projections/Builder/ConventionProjectionBuilder.cs - About 1 hr to fix

                      Method ReceiveAsync has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public async Task ReceiveAsync(IContext context)
                          {
                              try
                              {
                                  switch (context.Message)
                      Severity: Minor
                      Found in Source/Projections/Actors/ProjectionActor.cs - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language