AuthorizeNet/sdk-dotnet

View on GitHub
AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs

Summary

Maintainability
F
3 days
Test Coverage

File ApiCoreTestBase.cs has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using AuthorizeNet.Utility;

namespace AuthorizeNet.Api.Controllers.Test
{
    using System;
Severity: Major
Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 1 day to fix

    Method SetUp has 150 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            [SetUp]
            public void SetUp()
            {
                MockContext = new MockFactory();
    
    
    Severity: Major
    Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 6 hrs to fix

      Class ApiCoreTestBase has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

          [TestFixture]
          public abstract class ApiCoreTestBase {
      
              protected static readonly Log Logger = LogFactory.getLog(typeof(ApiCoreTestBase));
          
      Severity: Minor
      Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 3 hrs to fix

        Method ShowProperties has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
        Open

                public static void ShowProperties(Object bean) {  
                    if ( null == bean) { return; }
        
                    try
                    {
        Severity: Minor
        Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 2 hrs 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 ShowProperties has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public static void ShowProperties(Object bean) {  
                    if ( null == bean) { return; }
        
                    try
                    {
        Severity: Minor
        Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 1 hr to fix

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

                  private static TS ExecuteTestRequest<TQ, TS, TT>(bool successExpected, TQ request, AuthorizeNet.Environment execEnvironment = null) 
                      where TQ : ANetApiRequest
                      where TS : ANetApiResponse
                      where TT : ApiOperationBase<TQ, TS> 
                  {
          Severity: Minor
          Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 1 hr to fix

            Method SetMockControllerExpectations has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        IApiOperation<TQ, TS> mockController,
                        TQ mockRequest,
                        TS mockResponse,
                        ANetApiResponse errorResponse, 
                        List<String> results,
            Severity: Minor
            Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs - About 45 mins to fix

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

                          CustomerAddressOne = new customerAddressType
                              {
                                  firstName = GetRandomString("FName"),
                                  lastName = GetRandomString("LName"),
                                  company = GetRandomString("Company"),
              Severity: Major
              Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs and 1 other location - About 1 hr to fix
              AuthorizeNETtest/Api/Controllers/MockTest/getCustomerPaymentProfileListControllerTest.cs on lines 71..83

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

              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

                          NameAndAddressTypeTwo = new nameAndAddressType
                              {
                                  firstName = GetRandomString("FName"),
                                  lastName = GetRandomString("LName"),
                                  company = GetRandomString("Company"),
              Severity: Minor
              Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs and 1 other location - About 55 mins to fix
              AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs on lines 266..276

              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

                          NameAndAddressTypeOne = new nameAndAddressType
                              {
                                  firstName = GetRandomString("FName"),
                                  lastName = GetRandomString("LName"),
                                  company = GetRandomString("Company"),
              Severity: Minor
              Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs and 1 other location - About 55 mins to fix
              AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs on lines 278..288

              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

                      protected static TS ExecuteTestRequestWithFailure<TQ, TS, TT>(TQ request, AuthorizeNet.Environment execEnvironment = null)
                          where TQ : ANetApiRequest
                          where TS : ANetApiResponse
                          where TT : ApiOperationBase<TQ, TS> 
                      {
              Severity: Minor
              Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs and 1 other location - About 50 mins to fix
              AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs on lines 377..385

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

              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

                      protected static TS ExecuteTestRequestWithSuccess<TQ, TS, TT>(TQ request, AuthorizeNet.Environment execEnvironment = null)
                          where TQ : ANetApiRequest
                          where TS : ANetApiResponse
                          where TT : ApiOperationBase<TQ, TS> 
                      {
              Severity: Minor
              Found in AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs and 1 other location - About 50 mins to fix
              AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs on lines 387..395

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

              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