chartmogul/chartmogul-go

View on GitHub

Showing 38 of 38 total issues

Function TestConnectSubscriptions has 125 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestConnectSubscriptions(t *testing.T) {
    if testing.Short() {
        t.Skip("Integration test.")
    }

Severity: Major
Found in integration_tests/connect_subscription_test.go - About 4 hrs to fix

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

        server := httptest.NewServer(
            http.HandlerFunc(
                func(w http.ResponseWriter, r *http.Request) {
                    expectedMethod := "POST"
                    if r.Method != expectedMethod {
    Severity: Major
    Found in invoices_test.go and 1 other location - About 3 hrs to fix
    invoices_test.go on lines 202..226

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

    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

        server := httptest.NewServer(
            http.HandlerFunc(
                func(w http.ResponseWriter, r *http.Request) {
                    expectedMethod := "POST"
                    if r.Method != expectedMethod {
    Severity: Major
    Found in invoices_test.go and 1 other location - About 3 hrs to fix
    invoices_test.go on lines 249..273

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

    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

    Function TestCreateInvoice has 95 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestCreateInvoice(t *testing.T) {
        if testing.Short() {
            t.Skip("Integration test.")
        }
    
    
    Severity: Major
    Found in integration_tests/create_invoice_test.go - About 2 hrs to fix

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

      func TestDeletePlanGroup(t *testing.T) {
      
          server := httptest.NewServer(
              http.HandlerFunc(
                  func(w http.ResponseWriter, r *http.Request) {
      Severity: Major
      Found in plan_groups_test.go and 1 other location - About 2 hrs to fix
      invoices_test.go on lines 138..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 237.

      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

      func TestDeleteInvoice(t *testing.T) {
      
          server := httptest.NewServer(
              http.HandlerFunc(
                  func(w http.ResponseWriter, r *http.Request) {
      Severity: Major
      Found in invoices_test.go and 1 other location - About 2 hrs to fix
      plan_groups_test.go on lines 54..80

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

      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

      Function TestEmptyDataSource has 94 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestEmptyDataSource(t *testing.T) {
          if testing.Short() {
              t.Skip("Integration test.")
          }
      
      
      Severity: Major
      Found in integration_tests/empty_data_source_test.go - About 2 hrs to fix

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

            inv, err := api.CreateInvoices([]*cm.Invoice{
                {
                    Date:       time.Now().Format(time.RFC3339),
                    ExternalID: "INV_to_be_deleted",
                    Currency:   "EUR",
        Severity: Major
        Found in integration_tests/delete_invoice_test.go and 1 other location - About 2 hrs to fix
        integration_tests/empty_data_source_test.go on lines 62..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 216.

        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

            _, err = api.CreateInvoices([]*cm.Invoice{
                {
                    Date:       time.Now().Format(time.RFC3339),
                    ExternalID: "INV_to_be_deleted",
                    Currency:   "EUR",
        Severity: Major
        Found in integration_tests/empty_data_source_test.go and 1 other location - About 2 hrs to fix
        integration_tests/delete_invoice_test.go on lines 57..88

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

        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

        Function TestDeleteInvoice has 81 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestDeleteInvoice(t *testing.T) {
            if testing.Short() {
                t.Skip("Integration test.")
            }
        
        
        Severity: Major
        Found in integration_tests/delete_invoice_test.go - About 2 hrs to fix

          Function TestRetrieveInvoice has 78 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestRetrieveInvoice(t *testing.T) {
              if testing.Short() {
                  t.Skip("Integration test.")
              }
          
          
          Severity: Major
          Found in integration_tests/retrieve_invoice_test.go - About 2 hrs to fix

            Function TestCreatePlanGroup has 63 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func TestCreatePlanGroup(t *testing.T) {
                if testing.Short() {
                    t.Skip("Integration test.")
                }
            
            
            Severity: Minor
            Found in integration_tests/create_plan_group_test.go - About 1 hr to fix

              Function TestFormattingOfSourceInCustomAttributeUpdate has 62 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestFormattingOfSourceInCustomAttributeUpdate(t *testing.T) {
              
                  expected := map[string]interface{}{
                      "attributes": map[string]interface{}{
                          "custom": map[string]interface{}{
              Severity: Minor
              Found in customers_test.go - About 1 hr to fix

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

                    server := httptest.NewServer(
                        http.HandlerFunc(
                            func(w http.ResponseWriter, r *http.Request) {
                                expectedMethod := "GET"
                                if r.Method != expectedMethod {
                Severity: Major
                Found in invoices_test.go and 2 other locations - About 1 hr to fix
                account_test.go on lines 19..33
                plan_groups_test.go on lines 83..97

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

                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

                    server := httptest.NewServer(
                        http.HandlerFunc(
                            func(w http.ResponseWriter, r *http.Request) {
                                expectedMethod := "GET"
                                if r.Method != expectedMethod {
                Severity: Major
                Found in account_test.go and 2 other locations - About 1 hr to fix
                invoices_test.go on lines 167..181
                plan_groups_test.go on lines 83..97

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

                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

                    server := httptest.NewServer(
                        http.HandlerFunc(
                            func(w http.ResponseWriter, r *http.Request) {
                                expectedMethod := "GET"
                                if r.Method != expectedMethod {
                Severity: Major
                Found in plan_groups_test.go and 2 other locations - About 1 hr to fix
                account_test.go on lines 19..33
                invoices_test.go on lines 167..181

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

                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

                Function TestConnectSubscriptions has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestConnectSubscriptions(t *testing.T) {
                    expected := map[string]interface{}{
                        "subscriptions": []interface{}{
                            map[string]interface{}{
                                "data_source_uuid": "ds_uuid1",
                Severity: Minor
                Found in subscriptions_test.go - About 1 hr to fix

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

                      server := httptest.NewServer(
                          http.HandlerFunc(
                              func(w http.ResponseWriter, r *http.Request) {
                                  if r.Method != "GET" {
                                      t.Errorf("Unexpected method %v", r.Method)
                  Severity: Major
                  Found in metrics_activities_exports_test.go and 3 other locations - About 1 hr to fix
                  customers_test.go on lines 250..263
                  customers_test.go on lines 284..301
                  metrics_activities_exports_test.go on lines 13..39

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

                      server := httptest.NewServer(
                          http.HandlerFunc(
                              func(w http.ResponseWriter, r *http.Request) {
                                  if r.Method != "POST" {
                                      t.Errorf("Unexpected method %v", r.Method)
                  Severity: Major
                  Found in metrics_activities_exports_test.go and 3 other locations - About 1 hr to fix
                  customers_test.go on lines 250..263
                  customers_test.go on lines 284..301
                  metrics_activities_exports_test.go on lines 65..91

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

                      server := httptest.NewServer(
                          http.HandlerFunc(
                              func(w http.ResponseWriter, r *http.Request) {
                                  if r.Method != "GET" {
                                      t.Errorf("Unexpected method %v", r.Method)
                  Severity: Major
                  Found in customers_test.go and 3 other locations - About 1 hr to fix
                  customers_test.go on lines 284..301
                  metrics_activities_exports_test.go on lines 13..39
                  metrics_activities_exports_test.go on lines 65..91

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language