Showing 525 of 525 total issues

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

          Method SIRISituationExchangeRequestBroadcaster.buildSituation has 87 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (connector *SIRISituationExchangeRequestBroadcaster) buildSituation(delivery *siri.SIRISituationExchangeDelivery, situation model.Situation) {
              if !connector.canBroadcast(situation) {
                  return
              }
          
          
          Severity: Major
          Found in core/siri_situation_exchange_request_broadcaster.go - About 2 hrs to fix

            File stop_visit.go has 520 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package model
            
            import (
                "encoding/json"
                "fmt"
            Severity: Minor
            Found in model/stop_visit.go - About 2 hrs to fix

              Method BroadcastStopMonitoringBuilder.BuildMonitoredStopVisit has 86 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (builder *BroadcastStopMonitoringBuilder) BuildMonitoredStopVisit(stopVisit *model.StopVisit) *siri.SIRIMonitoredStopVisit {
                  stopPointRef, stopPointRefCode, ok := builder.stopPointRef(stopVisit.StopAreaId)
                  if !ok {
                      logger.Log.Printf("Ignore StopVisit %v without StopArea or with StopArea without correct Code", stopVisit.Id())
                      return nil
              Severity: Major
              Found in core/broadcast_stop_monitoring_builder.go - About 2 hrs to fix

                Method TripUpdatesBroadcaster.handleGtfs has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
                Open

                func (connector *TripUpdatesBroadcaster) handleGtfs() (entities []*gtfs.FeedEntity, err error) {
                    stopVisits := connector.partner.Model().StopVisits().FindAllAfter(connector.Clock().Now().Add(PAST_STOP_VISITS_MAX_TIME))
                    linesCode := make(map[model.VehicleJourneyId]model.Code)
                    feedEntities := make(map[model.VehicleJourneyId]*gtfs.FeedEntity)
                
                
                Severity: Minor
                Found in core/gtfs_rt_trip_updates_broadcaster.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 SMBroadcaster.prepareSIRIStopMonitoringNotify has a Cognitive Complexity of 33 (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 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

                MemoryStopVisits has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type MemoryStopVisits struct {
                    uuid.UUIDConsumer
                    clock.ClockConsumer
                
                    model Model
                Severity: Minor
                Found in model/stop_visit.go - About 2 hrs to fix

                  MemoryModel has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type MemoryModel struct {
                      lines               *MemoryLines
                      vehicles            *MemoryVehicles
                      stopAreas           *MemoryStopAreas
                      stopVisits          *MemoryStopVisits
                  Severity: Minor
                  Found in model/model_interface.go - About 2 hrs to fix

                    Method TripUpdatesBroadcaster.handleGtfs has 83 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (connector *TripUpdatesBroadcaster) handleGtfs() (entities []*gtfs.FeedEntity, err error) {
                        stopVisits := connector.partner.Model().StopVisits().FindAllAfter(connector.Clock().Now().Add(PAST_STOP_VISITS_MAX_TIME))
                        linesCode := make(map[model.VehicleJourneyId]model.Code)
                        feedEntities := make(map[model.VehicleJourneyId]*gtfs.FeedEntity)
                    
                    
                    Severity: Major
                    Found in core/gtfs_rt_trip_updates_broadcaster.go - About 2 hrs to fix

                      File load_from_csv.go has 512 lines of code (exceeds 500 allowed). Consider refactoring.
                      Open

                      package model
                      
                      import (
                          "encoding/csv"
                          "fmt"
                      Severity: Minor
                      Found in model/load_from_csv.go - About 2 hrs to fix

                        Similar blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func (loader *Loader) insertOperators() {
                            if len(loader.operators) == 0 {
                                return
                            }
                        
                        
                        Severity: Major
                        Found in model/load_from_csv.go and 4 other locations - About 2 hrs to fix
                        model/load_from_csv.go on lines 325..349
                        model/load_from_csv.go on lines 411..434
                        model/load_from_csv.go on lines 476..500
                        model/load_from_csv.go on lines 549..572

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 204.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func (loader *Loader) insertStopAreas() {
                            if len(loader.stopAreas) == 0 {
                                return
                            }
                        
                        
                        Severity: Major
                        Found in model/load_from_csv.go and 4 other locations - About 2 hrs to fix
                        model/load_from_csv.go on lines 220..243
                        model/load_from_csv.go on lines 411..434
                        model/load_from_csv.go on lines 476..500
                        model/load_from_csv.go on lines 549..572

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 204.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func (loader *Loader) insertStopVisits() {
                            if len(loader.stopVisits) == 0 {
                                return
                            }
                        
                        
                        Severity: Major
                        Found in model/load_from_csv.go and 4 other locations - About 2 hrs to fix
                        model/load_from_csv.go on lines 220..243
                        model/load_from_csv.go on lines 325..349
                        model/load_from_csv.go on lines 411..434
                        model/load_from_csv.go on lines 476..500

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 204.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func (loader *Loader) insertLines() {
                            if len(loader.lines) == 0 {
                                return
                            }
                        
                        
                        Severity: Major
                        Found in model/load_from_csv.go and 4 other locations - About 2 hrs to fix
                        model/load_from_csv.go on lines 220..243
                        model/load_from_csv.go on lines 325..349
                        model/load_from_csv.go on lines 476..500
                        model/load_from_csv.go on lines 549..572

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 204.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 5 locations. Consider refactoring.
                        Open

                        func (loader *Loader) insertVehicleJourneys() {
                            if len(loader.vehicleJourneys) == 0 {
                                return
                            }
                        
                        
                        Severity: Major
                        Found in model/load_from_csv.go and 4 other locations - About 2 hrs to fix
                        model/load_from_csv.go on lines 220..243
                        model/load_from_csv.go on lines 325..349
                        model/load_from_csv.go on lines 411..434
                        model/load_from_csv.go on lines 549..572

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 204.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        File stop_monitoring_response.go has 508 lines of code (exceeds 500 allowed). Consider refactoring.
                        Open

                        package sxml
                        
                        import (
                            "time"
                        
                        
                        Severity: Minor
                        Found in siri/sxml/stop_monitoring_response.go - About 2 hrs to fix

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          func (builder *BroadcastStopMonitoringBuilder) stopPointRef(stopAreaId model.StopAreaId) (*model.StopArea, string, bool) {
                              stopPointRef, ok := builder.partner.Model().StopAreas().Find(stopAreaId)
                              if !ok {
                                  return &model.StopArea{}, "", false
                              }
                          Severity: Major
                          Found in core/broadcast_stop_monitoring_builder.go and 1 other location - About 2 hrs to fix
                          core/broadcast_stop_monitoring_builder.go on lines 232..249

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 200.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language