synapsecns/sanguine

View on GitHub
services/explorer/consumer/client/client.go

Summary

Maintainability
D
2 days
Test Coverage

Method Client.GetLogsRange has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

func (c *Client) GetLogsRange(ctx context.Context, chainID int, startBlock int, endBlock int, page int, contractAddress *string, httpRequestOptions ...client.HTTPRequestOption) (*GetLogsRange, error) {
Severity: Major
Found in services/explorer/consumer/client/client.go - About 50 mins to fix

    Method Client.GetTransactions has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (c *Client) GetTransactions(ctx context.Context, chainID int, page int, txHash *string, httpRequestOptions ...client.HTTPRequestOption) (*GetTransactions, error) {
    Severity: Minor
    Found in services/explorer/consumer/client/client.go - About 35 mins to fix

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

      type Query struct {
          Logs                     []*model.Log         "json:\"logs\" graphql:\"logs\""
          LogsRange                []*model.Log         "json:\"logsRange\" graphql:\"logsRange\""
          Receipts                 []*model.Receipt     "json:\"receipts\" graphql:\"receipts\""
          ReceiptsRange            []*model.Receipt     "json:\"receiptsRange\" graphql:\"receiptsRange\""
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 1 other location - About 2 hrs to fix
      services/scribe/graphql/client/client.go on lines 21..40

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

      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 (c *Client) GetLogsRange(ctx context.Context, chainID int, startBlock int, endBlock int, page int, contractAddress *string, httpRequestOptions ...client.HTTPRequestOption) (*GetLogsRange, error) {
          vars := map[string]interface{}{
              "chain_id":         chainID,
              "start_block":      startBlock,
              "end_block":        endBlock,
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 1 other location - About 1 hr to fix
      services/scribe/graphql/client/client.go on lines 346..361

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

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

      func (c *Client) GetTxSender(ctx context.Context, chainID int, txHash string, httpRequestOptions ...client.HTTPRequestOption) (*GetTxSender, error) {
          vars := map[string]interface{}{
              "chain_id": chainID,
              "tx_hash":  txHash,
          }
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 12 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 174..186
      services/explorer/consumer/client/client.go on lines 248..260
      services/explorer/consumer/client/client.go on lines 285..297
      services/scribe/graphql/client/client.go on lines 316..328
      services/scribe/graphql/client/client.go on lines 428..440
      services/scribe/graphql/client/client.go on lines 572..584
      services/scribe/graphql/client/client.go on lines 606..618
      services/scribe/graphql/client/client.go on lines 724..736
      services/scribe/graphql/client/client.go on lines 743..755
      services/scribe/graphql/client/client.go on lines 798..810
      services/scribe/graphql/client/client.go on lines 817..829
      services/scribe/graphql/client/client.go on lines 854..866

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

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

      func (c *Client) GetLastIndexed(ctx context.Context, chainID int, contractAddress string, httpRequestOptions ...client.HTTPRequestOption) (*GetLastIndexed, error) {
          vars := map[string]interface{}{
              "chain_id":         chainID,
              "contract_address": contractAddress,
          }
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 12 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 174..186
      services/explorer/consumer/client/client.go on lines 229..241
      services/explorer/consumer/client/client.go on lines 285..297
      services/scribe/graphql/client/client.go on lines 316..328
      services/scribe/graphql/client/client.go on lines 428..440
      services/scribe/graphql/client/client.go on lines 572..584
      services/scribe/graphql/client/client.go on lines 606..618
      services/scribe/graphql/client/client.go on lines 724..736
      services/scribe/graphql/client/client.go on lines 743..755
      services/scribe/graphql/client/client.go on lines 798..810
      services/scribe/graphql/client/client.go on lines 817..829
      services/scribe/graphql/client/client.go on lines 854..866

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

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

      func (c *Client) GetLogCount(ctx context.Context, chainID int, contractAddress string, httpRequestOptions ...client.HTTPRequestOption) (*GetLogCount, error) {
          vars := map[string]interface{}{
              "chain_id":         chainID,
              "contract_address": contractAddress,
          }
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 12 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 174..186
      services/explorer/consumer/client/client.go on lines 229..241
      services/explorer/consumer/client/client.go on lines 248..260
      services/scribe/graphql/client/client.go on lines 316..328
      services/scribe/graphql/client/client.go on lines 428..440
      services/scribe/graphql/client/client.go on lines 572..584
      services/scribe/graphql/client/client.go on lines 606..618
      services/scribe/graphql/client/client.go on lines 724..736
      services/scribe/graphql/client/client.go on lines 743..755
      services/scribe/graphql/client/client.go on lines 798..810
      services/scribe/graphql/client/client.go on lines 817..829
      services/scribe/graphql/client/client.go on lines 854..866

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

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

      func (c *Client) GetBlockTime(ctx context.Context, chainID int, blockNumber int, httpRequestOptions ...client.HTTPRequestOption) (*GetBlockTime, error) {
          vars := map[string]interface{}{
              "chain_id":     chainID,
              "block_number": blockNumber,
          }
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 12 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 229..241
      services/explorer/consumer/client/client.go on lines 248..260
      services/explorer/consumer/client/client.go on lines 285..297
      services/scribe/graphql/client/client.go on lines 316..328
      services/scribe/graphql/client/client.go on lines 428..440
      services/scribe/graphql/client/client.go on lines 572..584
      services/scribe/graphql/client/client.go on lines 606..618
      services/scribe/graphql/client/client.go on lines 724..736
      services/scribe/graphql/client/client.go on lines 743..755
      services/scribe/graphql/client/client.go on lines 798..810
      services/scribe/graphql/client/client.go on lines 817..829
      services/scribe/graphql/client/client.go on lines 854..866

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

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

      func (c *Client) GetLastStoredBlockNumber(ctx context.Context, chainID int, httpRequestOptions ...client.HTTPRequestOption) (*GetLastStoredBlockNumber, error) {
          vars := map[string]interface{}{
              "chain_id": chainID,
          }
      
      
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 10 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 211..222
      services/explorer/consumer/client/client.go on lines 267..278
      services/explorer/consumer/client/client.go on lines 304..315
      services/explorer/consumer/client/client.go on lines 322..333
      services/explorer/graphql/client/client.go on lines 644..655
      services/scribe/graphql/client/client.go on lines 762..773
      services/scribe/graphql/client/client.go on lines 780..791
      services/scribe/graphql/client/client.go on lines 836..847
      services/scribe/graphql/client/client.go on lines 873..884
      services/scribe/graphql/client/client.go on lines 891..902

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

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

      func (c *Client) GetLastConfirmedBlockNumber(ctx context.Context, chainID int, httpRequestOptions ...client.HTTPRequestOption) (*GetLastConfirmedBlockNumber, error) {
          vars := map[string]interface{}{
              "chain_id": chainID,
          }
      
      
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 10 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 193..204
      services/explorer/consumer/client/client.go on lines 211..222
      services/explorer/consumer/client/client.go on lines 304..315
      services/explorer/consumer/client/client.go on lines 322..333
      services/explorer/graphql/client/client.go on lines 644..655
      services/scribe/graphql/client/client.go on lines 762..773
      services/scribe/graphql/client/client.go on lines 780..791
      services/scribe/graphql/client/client.go on lines 836..847
      services/scribe/graphql/client/client.go on lines 873..884
      services/scribe/graphql/client/client.go on lines 891..902

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

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

      func (c *Client) GetFirstStoredBlockNumber(ctx context.Context, chainID int, httpRequestOptions ...client.HTTPRequestOption) (*GetFirstStoredBlockNumber, error) {
          vars := map[string]interface{}{
              "chain_id": chainID,
          }
      
      
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 10 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 193..204
      services/explorer/consumer/client/client.go on lines 267..278
      services/explorer/consumer/client/client.go on lines 304..315
      services/explorer/consumer/client/client.go on lines 322..333
      services/explorer/graphql/client/client.go on lines 644..655
      services/scribe/graphql/client/client.go on lines 762..773
      services/scribe/graphql/client/client.go on lines 780..791
      services/scribe/graphql/client/client.go on lines 836..847
      services/scribe/graphql/client/client.go on lines 873..884
      services/scribe/graphql/client/client.go on lines 891..902

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

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

      func (c *Client) GetReceiptCount(ctx context.Context, chainID int, httpRequestOptions ...client.HTTPRequestOption) (*GetReceiptCount, error) {
          vars := map[string]interface{}{
              "chain_id": chainID,
          }
      
      
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 10 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 193..204
      services/explorer/consumer/client/client.go on lines 211..222
      services/explorer/consumer/client/client.go on lines 267..278
      services/explorer/consumer/client/client.go on lines 322..333
      services/explorer/graphql/client/client.go on lines 644..655
      services/scribe/graphql/client/client.go on lines 762..773
      services/scribe/graphql/client/client.go on lines 780..791
      services/scribe/graphql/client/client.go on lines 836..847
      services/scribe/graphql/client/client.go on lines 873..884
      services/scribe/graphql/client/client.go on lines 891..902

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

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

      func (c *Client) GetBlockTimeCount(ctx context.Context, chainID int, httpRequestOptions ...client.HTTPRequestOption) (*GetBlockTimeCount, error) {
          vars := map[string]interface{}{
              "chain_id": chainID,
          }
      
      
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 10 other locations - About 1 hr to fix
      services/explorer/consumer/client/client.go on lines 193..204
      services/explorer/consumer/client/client.go on lines 211..222
      services/explorer/consumer/client/client.go on lines 267..278
      services/explorer/consumer/client/client.go on lines 304..315
      services/explorer/graphql/client/client.go on lines 644..655
      services/scribe/graphql/client/client.go on lines 762..773
      services/scribe/graphql/client/client.go on lines 780..791
      services/scribe/graphql/client/client.go on lines 836..847
      services/scribe/graphql/client/client.go on lines 873..884
      services/scribe/graphql/client/client.go on lines 891..902

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

      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

      type GetTransactions struct {
          Response []*struct {
              ChainID   int    "json:\"chain_id\" graphql:\"chain_id\""
              TxHash    string "json:\"tx_hash\" graphql:\"tx_hash\""
              Protected bool   "json:\"protected\" graphql:\"protected\""
      Severity: Major
      Found in services/explorer/consumer/client/client.go and 3 other locations - About 50 mins to fix
      services/scribe/graphql/client/client.go on lines 189..206
      services/scribe/graphql/client/client.go on lines 207..224
      services/scribe/graphql/client/client.go on lines 225..242

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

      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