synapsecns/sanguine

View on GitHub
services/rfq/relayer/relconfig/config_test.go

Summary

Maintainability
F
4 days
Test Coverage

Function TestChainGetters has 226 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestChainGetters(t *testing.T) {
    chainID := 1
    badChainID := 2
    usdcAddr := "0x123"
    cfgWithBase := relconfig.Config{
Severity: Major
Found in services/rfq/relayer/relconfig/config_test.go - About 1 day to fix

    Function TestValidation has 104 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestValidation(t *testing.T) {
        t.Run("Valid", func(t *testing.T) {
            cfg := relconfig.Config{
                Chains: map[int]relconfig.ChainConfig{
                    1: {
    Severity: Major
    Found in services/rfq/relayer/relconfig/config_test.go - About 3 hrs to fix

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

          t.Run("InvalidInitialPct", func(t *testing.T) {
              cfg := relconfig.Config{
                  Chains: map[int]relconfig.ChainConfig{
                      1: {
                          Tokens: map[string]relconfig.TokenConfig{
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 1 other location - About 2 hrs to fix
      services/rfq/relayer/relconfig/config_test.go on lines 379..405

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

      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

          t.Run("InvalidMaintenancePct", func(t *testing.T) {
              cfg := relconfig.Config{
                  Chains: map[int]relconfig.ChainConfig{
                      1: {
                          Tokens: map[string]relconfig.TokenConfig{
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 1 other location - About 2 hrs to fix
      services/rfq/relayer/relconfig/config_test.go on lines 351..377

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

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

          t.Run("GetNativeToken", func(t *testing.T) {
              defaultVal, err := cfg.GetNativeToken(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.NativeToken)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 117..129
      services/rfq/relayer/relconfig/config_test.go on lines 159..171
      services/rfq/relayer/relconfig/config_test.go on lines 173..185
      services/rfq/relayer/relconfig/config_test.go on lines 187..199
      services/rfq/relayer/relconfig/config_test.go on lines 201..213
      services/rfq/relayer/relconfig/config_test.go on lines 215..227

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

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

          t.Run("GetDestGasEstimate", func(t *testing.T) {
              defaultVal, err := cfg.GetDestGasEstimate(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.DestGasEstimate)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 117..129
      services/rfq/relayer/relconfig/config_test.go on lines 131..143
      services/rfq/relayer/relconfig/config_test.go on lines 159..171
      services/rfq/relayer/relconfig/config_test.go on lines 187..199
      services/rfq/relayer/relconfig/config_test.go on lines 201..213
      services/rfq/relayer/relconfig/config_test.go on lines 215..227

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

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

          t.Run("GetConfirmations", func(t *testing.T) {
              defaultVal, err := cfg.GetConfirmations(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.Confirmations)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 131..143
      services/rfq/relayer/relconfig/config_test.go on lines 159..171
      services/rfq/relayer/relconfig/config_test.go on lines 173..185
      services/rfq/relayer/relconfig/config_test.go on lines 187..199
      services/rfq/relayer/relconfig/config_test.go on lines 201..213
      services/rfq/relayer/relconfig/config_test.go on lines 215..227

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

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

          t.Run("GetL1FeeChainID", func(t *testing.T) {
              defaultVal, err := cfg.GetL1FeeChainID(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.L1FeeChainID)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 117..129
      services/rfq/relayer/relconfig/config_test.go on lines 131..143
      services/rfq/relayer/relconfig/config_test.go on lines 159..171
      services/rfq/relayer/relconfig/config_test.go on lines 173..185
      services/rfq/relayer/relconfig/config_test.go on lines 201..213
      services/rfq/relayer/relconfig/config_test.go on lines 215..227

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

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

          t.Run("GetL1FeeDestGasEstimate", func(t *testing.T) {
              defaultVal, err := cfg.GetL1FeeDestGasEstimate(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.L1FeeDestGasEstimate)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 117..129
      services/rfq/relayer/relconfig/config_test.go on lines 131..143
      services/rfq/relayer/relconfig/config_test.go on lines 159..171
      services/rfq/relayer/relconfig/config_test.go on lines 173..185
      services/rfq/relayer/relconfig/config_test.go on lines 187..199
      services/rfq/relayer/relconfig/config_test.go on lines 201..213

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

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

          t.Run("GetOriginGasEstimate", func(t *testing.T) {
              defaultVal, err := cfg.GetOriginGasEstimate(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.OriginGasEstimate)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 117..129
      services/rfq/relayer/relconfig/config_test.go on lines 131..143
      services/rfq/relayer/relconfig/config_test.go on lines 173..185
      services/rfq/relayer/relconfig/config_test.go on lines 187..199
      services/rfq/relayer/relconfig/config_test.go on lines 201..213
      services/rfq/relayer/relconfig/config_test.go on lines 215..227

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

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

          t.Run("GetL1FeeOriginGasEstimate", func(t *testing.T) {
              defaultVal, err := cfg.GetL1FeeOriginGasEstimate(badChainID)
              assert.NoError(t, err)
              assert.Equal(t, defaultVal, relconfig.DefaultChainConfig.L1FeeOriginGasEstimate)
      
      
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 6 other locations - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 117..129
      services/rfq/relayer/relconfig/config_test.go on lines 131..143
      services/rfq/relayer/relconfig/config_test.go on lines 159..171
      services/rfq/relayer/relconfig/config_test.go on lines 173..185
      services/rfq/relayer/relconfig/config_test.go on lines 187..199
      services/rfq/relayer/relconfig/config_test.go on lines 215..227

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

      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

                  chainID: {
                      RFQAddress:              "0x123",
                      Confirmations:           1,
                      NativeToken:             "MATIC",
                      DeadlineBufferSeconds:   10,
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 1 other location - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 50..76

      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

              BaseChainConfig: relconfig.ChainConfig{
                  RFQAddress:              "0x1234",
                  Confirmations:           2,
                  NativeToken:             "ARB",
                  DeadlineBufferSeconds:   11,
      Severity: Major
      Found in services/rfq/relayer/relconfig/config_test.go and 1 other location - About 1 hr to fix
      services/rfq/relayer/relconfig/config_test.go on lines 22..48

      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

      func (v *ValidateDecimalsSuite) TestValidateCorrectDecimals() {
          cfg := relconfig.Config{
              Chains: map[int]relconfig.ChainConfig{
                  1: {
                      Tokens: map[string]relconfig.TokenConfig{
      Severity: Minor
      Found in services/rfq/relayer/relconfig/config_test.go and 1 other location - About 55 mins to fix
      services/rfq/relayer/relconfig/config_test.go on lines 484..500

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

      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 (v *ValidateDecimalsSuite) TestValidateWrongDecimals() {
          cfg := relconfig.Config{
              Chains: map[int]relconfig.ChainConfig{
                  1: {
                      Tokens: map[string]relconfig.TokenConfig{
      Severity: Minor
      Found in services/rfq/relayer/relconfig/config_test.go and 1 other location - About 55 mins to fix
      services/rfq/relayer/relconfig/config_test.go on lines 502..517

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

      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