Showing 1,820 of 1,820 total issues
Method ResourceReference.Unmarshal
has 18 return statements (exceeds 4 allowed). Open
func (m *ResourceReference) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method TLSAuthorization.Unmarshal
has 18 return statements (exceeds 4 allowed). Open
func (m *TLSAuthorization) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Server.ListTasks
has 18 return statements (exceeds 4 allowed). Open
func (s *Server) ListTasks(ctx context.Context, request *api.ListTasksRequest) (*api.ListTasksResponse, error) {
var (
tasks []*api.Task
err error
)
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (w *worker) Assign(ctx context.Context, assignments []*api.AssignmentChange) error {
w.mu.Lock()
defer w.mu.Unlock()
if w.closed {
- Read upRead up
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 169.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func WatchTaskUpdate(t *testing.T, watch chan events.Event) *api.Task {
for {
select {
case event := <-watch:
if task, ok := event.(api.EventUpdateTask); ok {
- Read upRead up
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 169.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (w *worker) Update(ctx context.Context, assignments []*api.AssignmentChange) error {
w.mu.Lock()
defer w.mu.Unlock()
if w.closed {
- Read upRead up
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 169.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func WatchTaskCreate(t *testing.T, watch chan events.Event) *api.Task {
for {
select {
case event := <-watch:
if task, ok := event.(api.EventCreateTask); ok {
- Read upRead up
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 169.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function parseContainer
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func parseContainer(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
if flags.Changed("image") {
image, err := flags.GetString("image")
if err != nil {
return err
Method HealthCheckResponse.Unmarshal
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *HealthCheckResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Network.MarshalToSizedBuffer
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *Network) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
Method StoreSnapshot.Size
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *StoreSnapshot) Size() (n int) {
if m == nil {
return 0
}
var l int
Method StoreAction.CopyFrom
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *StoreAction) CopyFrom(src interface{}) {
o := src.(*StoreAction)
*m = *o
if o.Target != nil {
Method ReplicatedService.Unmarshal
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *ReplicatedService) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Object.CopyFrom
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *Object) CopyFrom(src interface{}) {
o := src.(*Object)
*m = *o
if o.Object != nil {
Method ResolveAddressRequest.Unmarshal
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *ResolveAddressRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method Updater.updateTask
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (u *Updater) updateTask(ctx context.Context, slot orchestrator.Slot, updated *api.Task, order api.UpdateConfig_UpdateOrder) error {
// Kick off the watch before even creating the updated task. This is in order to avoid missing any event.
taskUpdates, cancel := state.Watch(u.watchQueue, api.EventUpdateTask{
Task: &api.Task{ID: updated.ID},
Checks: []api.TaskCheckFunc{api.TaskCheckID},
Method Orchestrator.reconcileServices
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (g *Orchestrator) reconcileServices(ctx context.Context, serviceIDs []string) {
nodeTasks := make(map[string]map[string][]*api.Task)
g.store.View(func(tx store.ReadTx) {
for _, serviceID := range serviceIDs {
Method testSuite.TestServicePortAllocationIsRepeatable
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *testSuite) TestServicePortAllocationIsRepeatable() {
alloc := func() []*api.PortConfig {
s := store.NewMemoryStore(nil)
suite.NotNil(s)
defer s.Close()
Method Server.UpdateRootCA
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *Server) UpdateRootCA(ctx context.Context, cluster *api.Cluster, reconciler *rootRotationReconciler) error {
s.mu.Lock()
s.joinTokens = cluster.RootCA.JoinTokens.Copy()
s.mu.Unlock()
rCA := cluster.RootCA.Copy()
Method testSuite.TestDeallocateServiceAllocate
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *testSuite) TestDeallocateServiceAllocate() {
s := store.NewMemoryStore(nil)
suite.NotNil(s)
defer s.Close()