Showing 1,008 of 1,820 total issues
Method UpdateVolumeStatusRequest_VolumeStatusUpdate.Unmarshal
has 99 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *UpdateVolumeStatusRequest_VolumeStatusUpdate) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method IssueNodeCertificateResponse.Unmarshal
has 98 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *IssueNodeCertificateResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method SelectBySlot.Unmarshal
has 98 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *SelectBySlot) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method ResourceReference.Unmarshal
has 98 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *ResourceReference) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method session.watch
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func (s *session) watch(ctx context.Context) error {
logger := log.G(ctx).WithFields(log.Fields{"method": "(*session).watch"})
logger.Debugf("")
var (
resp *api.AssignmentsMessage
- 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.MarshalToSizedBuffer
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func (m *Cluster) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
- 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
Function init
has 97 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
register(ObjectStoreConfig{
Table: &memdb.TableSchema{
Name: tableTask,
Indexes: map[string]*memdb.IndexSchema{
Function NewStoreAction
has 96 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewStoreAction(c Event) (StoreAction, error) {
var sa StoreAction
switch v := c.(type) {
case EventCreateNode:
sa.Action = StoreActionKindCreate
Method Secret.Unmarshal
has 32 return statements (exceeds 4 allowed). Open
func (m *Secret) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method SubscriptionMessage.Unmarshal
has 32 return statements (exceeds 4 allowed). Open
func (m *SubscriptionMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method LogSubscriptionOptions.Unmarshal
has 32 return statements (exceeds 4 allowed). Open
func (m *LogSubscriptionOptions) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method TaskSpec.MarshalToSizedBuffer
has 95 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *TaskSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
Method testSuite.TestServiceAddRemovePorts
has 95 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *testSuite) TestServiceAddRemovePorts() {
s := store.NewMemoryStore(nil)
suite.NotNil(s)
defer s.Close()
File testutils.go
has 533 lines of code (exceeds 500 allowed). Consider refactoring. Open
package testutils
import (
"context"
"net"
Method ConstraintEnforcer.rejectNoncompliantTasks
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ce *ConstraintEnforcer) rejectNoncompliantTasks(node *api.Node) {
// If the availability is "drain", the orchestrator will
// shut down all tasks.
// If the availability is "pause", we shouldn't touch
// the tasks on this node.
Method AssignmentsMessage.Unmarshal
has 31 return statements (exceeds 4 allowed). Open
func (m *AssignmentsMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method RaftMember.Unmarshal
has 31 return statements (exceeds 4 allowed). Open
func (m *RaftMember) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Updater.worker
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (u *Updater) worker(ctx context.Context, queue <-chan orchestrator.Slot, updateConfig *api.UpdateConfig) {
for slot := range queue {
// Do we have a task with the new spec in desired state = RUNNING?
// If so, all we have to do to complete the update is remove the
// other tasks. Or if we have a task with the new spec that has
- 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 TLSRenewer.Start
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (t *TLSRenewer) Start(ctx context.Context) <-chan CertificateUpdate {
updates := make(chan CertificateUpdate)
go func() {
var (
- 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
Function validateCAConfig
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func validateCAConfig(ctx context.Context, securityConfig *ca.SecurityConfig, cluster *api.Cluster) (*api.RootCA, error) {
newConfig := cluster.Spec.CAConfig.Copy()
newConfig.SigningCACert = ca.NormalizePEMs(newConfig.SigningCACert) // ensure this is normalized before we use it
if len(newConfig.SigningCAKey) > 0 && len(newConfig.SigningCACert) == 0 {
- 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"