Fantom-foundation/go-lachesis

View on GitHub
gossip/sfcproxy/contract.go

Summary

Maintainability
D
2 days
Test Coverage

Method ContractAdminChangedIterator.Next has 7 return statements (exceeds 4 allowed).
Open

func (it *ContractAdminChangedIterator) Next() bool {
    // If the iterator failed, stop iterating
    if it.fail != nil {
        return false
    }
Severity: Major
Found in gossip/sfcproxy/contract.go - About 45 mins to fix

    Method ContractUpgradedIterator.Next has 7 return statements (exceeds 4 allowed).
    Open

    func (it *ContractUpgradedIterator) Next() bool {
        // If the iterator failed, stop iterating
        if it.fail != nil {
            return false
        }
    Severity: Major
    Found in gossip/sfcproxy/contract.go - About 45 mins to fix

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

      func (it *ContractUpgradedIterator) Next() bool {
          // If the iterator failed, stop iterating
          if it.fail != nil {
              return false
          }
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 76 other locations - About 3 hrs to fix
      gossip/sfc110/contract.go on lines 2095..2132
      gossip/sfc110/contract.go on lines 2249..2286
      gossip/sfc110/contract.go on lines 2404..2441
      gossip/sfc110/contract.go on lines 2550..2587
      gossip/sfc110/contract.go on lines 2703..2740
      gossip/sfc110/contract.go on lines 2856..2893
      gossip/sfc110/contract.go on lines 3020..3057
      gossip/sfc110/contract.go on lines 3172..3209
      gossip/sfc110/contract.go on lines 3315..3352
      gossip/sfc110/contract.go on lines 3469..3506
      gossip/sfc110/contract.go on lines 3614..3651
      gossip/sfc110/contract.go on lines 3766..3803
      gossip/sfc110/contract.go on lines 3930..3967
      gossip/sfc110/contract.go on lines 4082..4119
      gossip/sfc110/contract.go on lines 4225..4262
      gossip/sfc110/contract.go on lines 4378..4415
      gossip/sfc110/contract.go on lines 4511..4548
      gossip/sfc110/contract.go on lines 4673..4710
      gossip/sfc110/contract.go on lines 4807..4844
      gossip/sfc110/contract.go on lines 4952..4989
      gossip/sfc110/contract.go on lines 5095..5132
      gossip/sfc110/contract.go on lines 5256..5293
      gossip/sfc110/contract.go on lines 5409..5446
      gossip/sfc202/contract.go on lines 2442..2479
      gossip/sfc202/contract.go on lines 2597..2634
      gossip/sfc202/contract.go on lines 2743..2780
      gossip/sfc202/contract.go on lines 2896..2933
      gossip/sfc202/contract.go on lines 3049..3086
      gossip/sfc202/contract.go on lines 3213..3250
      gossip/sfc202/contract.go on lines 3365..3402
      gossip/sfc202/contract.go on lines 3508..3545
      gossip/sfc202/contract.go on lines 3662..3699
      gossip/sfc202/contract.go on lines 3807..3844
      gossip/sfc202/contract.go on lines 3961..3998
      gossip/sfc202/contract.go on lines 4106..4143
      gossip/sfc202/contract.go on lines 4239..4276
      gossip/sfc202/contract.go on lines 4391..4428
      gossip/sfc202/contract.go on lines 4555..4592
      gossip/sfc202/contract.go on lines 4707..4744
      gossip/sfc202/contract.go on lines 4850..4887
      gossip/sfc202/contract.go on lines 5003..5040
      gossip/sfc202/contract.go on lines 5136..5173
      gossip/sfc202/contract.go on lines 5298..5335
      gossip/sfc202/contract.go on lines 5432..5469
      gossip/sfc202/contract.go on lines 5565..5602
      gossip/sfc202/contract.go on lines 5699..5736
      gossip/sfc202/contract.go on lines 5844..5881
      gossip/sfc202/contract.go on lines 5987..6024
      gossip/sfc202/contract.go on lines 6148..6185
      gossip/sfc202/contract.go on lines 6301..6338
      gossip/sfc204/contract.go on lines 2285..2322
      gossip/sfc204/contract.go on lines 2440..2477
      gossip/sfc204/contract.go on lines 2586..2623
      gossip/sfc204/contract.go on lines 2739..2776
      gossip/sfc204/contract.go on lines 2892..2929
      gossip/sfc204/contract.go on lines 3056..3093
      gossip/sfc204/contract.go on lines 3208..3245
      gossip/sfc204/contract.go on lines 3351..3388
      gossip/sfc204/contract.go on lines 3505..3542
      gossip/sfc204/contract.go on lines 3650..3687
      gossip/sfc204/contract.go on lines 3804..3841
      gossip/sfc204/contract.go on lines 3949..3986
      gossip/sfc204/contract.go on lines 4082..4119
      gossip/sfc204/contract.go on lines 4234..4271
      gossip/sfc204/contract.go on lines 4398..4435
      gossip/sfc204/contract.go on lines 4550..4587
      gossip/sfc204/contract.go on lines 4693..4730
      gossip/sfc204/contract.go on lines 4846..4883
      gossip/sfc204/contract.go on lines 4979..5016
      gossip/sfc204/contract.go on lines 5141..5178
      gossip/sfc204/contract.go on lines 5275..5312
      gossip/sfc204/contract.go on lines 5408..5445
      gossip/sfc204/contract.go on lines 5542..5579
      gossip/sfc204/contract.go on lines 5687..5724
      gossip/sfc204/contract.go on lines 5840..5877
      gossip/sfcproxy/contract.go on lines 343..380

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

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

      func (it *ContractAdminChangedIterator) Next() bool {
          // If the iterator failed, stop iterating
          if it.fail != nil {
              return false
          }
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 76 other locations - About 3 hrs to fix
      gossip/sfc110/contract.go on lines 2095..2132
      gossip/sfc110/contract.go on lines 2249..2286
      gossip/sfc110/contract.go on lines 2404..2441
      gossip/sfc110/contract.go on lines 2550..2587
      gossip/sfc110/contract.go on lines 2703..2740
      gossip/sfc110/contract.go on lines 2856..2893
      gossip/sfc110/contract.go on lines 3020..3057
      gossip/sfc110/contract.go on lines 3172..3209
      gossip/sfc110/contract.go on lines 3315..3352
      gossip/sfc110/contract.go on lines 3469..3506
      gossip/sfc110/contract.go on lines 3614..3651
      gossip/sfc110/contract.go on lines 3766..3803
      gossip/sfc110/contract.go on lines 3930..3967
      gossip/sfc110/contract.go on lines 4082..4119
      gossip/sfc110/contract.go on lines 4225..4262
      gossip/sfc110/contract.go on lines 4378..4415
      gossip/sfc110/contract.go on lines 4511..4548
      gossip/sfc110/contract.go on lines 4673..4710
      gossip/sfc110/contract.go on lines 4807..4844
      gossip/sfc110/contract.go on lines 4952..4989
      gossip/sfc110/contract.go on lines 5095..5132
      gossip/sfc110/contract.go on lines 5256..5293
      gossip/sfc110/contract.go on lines 5409..5446
      gossip/sfc202/contract.go on lines 2442..2479
      gossip/sfc202/contract.go on lines 2597..2634
      gossip/sfc202/contract.go on lines 2743..2780
      gossip/sfc202/contract.go on lines 2896..2933
      gossip/sfc202/contract.go on lines 3049..3086
      gossip/sfc202/contract.go on lines 3213..3250
      gossip/sfc202/contract.go on lines 3365..3402
      gossip/sfc202/contract.go on lines 3508..3545
      gossip/sfc202/contract.go on lines 3662..3699
      gossip/sfc202/contract.go on lines 3807..3844
      gossip/sfc202/contract.go on lines 3961..3998
      gossip/sfc202/contract.go on lines 4106..4143
      gossip/sfc202/contract.go on lines 4239..4276
      gossip/sfc202/contract.go on lines 4391..4428
      gossip/sfc202/contract.go on lines 4555..4592
      gossip/sfc202/contract.go on lines 4707..4744
      gossip/sfc202/contract.go on lines 4850..4887
      gossip/sfc202/contract.go on lines 5003..5040
      gossip/sfc202/contract.go on lines 5136..5173
      gossip/sfc202/contract.go on lines 5298..5335
      gossip/sfc202/contract.go on lines 5432..5469
      gossip/sfc202/contract.go on lines 5565..5602
      gossip/sfc202/contract.go on lines 5699..5736
      gossip/sfc202/contract.go on lines 5844..5881
      gossip/sfc202/contract.go on lines 5987..6024
      gossip/sfc202/contract.go on lines 6148..6185
      gossip/sfc202/contract.go on lines 6301..6338
      gossip/sfc204/contract.go on lines 2285..2322
      gossip/sfc204/contract.go on lines 2440..2477
      gossip/sfc204/contract.go on lines 2586..2623
      gossip/sfc204/contract.go on lines 2739..2776
      gossip/sfc204/contract.go on lines 2892..2929
      gossip/sfc204/contract.go on lines 3056..3093
      gossip/sfc204/contract.go on lines 3208..3245
      gossip/sfc204/contract.go on lines 3351..3388
      gossip/sfc204/contract.go on lines 3505..3542
      gossip/sfc204/contract.go on lines 3650..3687
      gossip/sfc204/contract.go on lines 3804..3841
      gossip/sfc204/contract.go on lines 3949..3986
      gossip/sfc204/contract.go on lines 4082..4119
      gossip/sfc204/contract.go on lines 4234..4271
      gossip/sfc204/contract.go on lines 4398..4435
      gossip/sfc204/contract.go on lines 4550..4587
      gossip/sfc204/contract.go on lines 4693..4730
      gossip/sfc204/contract.go on lines 4846..4883
      gossip/sfc204/contract.go on lines 4979..5016
      gossip/sfc204/contract.go on lines 5141..5178
      gossip/sfc204/contract.go on lines 5275..5312
      gossip/sfc204/contract.go on lines 5408..5445
      gossip/sfc204/contract.go on lines 5542..5579
      gossip/sfc204/contract.go on lines 5687..5724
      gossip/sfc204/contract.go on lines 5840..5877
      gossip/sfcproxy/contract.go on lines 477..514

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

      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 (_Contract *ContractFilterer) WatchAdminChanged(opts *bind.WatchOpts, sink chan<- *ContractAdminChanged) (event.Subscription, error) {
      
          logs, sub, err := _Contract.contract.WatchLogs(opts, "AdminChanged")
          if err != nil {
              return nil, err
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 12 other locations - About 3 hrs to fix
      gossip/sfc110/contract.go on lines 4450..4482
      gossip/sfc110/contract.go on lines 4746..4778
      gossip/sfc202/contract.go on lines 4178..4210
      gossip/sfc202/contract.go on lines 5075..5107
      gossip/sfc202/contract.go on lines 5371..5403
      gossip/sfc202/contract.go on lines 5504..5536
      gossip/sfc202/contract.go on lines 5638..5670
      gossip/sfc204/contract.go on lines 4021..4053
      gossip/sfc204/contract.go on lines 4918..4950
      gossip/sfc204/contract.go on lines 5214..5246
      gossip/sfc204/contract.go on lines 5347..5379
      gossip/sfc204/contract.go on lines 5481..5513

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      func DeployContract(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Contract, error) {
          parsed, err := abi.JSON(strings.NewReader(ContractABI))
          if err != nil {
              return common.Address{}, nil, nil, err
          }
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 2 other locations - About 2 hrs to fix
      gossip/sfc110/contract.go on lines 36..47
      gossip/sfc202/contract.go on lines 36..47

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      func NewContract(address common.Address, backend bind.ContractBackend) (*Contract, error) {
          contract, err := bindContract(address, backend, backend, backend)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 4 other locations - About 50 mins to fix
      gossip/ballot/contract.go on lines 109..115
      gossip/sfc110/contract.go on lines 109..115
      gossip/sfc202/contract.go on lines 109..115
      gossip/sfc204/contract.go on lines 92..98

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      func bindContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
          parsed, err := abi.JSON(strings.NewReader(ContractABI))
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 4 other locations - About 50 mins to fix
      gossip/ballot/contract.go on lines 145..151
      gossip/sfc110/contract.go on lines 145..151
      gossip/sfc202/contract.go on lines 145..151
      gossip/sfc204/contract.go on lines 128..134

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

      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 (_Contract *ContractFilterer) FilterAdminChanged(opts *bind.FilterOpts) (*ContractAdminChangedIterator, error) {
      
          logs, sub, err := _Contract.contract.FilterLogs(opts, "AdminChanged")
          if err != nil {
              return nil, err
      Severity: Major
      Found in gossip/sfcproxy/contract.go and 12 other locations - About 45 mins to fix
      gossip/sfc110/contract.go on lines 4438..4445
      gossip/sfc110/contract.go on lines 4734..4741
      gossip/sfc202/contract.go on lines 4166..4173
      gossip/sfc202/contract.go on lines 5063..5070
      gossip/sfc202/contract.go on lines 5359..5366
      gossip/sfc202/contract.go on lines 5492..5499
      gossip/sfc202/contract.go on lines 5626..5633
      gossip/sfc204/contract.go on lines 4009..4016
      gossip/sfc204/contract.go on lines 4906..4913
      gossip/sfc204/contract.go on lines 5202..5209
      gossip/sfc204/contract.go on lines 5335..5342
      gossip/sfc204/contract.go on lines 5469..5476

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

      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