Showing 146 of 546 total issues

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

func (connector *SIRIStopMonitoringSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
    var monitoringRefs, subIds []string

    for _, sm := range request.XMLSubscriptionSMEntries() {
        rs := siri.SIRIResponseStatus{
Severity: Minor
Found in core/siri_stop_monitoring_subscription_broadcaster.go - About 1 hr to fix

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

    func (subscriber *VMSubscriber) prepareSIRIVehicleMonitoringSubscriptionRequest() {
        collectSubscriber := NewCollectSubcriber(subscriber.connector, VehicleMonitoringCollect)
        subscriptionRequests := collectSubscriber.GetSubscriptionRequest()
    
        if len(subscriptionRequests) == 0 {
    Severity: Minor
    Found in core/siri_vehicle_monitoring_subscriber.go - About 1 hr to fix

      Method SIRISubscriptionRequestDispatcher.Dispatch has 57 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (connector *SIRISubscriptionRequestDispatcher) Dispatch(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (*siri.SIRISubscriptionResponse, error) {
          response := siri.SIRISubscriptionResponse{
              Address:            connector.Partner().Address(),
              ResponderRef:       connector.Partner().RequestorRef(),
              ResponseTimestamp:  connector.Clock().Now(),
      Severity: Minor
      Found in core/siri_subscription_request_dispatcher.go - About 1 hr to fix

        Method PushHandler.serve has 57 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (handler *PushHandler) serve(response http.ResponseWriter, request *http.Request) {
            // Check if request header is protobuf or return an error
            if request.Header.Get("Content-Type") != "application/x-protobuf" {
                http.Error(response, "Expected application/x-protobuf content", http.StatusUnsupportedMediaType)
                return
        Severity: Minor
        Found in api/push_handler.go - About 1 hr to fix

          Method CollectSubscriber.HandleResponse has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
          Open

          func (cs *CollectSubscriber) HandleResponse(subscriptionRequests map[SubscriptionId]*subscriptionRequest, message *audit.BigQueryMessage, response *sxml.XMLSubscriptionResponse) {
              for _, responseStatus := range response.ResponseStatus() {
                  var subscriptionRequest *subscriptionRequest
                  var ok bool
          
          
          Severity: Minor
          Found in core/siri_collect_subscriber.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 CollectManager.UpdateStopArea has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
          Open

          func (manager *CollectManager) UpdateStopArea(request *StopAreaUpdateRequest) {
              stopArea, ok := manager.referential.Model().StopAreas().Find(request.StopAreaId())
              localLogger := NewStopAreaLogger(manager.referential, stopArea)
          
              if !ok {
          Severity: Minor
          Found in core/collect_manager.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 NewSIRICheckStatusResponse has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              address string,
              producerRef string,
              requestMessageRef string,
              responseMessageIdentifier string,
              status bool,
          Severity: Major
          Found in siri/siri/check_status_response.go - About 1 hr to fix

            Method SMBroadcaster.prepareSIRIStopMonitoringNotify has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
            Open

            func (smb *SMBroadcaster) prepareSIRIStopMonitoringNotify() {
                smb.connector.mutex.Lock()
            
                events := smb.connector.toBroadcast
                smb.connector.toBroadcast = make(map[SubscriptionId][]model.StopVisitId)
            Severity: Minor
            Found in core/stop_monitoring_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 SIRISubscriptionRequestDispatcher.Dispatch has 13 return statements (exceeds 4 allowed).
            Open

            func (connector *SIRISubscriptionRequestDispatcher) Dispatch(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (*siri.SIRISubscriptionResponse, error) {
                response := siri.SIRISubscriptionResponse{
                    Address:            connector.Partner().Address(),
                    ResponderRef:       connector.Partner().RequestorRef(),
                    ResponseTimestamp:  connector.Clock().Now(),
            Severity: Major
            Found in core/siri_subscription_request_dispatcher.go - About 1 hr to fix

              Method GMBroadcaster.prepareSIRIGeneralMessageNotify has 56 lines of code (exceeds 50 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

                Method CollectSubscriber.HandleResponse has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (cs *CollectSubscriber) HandleResponse(subscriptionRequests map[SubscriptionId]*subscriptionRequest, message *audit.BigQueryMessage, response *sxml.XMLSubscriptionResponse) {
                    for _, responseStatus := range response.ResponseStatus() {
                        var subscriptionRequest *subscriptionRequest
                        var ok bool
                
                
                Severity: Minor
                Found in core/siri_collect_subscriber.go - About 1 hr to fix

                  Method SIRIEstimatedTimetableSubscriptionBroadcaster.HandleSubscriptionRequest has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (connector *SIRIEstimatedTimetableSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
                      var lineIds, subIds []string
                  
                      for _, ett := range request.XMLSubscriptionETTEntries() {
                          rs := siri.SIRIResponseStatus{
                  Severity: Minor
                  Found in core/siri_estimated_timetable_subscription_broadcaster.go - About 1 hr to fix

                    Method SIRIProductionTimetableSubscriptionBroadcaster.HandleSubscriptionRequest has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (connector *SIRIProductionTimetableSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
                        var lineIds, subIds []string
                    
                        for _, ptt := range request.XMLSubscriptionPTTEntries() {
                            rs := siri.SIRIResponseStatus{
                    Severity: Minor
                    Found in core/siri_production_timetable_subscription_broadcaster.go - About 1 hr to fix

                      Method SIRIVehicleMonitoringSubscriptionBroadcaster.HandleSubscriptionRequest has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (connector *SIRIVehicleMonitoringSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
                          var lineIds, subIds []string
                      
                          for _, vm := range request.XMLSubscriptionVMEntries() {
                              rs := siri.SIRIResponseStatus{
                      Severity: Minor
                      Found in core/siri_vehicle_monitoring_subscription_broadcaster.go - About 1 hr to fix

                        Method CollectManager.UpdateStopArea has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (manager *CollectManager) UpdateStopArea(request *StopAreaUpdateRequest) {
                            stopArea, ok := manager.referential.Model().StopAreas().Find(request.StopAreaId())
                            localLogger := NewStopAreaLogger(manager.referential, stopArea)
                        
                            if !ok {
                        Severity: Minor
                        Found in core/collect_manager.go - About 1 hr to fix

                          Method CollectManager.requestStopAreaFilteredSituation has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (manager *CollectManager) requestStopAreaFilteredSituation(requestedId string) {
                              stopArea, ok := manager.referential.Model().StopAreas().Find(model.StopAreaId(requestedId))
                              if !ok {
                                  logger.Log.Debugf("Can't find StopArea to request %v", requestedId)
                                  return
                          Severity: Minor
                          Found in core/collect_manager.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 CollectManager.requestStopAreaFilteredSituation has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (manager *CollectManager) requestStopAreaFilteredSituation(requestedId string) {
                              stopArea, ok := manager.referential.Model().StopAreas().Find(model.StopAreaId(requestedId))
                              if !ok {
                                  logger.Log.Debugf("Can't find StopArea to request %v", requestedId)
                                  return
                          Severity: Minor
                          Found in core/collect_manager.go - About 1 hr to fix

                            Method MemoryStopVisits.Load has 51 lines of code (exceeds 50 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 1 hr to fix

                              Method SXBroadcaster.prepareSIRISituationExchangeNotify has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (sxb *SXBroadcaster) prepareSIRISituationExchangeNotify() {
                                  sxb.connector.mutex.Lock()
                              
                                  events := sxb.connector.toBroadcast
                                  sxb.connector.toBroadcast = make(map[SubscriptionId][]model.SituationId)
                              Severity: Minor
                              Found in core/situation_exchange_broadcaster.go - About 1 hr to fix

                                Method SIRILiteStopMonitoringRequestCollector.RequestStopAreaUpdate has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

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