dolittle/DotNET.SDK

View on GitHub

Showing 230 of 230 total issues

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

    async Task RunProcessorForeverUntilCancelled<TIdentifier, TClientMessage, TServerMessage, TRegisterArguments, TRegisterResponse, TRequest, TResponse>(
        IEventProcessor<TIdentifier, TRegisterArguments, TRequest, TResponse> eventProcessor,
        IAmAReverseCallProtocol<TClientMessage, TServerMessage, TRegisterArguments, TRegisterResponse, TRequest, TResponse> protocol,
        CancellationToken cancellationToken)
        where TIdentifier : ConceptAs<Guid>
Severity: Minor
Found in Source/Events.Processing/EventProcessors.cs - About 1 hr to fix

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

        static Func<IServiceProvider, EventSourceId, Try<TAggregateRoot>> CreateConstruct(Type aggregateRootType)
        {
            if (!TryGetConstructor(aggregateRootType, out var constructor, out var e))
            {
                // Not instantiatable
    Severity: Minor
    Found in Source/Aggregates/Internal/AggregateRootMetadata.cs - About 1 hr to fix

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

          public static DolittleClientConfiguration FromConfiguration(Configurations.Dolittle config)
          {
              var result = new DolittleClientConfiguration();
      
              if (!string.IsNullOrEmpty(config.Runtime.Host))
      Severity: Minor
      Found in Source/SDK/Builders/DolittleClientConfiguration.cs - About 1 hr to fix

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

            public async Task<TResponse> Perform<TResponse>(Func<TAggregate, TResponse> method, CancellationToken cancellationToken = default)
            {
                if(cancellationToken == default)
                {
                    cancellationToken = _defaultTimeout();
        Severity: Minor
        Found in Source/Aggregates/AggregateRootOperations.cs - About 1 hr to fix

          Method ReceiveAsync has 35 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/SubscriptionActor.cs - About 1 hr to fix

            Method Commit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public async Task<CommittedEvents> Commit(UncommittedEvents uncommittedEvents, CancellationToken cancellationToken = default)
                {
                    using var activity = Tracing.ActivitySource.StartActivity()
                        ?.Tag(uncommittedEvents);
            
            
            Severity: Minor
            Found in Source/Events/Store/Internal/EventCommitter.cs - About 1 hr to fix

              Method CommitForAggregate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public async Task<CommittedAggregateEvents> CommitForAggregate(UncommittedAggregateEvents uncommittedAggregateEvents, CancellationToken cancellationToken = default)
                  {
                      using var activity = Tracing.ActivitySource.StartActivity()
                          ?.Tag(uncommittedAggregateEvents);
              
              
              Severity: Minor
              Found in Source/Events/Store/Internal/AggregateEventCommitter.cs - About 1 hr to fix

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

                        var singlyBoundTypes = new SinglyBoundDeDuplicatedIdentifierMap<Type>(
                            deDuplicatedTypes,
                            (type, identifiers) =>
                            {
                                var sb = new StringBuilder();
                Severity: Major
                Found in Source/Common/Model/ModelBuilder.cs and 1 other location - About 1 hr to fix
                Source/Common/Model/ModelBuilder.cs on lines 88..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 111.

                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

                        var singlyBoundProcessorBuilders = new SinglyBoundDeDuplicatedIdentifierMap<object>(
                            deDuplicatedProcessorBuilders,
                            (processorBuilder, identifiers) =>
                            {
                                var sb = new StringBuilder();
                Severity: Major
                Found in Source/Common/Model/ModelBuilder.cs and 1 other location - About 1 hr to fix
                Source/Common/Model/ModelBuilder.cs on lines 76..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 111.

                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 (!eventType.HasEventTypeAttribute())
                                {
                                    context.ReportDiagnostic(Diagnostic.Create(
                                        DescriptorRules.Events.MissingAttribute,
                                        parameters[0].DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation(),
                Severity: Major
                Found in Source/Analyzers/ProjectionsAnalyzer.cs and 1 other location - About 1 hr to fix
                Source/Analyzers/AggregateAnalyzer.cs on lines 95..103

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

                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 (!eventType.HasEventTypeAttribute())
                                {
                                    context.ReportDiagnostic(Diagnostic.Create(
                                        DescriptorRules.Events.MissingAttribute,
                                        parameters[0].DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation(),
                Severity: Major
                Found in Source/Analyzers/AggregateAnalyzer.cs and 1 other location - About 1 hr to fix
                Source/Analyzers/ProjectionsAnalyzer.cs on lines 93..101

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

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

                    public static IServiceCollection AddProtoCluster(this IServiceCollection self, GetClusterKinds getClusterKinds)
                    {
                        self.AddSingleton(p =>
                        {
                            var loggerFactory = p.GetRequiredService<ILoggerFactory>();
                Severity: Minor
                Found in Source/SDK/Proto/ServiceCollectionExtensions.cs - About 1 hr to fix

                  Method Start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public async Task Start()
                      {
                          if (_started)
                          {
                              return;
                  Severity: Minor
                  Found in Benchmarks/Harness/Container.cs - About 1 hr to fix

                    Method RegistrationsFor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public IEnumerable<IComponentRegistration> RegistrationsFor(Service service, Func<Service, IEnumerable<ServiceRegistration>> registrationAccessor)
                        {
                            if (service is not IServiceWithType serviceWithType)
                            {
                                return Enumerable.Empty<IComponentRegistration>();

                      Method AddProtoInfra has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static IServiceCollection AddProtoInfra(this IServiceCollection services, GetClusterKinds getClusterKinds)
                          {
                              return AddProtoCluster(services, getClusterKinds)
                                  .AddSingleton<GetServiceProviderForTenant>(sp =>
                                  {
                      Severity: Minor
                      Found in Source/SDK/Proto/ServiceCollectionExtensions.cs - About 1 hr to fix

                        Method ParametersAreValid has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            internal static bool ParametersAreValid(MethodInfo method, [NotNullWhen(true)] out ProjectionParametersType? parametersType)
                            {
                                var parameters = method.GetParameters();
                                parametersType = default;
                                if (parameters.Length is 0 or > 2)
                        Severity: Minor
                        Found in Source/Projections/Builder/ProjectionSignatureFactory.cs - About 1 hr to fix

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

                              void On(CommittedEvent evt)
                              {
                                  var eventType = evt.EventType;
                                  if (!_projection.Events.TryGetValue(eventType, out var keySelector))
                                  {
                          Severity: Minor
                          Found in Source/Testing/Projections/ProjectionTests.cs - About 1 hr to fix

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

                                public async Task Perform(Func<TAggregate, Task> method, CancellationToken cancellationToken = default)
                                {
                                    if(cancellationToken == default)
                                    {
                                        cancellationToken = _defaultTimeout();
                            Severity: Minor
                            Found in Source/Aggregates/AggregateRootOperations.cs - About 1 hr to fix

                              Method AddToContainer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  void AddToContainer(TenantId tenantId, IServiceCollection serviceCollection)
                                  {
                                      foreach (var projection in Values)
                                      {
                                          var readModelType = projection.ProjectionType;
                              Severity: Minor
                              Found in Source/Projections/Builder/UnregisteredProjections.cs - About 1 hr to fix

                                Method CheckOnReturnType has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    static void CheckOnReturnType(SyntaxNodeAnalysisContext context, INamedTypeSymbol projectionType, IMethodSymbol onMethod,
                                        MethodDeclarationSyntax syntax)
                                    {
                                        // Check for valid return type. Valid types are void, ProjectionResultType and ProjectionResult<>
                                        var returnType = onMethod.ReturnType;
                                Severity: Minor
                                Found in Source/Analyzers/ProjectionsAnalyzer.cs - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language