Showing 146 of 546 total issues

File gtfs-realtime.pb.go has 2670 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Copyright 2015 The GTFS Specifications Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Major
Found in gtfs/gtfs-realtime.pb.go - About 6 days to fix

    Method SituationAlertCause.FromString has a Cognitive Complexity of 225 (exceeds 20 allowed). Consider refactoring.
    Open

    func (alertCause *SituationAlertCause) FromString(s string) error {
        switch SituationAlertCause(s) {
        case SituationAlertCauseAccident:
            fallthrough
        case SituationAlertCauseAirraid:
    Severity: Minor
    Found in model/situation_attributes.go - About 4 days to fix

    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

    File situation_attributes.go has 1145 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package model
    
    import (
        "errors"
        "fmt"
    Severity: Major
    Found in model/situation_attributes.go - About 2 days to fix

      Method SituationAlertCause.FromString has 455 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (alertCause *SituationAlertCause) FromString(s string) error {
          switch SituationAlertCause(s) {
          case SituationAlertCauseAccident:
              fallthrough
          case SituationAlertCauseAirraid:
      Severity: Major
      Found in model/situation_attributes.go - About 2 days to fix

        PartnerSettings has 90 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type PartnerSettings struct {
            idgen.IdentifierGenerator
        
            ug func() uuid.UUIDGenerator
        
        
        Severity: Major
        Found in core/settings/partner_settings.go - About 1 day to fix

          Function file_gtfs_realtime_proto_init has 318 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func file_gtfs_realtime_proto_init() {
              if File_gtfs_realtime_proto != nil {
                  return
              }
              if !protoimpl.UnsafeEnabled {
          Severity: Major
          Found in gtfs/gtfs-realtime.pb.go - About 1 day to fix

            File partner.go has 823 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package core
            
            import (
                "encoding/json"
                "errors"
            Severity: Major
            Found in core/partner.go - About 1 day to fix

              File situation.go has 789 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package model
              
              import (
                  "encoding/json"
                  "errors"
              Severity: Major
              Found in model/situation.go - About 1 day to fix

                Partner has 59 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type Partner struct {
                    uuid.UUIDConsumer
                    *s.PartnerSettings
                
                    mutex *sync.RWMutex
                Severity: Major
                Found in core/partner.go - About 1 day to fix

                  Method ETTBroadcaster.prepareSIRIEstimatedTimetable has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (ett *ETTBroadcaster) prepareSIRIEstimatedTimetable() {
                      ett.connector.mutex.Lock()
                  
                      events := ett.connector.toBroadcast
                      ett.connector.toBroadcast = make(map[SubscriptionId][]model.StopVisitId)
                  Severity: Minor
                  Found in core/estimated_timetable_broadcaster.go - About 1 day to fix

                  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

                  File situation_exchange_reponse.go has 749 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  package sxml
                  
                  import (
                      "fmt"
                      "strings"
                  Severity: Minor
                  Found in siri/sxml/situation_exchange_reponse.go - About 1 day to fix

                    XMLMonitoredVehicleJourney has 55 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type XMLMonitoredVehicleJourney struct {
                        XMLCall
                    
                        datedVehicleJourneyRef string
                        lineRef                string
                    Severity: Major
                    Found in siri/sxml/stop_monitoring_response.go - About 7 hrs to fix

                      Function file_gtfs_realtime_proto_init has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func file_gtfs_realtime_proto_init() {
                          if File_gtfs_realtime_proto != nil {
                              return
                          }
                          if !protoimpl.UnsafeEnabled {
                      Severity: Minor
                      Found in gtfs/gtfs-realtime.pb.go - About 7 hrs to fix

                      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 SIRIEstimatedTimetableRequestBroadcaster.getEstimatedTimetableDelivery has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (connector *SIRIEstimatedTimetableRequestBroadcaster) getEstimatedTimetableDelivery(request *sxml.XMLEstimatedTimetableRequest) siri.SIRIEstimatedTimetableDelivery {
                          currentTime := connector.Clock().Now()
                      
                          delivery := siri.SIRIEstimatedTimetableDelivery{
                              RequestMessageRef:  request.MessageIdentifier(),
                      Severity: Minor
                      Found in core/siri_estimated_timetable_request_broadcaster.go - About 7 hrs to fix

                      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 main has 180 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func main() {
                          cpuProfile := flag.String("cpuprofile", "", "Write cpu profile to file")
                          memProfile := flag.String("memprofile", "", "Write memory profile to this file")
                      
                          uuidPtr := flag.Bool("testuuid", false, "Use the test uuid generator")
                      Severity: Major
                      Found in ara.go - About 6 hrs to fix

                        File partner_settings.go has 672 lines of code (exceeds 500 allowed). Consider refactoring.
                        Open

                        package settings
                        
                        import (
                            "fmt"
                            "regexp"
                        Severity: Minor
                        Found in core/settings/partner_settings.go - About 6 hrs to fix

                          Function deepValueEqual has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool) bool {
                              if !v1.IsValid() || !v2.IsValid() {
                                  return v1.IsValid() == v2.IsValid()
                              }
                              if v1.Type() != v2.Type() {
                          Severity: Minor
                          Found in model/diff.go - About 6 hrs to fix

                          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 VMBroadcaster.prepareSIRIVehicleMonitoring has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (vm *VMBroadcaster) prepareSIRIVehicleMonitoring() {
                              vm.connector.mutex.Lock()
                              defer vm.connector.mutex.Unlock()
                          
                              events := vm.connector.toBroadcast
                          Severity: Minor
                          Found in core/vehicle_monitoring_broadcaster.go - About 5 hrs to fix

                          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 SituationCondition.FromString has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (condition *SituationCondition) FromString(c string) error {
                              switch SituationCondition(c) {
                              case SituationConditionAdditionalRide:
                                  fallthrough
                              case SituationConditionAdditionalService:
                          Severity: Minor
                          Found in model/situation_attributes.go - About 4 hrs to fix

                          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 PTTBroadcaster.prepareSIRIProductionTimetable has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (ptt *PTTBroadcaster) prepareSIRIProductionTimetable() {
                              ptt.connector.mutex.Lock()
                          
                              events := ptt.connector.toBroadcast
                              ptt.connector.toBroadcast = make(map[SubscriptionId][]model.StopVisitId)
                          Severity: Minor
                          Found in core/production_timetable_broadcaster.go - About 4 hrs to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language