Showing 134 of 525 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

    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 88 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 818 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

            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

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

              package model
              
              import (
                  "fmt"
              )
              Severity: Major
              Found in model/situation_attributes.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

                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

                  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

                    Method SIRIEstimatedTimetableRequestBroadcaster.getEstimatedTimetableDelivery has a Cognitive Complexity of 55 (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 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

                    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

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

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

                      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

                      Function main has a Cognitive Complexity of 45 (exceeds 20 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: Minor
                      Found in ara.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 MemoryStopAreas.Load has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (manager *MemoryStopAreas) Load(referentialSlug string) error {
                          var selectStopAreas []SelectStopArea
                          modelName := manager.model.Date()
                      
                          sqlQuery := fmt.Sprintf("select * from stop_areas where referential_slug = '%s' and model_name = '%s'", referentialSlug, modelName.String())
                      Severity: Minor
                      Found in model/stop_area.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 ETTBroadcaster.prepareSIRIEstimatedTimetable has 119 lines of code (exceeds 50 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: Major
                      Found in core/estimated_timetable_broadcaster.go - About 3 hrs to fix

                        Method SIRIEstimatedTimetableRequestBroadcaster.getEstimatedTimetableDelivery has 114 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

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