Showing 146 of 546 total issues

Method SIRIStopMonitoringRequestBroadcaster.getStopMonitoringDelivery has 68 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (connector *SIRIStopMonitoringRequestBroadcaster) getStopMonitoringDelivery(request *sxml.XMLStopMonitoringRequest) siri.SIRIStopMonitoringDelivery {
    code := model.NewCode(connector.remoteCodeSpace, request.MonitoringRef())
    stopArea, ok := connector.partner.Model().StopAreas().FindByCode(code)
    if !ok {
        return siri.SIRIStopMonitoringDelivery{
Severity: Minor
Found in core/siri_stop_monitoring_request_broadcaster.go - About 1 hr to fix

    Method SIRIStopPointsDiscoveryRequestBroadcaster.StopAreas has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (connector *SIRIStopPointsDiscoveryRequestBroadcaster) StopAreas(request *sxml.XMLStopPointsDiscoveryRequest, message *audit.BigQueryMessage) (*siri.SIRIStopPointsDiscoveryResponse, error) {
        response := &siri.SIRIStopPointsDiscoveryResponse{
            Status:            true,
            ResponseTimestamp: connector.Clock().Now(),
        }
    Severity: Minor
    Found in core/siri_stop_discovery_request_broadcaster.go - About 1 hr to fix

      Method Loader.handleStopArea has 66 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (loader *Loader) handleStopArea(record []string) error {
          if len(record) != 13 {
              return fmt.Errorf("wrong number of entries, expected 13 got %v", len(record))
          }
      
      
      Severity: Minor
      Found in model/load_from_csv.go - About 1 hr to fix

        Method GMSubscriber.prepareSIRIGeneralMessageSubscriptionRequest has 65 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (subscriber *GMSubscriber) prepareSIRIGeneralMessageSubscriptionRequest() {
            collectSubscriber := NewCollectSubcriber(subscriber.connector, GeneralMessageCollect)
            subscriptionRequests := collectSubscriber.GetSubscriptionRequest()
        
            if len(subscriptionRequests) == 0 {
        Severity: Minor
        Found in core/siri_general_message_subscriber.go - About 1 hr to fix

          Method SIRIStopPointsDiscoveryRequestBroadcaster.StopAreas has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
          Open

          func (connector *SIRIStopPointsDiscoveryRequestBroadcaster) StopAreas(request *sxml.XMLStopPointsDiscoveryRequest, message *audit.BigQueryMessage) (*siri.SIRIStopPointsDiscoveryResponse, error) {
              response := &siri.SIRIStopPointsDiscoveryResponse{
                  Status:            true,
                  ResponseTimestamp: connector.Clock().Now(),
              }
          Severity: Minor
          Found in core/siri_stop_discovery_request_broadcaster.go - About 1 hr 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 MemoryLines.Load has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
          Open

          func (manager *MemoryLines) Load(referentialSlug string) error {
              var selectLines []SelectLine
              modelName := manager.model.Date()
              sqlQuery := fmt.Sprintf("select * from lines where referential_slug = '%s' and model_name = '%s'", referentialSlug, modelName.String())
              _, err := Database.Select(&selectLines, sqlQuery)
          Severity: Minor
          Found in model/lines.go - About 1 hr 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 63 lines of code (exceeds 50 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 1 hr to fix

            Method SXSubscriber.prepareSIRISituationExchangeSubscriptionRequest has 62 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (subscriber *SXSubscriber) prepareSIRISituationExchangeSubscriptionRequest() {
                collectSubscriber := NewCollectSubcriber(subscriber.connector, SituationExchangeCollect)
                subscriptionRequests := collectSubscriber.GetSubscriptionRequest()
            
                if len(subscriptionRequests) == 0 {
            Severity: Minor
            Found in core/siri_situation_exchange_subscriber.go - About 1 hr to fix

              Method GMBroadcaster.prepareSIRIGeneralMessageNotify has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
              Open

              func (gmb *GMBroadcaster) prepareSIRIGeneralMessageNotify() {
                  gmb.connector.mutex.Lock()
              
                  events := gmb.connector.toBroadcast
                  gmb.connector.toBroadcast = make(map[SubscriptionId][]model.SituationId)
              Severity: Minor
              Found in core/general_message_broadcaster.go - About 1 hr 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 VehiclePositionBroadcaster.handleGtfs has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
              Open

              func (connector *VehiclePositionBroadcaster) handleGtfs() (entities []*gtfs.FeedEntity, err error) {
                  vehicles := connector.partner.Model().Vehicles().FindAll()
                  linesCode := make(map[model.VehicleJourneyId]model.Code)
                  trips := make(map[model.VehicleJourneyId]*gtfs.TripDescriptor)
              
              
              Severity: Minor
              Found in core/gtfs_rt_vehicle_positions_broadcaster.go - About 1 hr 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 AffectToProto has 60 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func AffectToProto(a Affect, remoteCodeSpace string, m Model) ([]*gtfs.EntitySelector, *AffectRefs, error) {
                  collectedRefs := &AffectRefs{
                      MonitoringRefs: make(map[string]struct{}),
                      LineRefs:       make(map[string]struct{}),
                  }
              Severity: Minor
              Found in model/situation.go - About 1 hr to fix

                Method SIRISituationExchangeRequestBroadcaster.buildAffectedLine has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (connector *SIRISituationExchangeRequestBroadcaster) buildAffectedLine(affect model.Affect, delivery *siri.SIRISituationExchangeDelivery) (*siri.AffectedLine, bool) {
                    affect, _ = affect.(*model.AffectedLine)
                    line, ok := connector.partner.Model().Lines().Find(model.LineId(affect.GetId()))
                    if !ok {
                        logger.Log.Debugf("Unknown Line %s", affect.GetId())
                Severity: Minor
                Found in core/siri_situation_exchange_request_broadcaster.go - About 1 hr to fix

                  Method StopVisitArchiver.Archive has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (sva *StopVisitArchiver) Archive() {
                      sv := sva.StopVisit
                      sa := sva.StopArea()
                      vj := sva.VehicleJourney()
                      longTermStopVisitEvent := &audit.BigQueryLongTermStopVisitEvent{
                  Severity: Minor
                  Found in model/stop_visit_archiver.go - About 1 hr to fix

                    Method BroadcastSituationExchangeBuilder.buildAffectedLine has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (builder *BroadcastSituationExchangeBuilder) buildAffectedLine(affect model.Affect, delivery *siri.SIRISituationExchangeDelivery) (*siri.AffectedLine, bool) {
                        affect, _ = affect.(*model.AffectedLine)
                        line, ok := builder.partner.Model().Lines().Find(model.LineId(affect.GetId()))
                        if !ok {
                            logger.Log.Debugf("Unknown Line %s", affect.GetId())
                    Severity: Minor
                    Found in core/broadcast_situation_exchange_builder.go - About 1 hr to fix

                      Method SIRIStopMonitoringRequestCollector.RequestStopAreaUpdate has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (connector *SIRIStopMonitoringRequestCollector) RequestStopAreaUpdate(request *StopAreaUpdateRequest) {
                          stopArea, ok := connector.partner.Model().StopAreas().Find(request.StopAreaId())
                          if !ok {
                              logger.Log.Debugf("StopAreaUpdateRequest in StopMonitoringRequestCollector for unknown StopArea %v", request.StopAreaId())
                              return
                      Severity: Minor
                      Found in core/siri_stop_monitoring_request_collector.go - About 1 hr to fix

                        Method SIRISubscriptionRequestDispatcher.CancelSubscription has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (connector *SIRISubscriptionRequestDispatcher) CancelSubscription(r *sxml.XMLDeleteSubscriptionRequest, message *audit.BigQueryMessage) *siri.SIRIDeleteSubscriptionResponse {
                            message.RequestIdentifier = r.MessageIdentifier()
                        
                            currentTime := connector.Clock().Now()
                            resp := &siri.SIRIDeleteSubscriptionResponse{
                        Severity: Minor
                        Found in core/siri_subscription_request_dispatcher.go - About 1 hr to fix

                          Method Loader.Load has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (loader Loader) Load(reader io.Reader) Result {
                              // Config CSV reader
                              csvReader := csv.NewReader(reader)
                              csvReader.Comment = '#'
                              csvReader.FieldsPerRecord = -1
                          Severity: Minor
                          Found in model/load_from_csv.go - About 1 hr to fix

                            Method ETTSubscriber.prepareSIRIEstimatedTimetableSubscriptionRequest has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (subscriber *ETTSubscriber) prepareSIRIEstimatedTimetableSubscriptionRequest() {
                                collectSubscriber := NewCollectSubcriber(subscriber.connector, EstimatedTimetableCollect)
                                subscriptionRequests := collectSubscriber.GetSubscriptionRequest()
                            
                                if len(subscriptionRequests) == 0 {
                            Severity: Minor
                            Found in core/siri_estimated_timetable_subscriber.go - About 1 hr to fix

                              Method SIRISituationExchangeSubscriptionBroadcaster.HandleSubscriptionRequest has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (connector *SIRISituationExchangeSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) []siri.SIRIResponseStatus {
                                  resps := []siri.SIRIResponseStatus{}
                              
                                  var subIds []string
                              
                              
                              Severity: Minor
                              Found in core/siri_situation_exchange_subscription_broadcaster.go - About 1 hr to fix

                                Method SMSubscriber.prepareSIRIStopMonitoringSubscriptionRequest has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (subscriber *SMSubscriber) prepareSIRIStopMonitoringSubscriptionRequest() {
                                    collectSubscriber := NewCollectSubcriber(subscriber.connector, StopMonitoringCollect)
                                    subscriptionRequests := collectSubscriber.GetSubscriptionRequest()
                                
                                    if len(subscriptionRequests) == 0 {
                                Severity: Minor
                                Found in core/siri_stop_monitoring_subscriber.go - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language