dolittle/DotNET.SDK

View on GitHub

Showing 230 of 230 total issues

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

    bool TryAddConventionHandlerMethods(
        IEnumerable<MethodInfo> methods,
        EventHandlerId eventHandlerId,
        IEventTypes eventTypes,
        CreateTypedHandleMethod createTypedHandlerMethod,

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

        static void CheckApplyInvocationsInOnMethods(SyntaxNodeAnalysisContext context, INamedTypeSymbol aggregateType)
        {
            var onMethods = aggregateType
                .GetMembers()
                .Where(member => member.Name.Equals("On"))
    Severity: Minor
    Found in Source/Analyzers/AggregateAnalyzer.cs - About 1 hr to fix

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

          public async Task InvokeAsync(HttpContext context)
          {
              if (_client is not { IsConnected: true })
              {
                  DolittleClientNotReady();
      Severity: Minor
      Found in Source/Extensions.AspNet/TenantScopedServiceProviderMiddleware.cs - About 1 hr to fix

        Method On has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async Task On(ProjectedEvent projectedEvent, IContext context)
            {
                var firstEvent = _projection is null;
                if (firstEvent)
                {
        Severity: Minor
        Found in Source/Projections/Actors/ProjectionActor.cs - About 1 hr to fix

          Method Perform has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public async Task<HandshakeResult> Perform(uint attemptNum, TimeSpan timeSpent, Version headVersion, IClientBuildResults buildResults, CancellationToken cancellationToken)
              {
                  try
                  {
                      var contractsVersion = Contracts.VersionInfo.CurrentVersion.ToVersion();
          Severity: Minor
          Found in Source/SDK/Handshake/Internal/HandshakeClient.cs - About 1 hr to fix

            Method Build has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static IUnregisteredEventHandlers Build(IModel model, IEventTypes eventTypes, IClientBuildResults buildResults)
                {
                    var eventHandlers = new UniqueBindings<EventHandlerModelId, IEventHandler>();
                    foreach (var (identifier, builder) in model.GetProcessorBuilderBindings<ConventionTypeEventHandlerBuilder>())
                    {
            Severity: Minor
            Found in Source/Events.Handling/Builder/EventHandlersBuilder.cs - About 1 hr to fix

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

                  async Task Apply100Stupid(EventSourceId eventSource)
                  {
                      for (var i = 0; i < 99; i++)
                      {
                          await _aggregates.Get<AnAggregateRoot>(eventSource).Perform(_ => _.DoSomething()).ConfigureAwait(false);
              Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_ten_aggregate_roots.cs on lines 86..93

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

              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

                  async Task Apply100Stupid(EventSourceId eventSource)
                  {
                      for (var i = 0; i < 99; i++)
                      {
                          await _aggregates.Get<AnAggregateRoot>(eventSource).Perform(_ => _.DoSomething()).ConfigureAwait(false);
              Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_four_aggregate_roots.cs on lines 68..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 125.

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

                  async Task OnReceivedRequest(IReverseCallHandler<TRequest, TResponse> handler, TRequest request, CancellationToken cancellationToken)
                  {
                      try
                      {
                          var requestContext = _protocol.GetRequestContextFrom(request);
              Severity: Minor
              Found in Source/Services/ReverseCallClient.cs - About 1 hr to fix

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

                    bool TryAddDecoratedHandlerMethods(
                        IEnumerable<MethodInfo> methods,
                        EventHandlerId eventHandlerId,
                        CreateUntypedHandleMethod createUntypedHandlerMethod,
                        IDictionary<EventType, IEventHandlerMethod> eventTypesToMethods,

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

                      [Benchmark]
                      public Task Applying100EventsWithNothingToReplay()
                      {
                          return Task.WhenAll(
                              Apply100Events("aggregate1"),
                  Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_ten_aggregate_roots.cs on lines 70..84

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

                  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

                      [Benchmark]
                      public Task Applying1Event100TimesWithNothingToReplay()
                      {
                          return Task.WhenAll(
                              Apply100Stupid("aggregate1"),
                  Benchmarks/SDK/AggregateRoots/with_1_tenant/applying_events_with_nothing_to_replay_for_ten_aggregate_roots.cs on lines 42..56

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

                  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 static IUnregisteredAggregateRoots Build(IModel model, IClientBuildResults buildResults)
                      {
                          var bindings = model.GetTypeBindings<AggregateRootType, AggregateRootId>().ToArray();
                          foreach (var binding in bindings)
                          {
                  Severity: Major
                  Found in Source/Aggregates/Builders/AggregateRootsBuilder.cs and 1 other location - About 1 hr to fix
                  Source/Events/Builders/EventTypesBuilder.cs on lines 85..93

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

                  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 System;
                  using Dolittle.SDK.Tenancy;
                  using Microsoft.Extensions.Logging;
                  
                  namespace Dolittle.SDK.Resources.Internal;
                  Severity: Major
                  Found in Source/Resources/Internal/Log.cs and 1 other location - About 1 hr to fix
                  Source/Events/Internal/Log.cs on lines 4..23

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

                  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 System;
                  using Microsoft.Extensions.Logging;
                  
                  namespace Dolittle.SDK.Events.Internal;
                  
                  
                  Severity: Major
                  Found in Source/Events/Internal/Log.cs and 1 other location - About 1 hr to fix
                  Source/Resources/Internal/Log.cs on lines 4..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 120.

                  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 static IUnregisteredEventTypes Build(IModel model, IClientBuildResults buildResults)
                      {
                          var bindings = model.GetTypeBindings<EventType, EventTypeId>().ToArray();
                          foreach (var binding in bindings)
                          {
                  Severity: Major
                  Found in Source/Events/Builders/EventTypesBuilder.cs and 1 other location - About 1 hr to fix
                  Source/Aggregates/Builders/AggregateRootsBuilder.cs on lines 58..66

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

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

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

                    Method TryTo has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static bool TryTo<TArtifact, TId>(this PbArtifact source, [NotNullWhen(true)] out TArtifact? artifact, [NotNullWhen(false)] out Exception? error)
                            where TArtifact : Artifact<TId>
                            where TId : ArtifactId
                        {
                            artifact = default;
                    Severity: Minor
                    Found in Source/Protobuf/ArtifactExtensions.cs - About 1 hr to fix

                      Method Deserialize has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public T Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
                          {
                              var bsonReader = context.Reader;
                              var actualType = args.NominalType;
                              var bsonType = bsonReader.GetCurrentBsonType();
                      Severity: Minor
                      Found in Source/Resources/MongoDB/ConceptSerializer.cs - About 1 hr to fix

                        Method CreateDependencies has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async Task CreateDependencies(
                                IPerformMethodCalls methodCaller,
                                DolittleClientConfiguration config,
                                ILoggerFactory loggerFactory,
                                ExecutionContext executionContext,
                        Severity: Minor
                        Found in Source/SDK/DolittleClient.cs - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language