File cluster.go
has 1596 lines of code (exceeds 500 allowed). Consider refactoring. Open
package ipfscluster
import (
"context"
"encoding/json"
Cluster
has 59 methods (exceeds 20 allowed). Consider refactoring. Open
type Cluster struct {
ctx context.Context
cancel func()
id peer.ID
Method Cluster.alertsHandler
has a Cognitive Complexity of 33 (exceeds 15 allowed). Consider refactoring. Wontfix
func (c *Cluster) alertsHandler() {
for {
select {
case <-c.ctx.Done():
return
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Cluster.Shutdown
has a Cognitive Complexity of 27 (exceeds 15 allowed). Consider refactoring. Open
func (c *Cluster) Shutdown(ctx context.Context) error {
ctx, span := trace.StartSpan(ctx, "cluster/Shutdown")
defer span.End()
c.shutdownLock.Lock()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Cluster.globalPinInfoStream
has a Cognitive Complexity of 25 (exceeds 15 allowed). Consider refactoring. Open
func (c *Cluster) globalPinInfoStream(ctx context.Context, comp, method string, inChan interface{}, out chan<- api.GlobalPinInfo) error {
defer close(out)
ctx, span := trace.StartSpan(ctx, "cluster/globalPinInfoStream")
defer span.End()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Cluster.globalPinInfoCid
has 96 lines of code (exceeds 80 allowed). Consider refactoring. Open
func (c *Cluster) globalPinInfoCid(ctx context.Context, comp, method string, h api.Cid) (api.GlobalPinInfo, error) {
ctx, span := trace.StartSpan(ctx, "cluster/globalPinInfoCid")
defer span.End()
// The object we will return
Method Cluster.globalPinInfoStream
has 95 lines of code (exceeds 80 allowed). Consider refactoring. Open
func (c *Cluster) globalPinInfoStream(ctx context.Context, comp, method string, inChan interface{}, out chan<- api.GlobalPinInfo) error {
defer close(out)
ctx, span := trace.StartSpan(ctx, "cluster/globalPinInfoStream")
defer span.End()
Function NewCluster
has 13 arguments (exceeds 6 allowed). Consider refactoring. Open
ctx context.Context,
host host.Host,
dht *dual.DHT,
cfg *Config,
datastore ds.Datastore,
Method Cluster.globalPinInfoCid
has a Cognitive Complexity of 21 (exceeds 15 allowed). Consider refactoring. Open
func (c *Cluster) globalPinInfoCid(ctx context.Context, comp, method string, h api.Cid) (api.GlobalPinInfo, error) {
ctx, span := trace.StartSpan(ctx, "cluster/globalPinInfoCid")
defer span.End()
// The object we will return
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Cluster.Join
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
func (c *Cluster) Join(ctx context.Context, addr ma.Multiaddr) error {
ctx, span := trace.StartSpan(ctx, "cluster/Join")
defer span.End()
logger.Debugf("Join(%s)", addr)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Cluster.watchPeers
has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring. Open
func (c *Cluster) watchPeers() {
ticker := time.NewTicker(c.config.PeerWatchInterval)
defer ticker.Stop()
for {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Cluster.watchPinset
has a Cognitive Complexity of 16 (exceeds 15 allowed). Consider refactoring. Open
func (c *Cluster) watchPinset() {
ctx, span := trace.StartSpan(c.ctx, "cluster/watchPinset")
defer span.End()
stateSyncTimer := time.NewTimer(c.config.StateSyncInterval)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
FIXME found Confirmed
// TODO: FIXME: potentially unpinning shards which are referenced
- Exclude checks
FIXME found Confirmed
// FIXME: repinning a shard type will overwrite replication
- Exclude checks
FIXME found Confirmed
// FIXME: indirect shard pins could have max-depth 2
- Exclude checks