Showing 134 of 525 total issues

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 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 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 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 VMSubscriber.prepareSIRIVehicleMonitoringSubscriptionRequest has a Cognitive Complexity of 25 (exceeds 20 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: Minor
          Found in core/siri_vehicle_monitoring_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 GMSubscriber.prepareSIRIGeneralMessageSubscriptionRequest has a Cognitive Complexity of 25 (exceeds 20 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: Minor
          Found in core/siri_general_message_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.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 SIRIClient.prepareAndSendRequest has 51 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (client *SIRIClient) prepareAndSendRequest(args siriClientArguments) (xml.Node, error) {
                // Wrap the request XML
                buffer := NewSIRIBuffer(client.siriEnvelopeType)
            
                xml, err := args.request.BuildXML(client.siriEnvelopeType)
            Severity: Minor
            Found in remote/siri_client.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

                Method SIRIGeneralMessageSubscriptionBroadcaster.HandleSubscriptionRequest has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (connector *SIRIGeneralMessageSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) []siri.SIRIResponseStatus {
                    resps := []siri.SIRIResponseStatus{}
                
                    var subIds []string
                
                
                Severity: Minor
                Found in core/siri_general_message_subscription_broadcaster.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 SIRILiteClient.prepareAndSendRequest has 9 return statements (exceeds 4 allowed).
                    Open

                    func (c *SIRILiteClient) prepareAndSendRequest(args siriLiteClientArguments) error {
                        dest := args.destination
                    
                        ctx, cncl := context.WithTimeout(context.Background(), getTimeOut(args.requestType))
                        defer cncl()
                    Severity: Major
                    Found in remote/siri_lite_client.go - About 55 mins to fix

                      Method SIRIStopMonitoringSubscriptionBroadcaster.checkStopAreaEvent has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (connector *SIRIStopMonitoringSubscriptionBroadcaster) checkStopAreaEvent(stopArea *model.StopArea) {
                          obj, ok := stopArea.Code(connector.remoteCodeSpace)
                          if !ok {
                              return
                          }
                      Severity: Minor
                      Found in core/siri_stop_monitoring_subscription_broadcaster.go - About 55 mins 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 MemoryReferentials.Load has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (manager *MemoryReferentials) Load() error {
                          selectReferentials := []model.SelectReferential{}
                          _, err := model.Database.Select(&selectReferentials, "select * from referentials")
                          if err != nil {
                              return err
                      Severity: Minor
                      Found in core/referential.go - About 55 mins 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 SIRIClient.prepareAndSendRequest has 9 return statements (exceeds 4 allowed).
                      Open

                      func (client *SIRIClient) prepareAndSendRequest(args siriClientArguments) (xml.Node, error) {
                          // Wrap the request XML
                          buffer := NewSIRIBuffer(client.siriEnvelopeType)
                      
                          xml, err := args.request.BuildXML(client.siriEnvelopeType)
                      Severity: Major
                      Found in remote/siri_client.go - About 55 mins to fix

                        Method BigQueryClient.findOrCreateDataset has 8 return statements (exceeds 4 allowed).
                        Open

                        func (bq *BigQueryClient) findOrCreateDataset() (*bigquery.Dataset, error) {
                            it := bq.client.Datasets(bq.ctx)
                            for {
                                dataset, err := it.Next()
                                if err == iterator.Done {
                        Severity: Major
                        Found in audit/bigquery.go - About 50 mins to fix

                          Method Partner.hasSubscribers has 8 return statements (exceeds 4 allowed).
                          Open

                          func (partner *Partner) hasSubscribers() bool {
                              _, ok := partner.connectors[SIRI_STOP_MONITORING_SUBSCRIPTION_BROADCASTER]
                              if ok {
                                  return true
                              }
                          Severity: Major
                          Found in core/partner.go - About 50 mins to fix

                            Method HTTPClient.GTFSRequest has 8 return statements (exceeds 4 allowed).
                            Open

                            func (c *HTTPClient) GTFSRequest() (*gtfs.FeedMessage, error) {
                                ctx, cncl := context.WithTimeout(context.Background(), 60*time.Second)
                                defer cncl()
                            
                                httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, c.Url, nil)
                            Severity: Major
                            Found in remote/http_client.go - About 50 mins to fix

                              Method PushHandler.serve has 8 return statements (exceeds 4 allowed).
                              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: Major
                              Found in api/push_handler.go - About 50 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language