Showing 525 of 525 total issues

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

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

func (handler *PushHandler) logError(m *audit.BigQueryMessage, startTime time.Time, format string, values ...interface{}) {
    m.ProcessingTime = handler.referential.Clock().Since(startTime).Seconds()
    m.Status = "Error"
    errorString := fmt.Sprintf(format, values...)

Severity: Major
Found in api/push_handler.go and 2 other locations - About 1 hr to fix
api/graphql_handler.go on lines 93..100
api/gtfs_handler.go on lines 141..148

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 135.

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 3 locations. Consider refactoring.
Open

func (handler *GraphqlHandler) logError(m *audit.BigQueryMessage, startTime time.Time, format string, values ...interface{}) {
    m.ProcessingTime = handler.referential.Clock().Since(startTime).Seconds()
    m.Status = "Error"
    errorString := fmt.Sprintf(format, values...)

Severity: Major
Found in api/graphql_handler.go and 2 other locations - About 1 hr to fix
api/gtfs_handler.go on lines 141..148
api/push_handler.go on lines 115..122

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 135.

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 3 locations. Consider refactoring.
Open

func (handler *GtfsHandler) logError(m *audit.BigQueryMessage, startTime time.Time, format string, values ...interface{}) {
    m.ProcessingTime = handler.referential.Clock().Since(startTime).Seconds()
    m.Status = "Error"
    errorString := fmt.Sprintf(format, values...)

Severity: Major
Found in api/gtfs_handler.go and 2 other locations - About 1 hr to fix
api/graphql_handler.go on lines 93..100
api/push_handler.go on lines 115..122

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 135.

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

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

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

    func newSIRIVehicleMonitoringSubscriptionBroadcaster(partner *Partner) *SIRIVehicleMonitoringSubscriptionBroadcaster {
        connector := &SIRIVehicleMonitoringSubscriptionBroadcaster{}
        connector.remoteCodeSpace = partner.RemoteCodeSpace(SIRI_VEHICLE_MONITORING_SUBSCRIPTION_BROADCASTER)
        connector.vjRemoteCodeSpaces = partner.VehicleJourneyRemoteCodeSpaceWithFallback(SIRI_VEHICLE_MONITORING_SUBSCRIPTION_BROADCASTER)
        connector.partner = partner
    Severity: Major
    Found in core/siri_vehicle_monitoring_subscription_broadcaster.go and 1 other location - About 1 hr to fix
    core/siri_estimated_timetable_subscription_broadcaster.go on lines 42..52

    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 134.

    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 2 locations. Consider refactoring.
    Open

    func newSIRIEstimatedTimetableSubscriptionBroadcaster(partner *Partner) *SIRIEstimatedTimetableSubscriptionBroadcaster {
        connector := &SIRIEstimatedTimetableSubscriptionBroadcaster{}
        connector.remoteCodeSpace = partner.RemoteCodeSpace(SIRI_ESTIMATED_TIMETABLE_SUBSCRIPTION_BROADCASTER)
        connector.vjRemoteCodeSpaces = partner.VehicleJourneyRemoteCodeSpaceWithFallback(SIRI_ESTIMATED_TIMETABLE_SUBSCRIPTION_BROADCASTER)
        connector.partner = partner
    Severity: Major
    Found in core/siri_estimated_timetable_subscription_broadcaster.go and 1 other location - About 1 hr to fix
    core/siri_vehicle_monitoring_subscription_broadcaster.go on lines 41..51

    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 134.

    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 2 locations. Consider refactoring.
    Open

        if stopVisit.DepartureStatus != model.STOP_VISIT_DEPARTURE_CANCELLED && builder.StopVisitTypes != "arrivals" {
            monitoredStopVisit.AimedDepartureTime = stopVisit.Schedules.Schedule(model.STOP_VISIT_SCHEDULE_AIMED).DepartureTime()
            monitoredStopVisit.ExpectedDepartureTime = stopVisit.Schedules.Schedule(model.STOP_VISIT_SCHEDULE_EXPECTED).DepartureTime()
            if monitoredStopVisit.Monitored {
                monitoredStopVisit.ActualDepartureTime = stopVisit.Schedules.Schedule(model.STOP_VISIT_SCHEDULE_ACTUAL).DepartureTime()
    Severity: Major
    Found in core/broadcast_stop_monitoring_builder.go and 1 other location - About 1 hr to fix
    core/broadcast_stop_monitoring_builder.go on lines 140..146

    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 133.

    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 2 locations. Consider refactoring.
    Open

        if stopVisit.ArrivalStatus != model.STOP_VISIT_ARRIVAL_CANCELLED && builder.StopVisitTypes != "departures" {
            monitoredStopVisit.AimedArrivalTime = stopVisit.Schedules.Schedule(model.STOP_VISIT_SCHEDULE_AIMED).ArrivalTime()
            monitoredStopVisit.ExpectedArrivalTime = stopVisit.Schedules.Schedule(model.STOP_VISIT_SCHEDULE_EXPECTED).ArrivalTime()
            if monitoredStopVisit.Monitored {
                monitoredStopVisit.ActualArrivalTime = stopVisit.Schedules.Schedule(model.STOP_VISIT_SCHEDULE_ACTUAL).ArrivalTime()
    Severity: Major
    Found in core/broadcast_stop_monitoring_builder.go and 1 other location - About 1 hr to fix
    core/broadcast_stop_monitoring_builder.go on lines 148..154

    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 133.

    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

    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 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 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

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

            func (response *XMLSubscriptionResponse) ResponseStatus() []*XMLResponseStatus {
                if len(response.responseStatus) == 0 {
                    nodes := response.findNodes("ResponseStatus")
                    if nodes == nil {
                        return response.responseStatus
            Severity: Major
            Found in siri/sxml/subscription_response.go and 3 other locations - About 1 hr to fix
            siri/sxml/siri_service_request.go on lines 31..44
            siri/sxml/siri_service_request.go on lines 46..59
            siri/sxml/siri_service_request.go on lines 61..74

            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 131.

            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 4 locations. Consider refactoring.
            Open

            func (request *XMLSiriServiceRequest) GeneralMessageRequests() []*XMLGeneralMessageRequest {
                if len(request.generalMessageRequests) == 0 {
                    nodes := request.findNodes("GeneralMessageRequest")
                    if nodes == nil {
                        return request.generalMessageRequests
            Severity: Major
            Found in siri/sxml/siri_service_request.go and 3 other locations - About 1 hr to fix
            siri/sxml/siri_service_request.go on lines 31..44
            siri/sxml/siri_service_request.go on lines 61..74
            siri/sxml/subscription_response.go on lines 45..58

            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 131.

            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 4 locations. Consider refactoring.
            Open

            func (request *XMLSiriServiceRequest) EstimatedTimetableRequests() []*XMLEstimatedTimetableRequest {
                if len(request.estimatedTimetableRequests) == 0 {
                    nodes := request.findNodes("EstimatedTimetableRequest")
                    if nodes == nil {
                        return request.estimatedTimetableRequests
            Severity: Major
            Found in siri/sxml/siri_service_request.go and 3 other locations - About 1 hr to fix
            siri/sxml/siri_service_request.go on lines 31..44
            siri/sxml/siri_service_request.go on lines 46..59
            siri/sxml/subscription_response.go on lines 45..58

            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 131.

            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 4 locations. Consider refactoring.
            Open

            func (request *XMLSiriServiceRequest) StopMonitoringRequests() []*XMLStopMonitoringRequest {
                if len(request.stopMonitoringRequests) == 0 {
                    nodes := request.findNodes("StopMonitoringRequest")
                    if nodes == nil {
                        return request.stopMonitoringRequests
            Severity: Major
            Found in siri/sxml/siri_service_request.go and 3 other locations - About 1 hr to fix
            siri/sxml/siri_service_request.go on lines 46..59
            siri/sxml/siri_service_request.go on lines 61..74
            siri/sxml/subscription_response.go on lines 45..58

            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 131.

            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 6 locations. Consider refactoring.
            Open

            func (manager *MemoryStopAreas) FindByParentId(id StopAreaId) (stopAreas []*StopArea) {
                manager.mutex.RLock()
            
                ids, _ := manager.byParent.Find(ModelId(id))
            
            
            Severity: Major
            Found in model/stop_area.go and 5 other locations - About 1 hr to fix
            model/lines.go on lines 227..239
            model/stop_area.go on lines 321..333
            model/stop_visit.go on lines 352..364
            model/stop_visit.go on lines 414..426
            model/vehicle_journey.go on lines 241..253

            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 130.

            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 6 locations. Consider refactoring.
            Open

            func (manager *MemoryStopVisits) FindByStopAreaId(id StopAreaId) (stopVisits []*StopVisit) {
                manager.mutex.RLock()
            
                ids, _ := manager.byStopArea.Find(ModelId(id))
            
            
            Severity: Major
            Found in model/stop_visit.go and 5 other locations - About 1 hr to fix
            model/lines.go on lines 227..239
            model/stop_area.go on lines 321..333
            model/stop_area.go on lines 335..347
            model/stop_visit.go on lines 352..364
            model/vehicle_journey.go on lines 241..253

            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 130.

            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 6 locations. Consider refactoring.
            Open

            func (manager *MemoryLines) FindByReferentId(id LineId) (lines []*Line) {
                manager.mutex.RLock()
            
                ids, _ := manager.byReferent.Find(ModelId(id))
            
            
            Severity: Major
            Found in model/lines.go and 5 other locations - About 1 hr to fix
            model/stop_area.go on lines 321..333
            model/stop_area.go on lines 335..347
            model/stop_visit.go on lines 352..364
            model/stop_visit.go on lines 414..426
            model/vehicle_journey.go on lines 241..253

            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 130.

            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