Showing 134 of 525 total issues

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

func (subscriber *ETTSubscriber) prepareSIRIEstimatedTimetableSubscriptionRequest() {
    subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(EstimatedTimetableCollect)
    if len(subscriptions) == 0 {
        logger.Log.Debugf("EstimatedTimetableSubscriber visit without EstimatedTimetableCollect subscriptions")
        return
Severity: Major
Found in core/siri_estimated_timetable_subscriber.go - About 3 hrs to fix

    Method SIRIHandler.serve has 108 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (handler *SIRIHandler) serve(response http.ResponseWriter, request *http.Request) {
        response.Header().Set("Content-Type", "text/xml; charset=utf-8")
    
        m := &audit.BigQueryMessage{
            Protocol:    "siri",
    Severity: Major
    Found in api/siri_handler.go - About 3 hrs to fix

      Method PTTBroadcaster.prepareSIRIProductionTimetable has 107 lines of code (exceeds 50 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: Major
      Found in core/production_timetable_broadcaster.go - About 3 hrs to fix

        Method SIRISituationExchangeRequestBroadcaster.buildSituation has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
        Open

        func (connector *SIRISituationExchangeRequestBroadcaster) buildSituation(delivery *siri.SIRISituationExchangeDelivery, situation model.Situation) {
            if !connector.canBroadcast(situation) {
                return
            }
        
        
        Severity: Minor
        Found in core/siri_situation_exchange_request_broadcaster.go - About 3 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 BroadcastSituationExchangeBuilder.BuildSituationExchange has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
        Open

        func (builder *BroadcastSituationExchangeBuilder) BuildSituationExchange(situation model.Situation) (situationExchangeDelivery *siri.SIRISituationExchangeDelivery) {
            if !builder.canBroadcast(situation) {
                return nil
            }
        
        
        Severity: Minor
        Found in core/broadcast_situation_exchange_builder.go - About 3 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 38 (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 3 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 SXSubscriber.prepareSIRISituationExchangeSubscriptionRequest has 106 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (subscriber *SXSubscriber) prepareSIRISituationExchangeSubscriptionRequest() {
            subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(SituationExchangeCollect)
            if len(subscriptions) == 0 {
                logger.Log.Debugf("SituationExchangeSubscriber visit without SituationExchangeCollect subscriptions")
                return
        Severity: Major
        Found in core/siri_situation_exchange_subscriber.go - About 3 hrs to fix

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

          func (subscriber *GMSubscriber) prepareSIRIGeneralMessageSubscriptionRequest() {
              subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(GeneralMessageCollect)
              if len(subscriptions) == 0 {
                  logger.Log.Debugf("GeneralMessageSubscriber visit without GeneralMessageCollect subscriptions")
                  return
          Severity: Major
          Found in core/siri_general_message_subscriber.go - About 3 hrs to fix

            Method VMBroadcaster.prepareSIRIVehicleMonitoring has 104 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

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

              Method VMSubscriber.prepareSIRIVehicleMonitoringSubscriptionRequest has 101 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (subscriber *VMSubscriber) prepareSIRIVehicleMonitoringSubscriptionRequest() {
                  subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(VehicleMonitoringCollect)
                  if len(subscriptions) == 0 {
                      logger.Log.Debugf("VehicleMonitoringSubscriber visit without VehicleMonitoringCollect subscriptions")
                      return
              Severity: Major
              Found in core/siri_vehicle_monitoring_subscriber.go - About 3 hrs to fix

                Method BroadcastSituationExchangeBuilder.BuildSituationExchange has 94 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (builder *BroadcastSituationExchangeBuilder) BuildSituationExchange(situation model.Situation) (situationExchangeDelivery *siri.SIRISituationExchangeDelivery) {
                    if !builder.canBroadcast(situation) {
                        return nil
                    }
                
                
                Severity: Major
                Found in core/broadcast_situation_exchange_builder.go - About 2 hrs to fix

                  Method UpdateManager.updateStopVisit has 94 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (manager *UpdateManager) updateStopVisit(event *StopVisitUpdateEvent) {
                      if event.Code.Value() == "" { // Avoid creating a StopVisit with an empty code
                          return
                      }
                  
                  
                  Severity: Major
                  Found in model/update_manager.go - About 2 hrs to fix

                    Method ETTSubscriber.prepareSIRIEstimatedTimetableSubscriptionRequest has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (subscriber *ETTSubscriber) prepareSIRIEstimatedTimetableSubscriptionRequest() {
                        subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(EstimatedTimetableCollect)
                        if len(subscriptions) == 0 {
                            logger.Log.Debugf("EstimatedTimetableSubscriber visit without EstimatedTimetableCollect subscriptions")
                            return
                    Severity: Minor
                    Found in core/siri_estimated_timetable_subscriber.go - About 2 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 MemoryStopVisits.Load has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (manager *MemoryStopVisits) Load(referentialSlug string) error {
                        var selectStopVisits []SelectStopVisit
                        modelName := manager.model.Date()
                    
                        sqlQuery := fmt.Sprintf("select * from stop_visits where referential_slug = '%s' and model_name = '%s'", referentialSlug, modelName.String())
                    Severity: Minor
                    Found in model/stop_visit.go - About 2 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 93 lines of code (exceeds 50 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: Major
                    Found in model/diff.go - About 2 hrs to fix

                      Method SIRIHandler.requestHandler has 93 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (handler *SIRIHandler) requestHandler(envelope *remote.SIRIEnvelope) SIRIRequestHandler {
                          switch envelope.BodyType() {
                          case "CheckStatus":
                              return &SIRICheckStatusRequestHandler{
                                  xmlRequest:  sxml.NewXMLCheckStatusRequest(envelope.Body()),
                      Severity: Major
                      Found in api/siri_handler.go - About 2 hrs to fix

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

                        func (subscriber *SMSubscriber) prepareSIRIStopMonitoringSubscriptionRequest() {
                            subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(StopMonitoringCollect)
                            if len(subscriptions) == 0 {
                                logger.Log.Debugf("StopMonitoringSubscriber visit without StopMonitoringCollect subscriptions")
                                return
                        Severity: Major
                        Found in core/siri_stop_monitoring_subscriber.go - About 2 hrs to fix

                          Function NewConnectorFactory has 90 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func NewConnectorFactory(connectorType string) ConnectorFactory {
                              switch connectorType {
                              case GRAPHQL_SERVER:
                                  return &GraphqlServerFactory{}
                              case PUSH_COLLECTOR:
                          Severity: Major
                          Found in core/connector.go - About 2 hrs to fix

                            SIRIClient has 23 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            type SIRIClient struct {
                                httpClient       *HTTPClient
                                siriEnvelopeType string
                            }
                            Severity: Minor
                            Found in remote/siri_client.go - About 2 hrs to fix

                              Method LiteStopMonitoringUpdateEventBuilder.buildUpdateEvents has 87 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (builder *LiteStopMonitoringUpdateEventBuilder) buildUpdateEvents(StopVisitEvent *slite.MonitoredStopVisit) {
                                  // When Order is not defined, we should ignore the MonitoredStopVisit
                                  // see ARA-1240 "Special cases"
                                  if !StopVisitEvent.HasOrder() {
                                      return
                              Severity: Major
                              Found in core/lite_stop_monitoring_update_event_builder.go - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language