Showing 525 of 525 total issues

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

func (manager *MemoryVehicleJourneys) FindByLineId(id LineId) (vehicleJourneys []*VehicleJourney) {
    manager.mutex.RLock()

    ids, _ := manager.byLine.Find(ModelId(id))

Severity: Major
Found in model/vehicle_journey.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/stop_visit.go on lines 414..426

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 *MemoryStopAreas) FindByReferentId(id StopAreaId) (stopAreas []*StopArea) {
    manager.mutex.RLock()

    ids, _ := manager.byReferent.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 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

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

func (manager *MemoryStopVisits) FindByVehicleJourneyId(id VehicleJourneyId) (stopVisits []*StopVisit) {
    manager.mutex.RLock()

    ids, _ := manager.byVehicleJourney.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 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 2 locations. Consider refactoring.
Open

        notify := siri.SIRINotifySituationExchange{
            Address:                   sxb.connector.Partner().Address(),
            ProducerRef:               sxb.connector.Partner().ProducerRef(),
            ResponseMessageIdentifier: sxb.connector.Partner().NewResponseMessageIdentifier(),
            SubscriberRef:             sub.SubscriberRef,
Severity: Major
Found in core/situation_exchange_broadcaster.go and 1 other location - About 1 hr to fix
core/general_message_broadcaster.go on lines 103..112

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

        notify := siri.SIRINotifyGeneralMessage{
            Address:                   gmb.connector.Partner().Address(),
            ProducerRef:               gmb.connector.Partner().ProducerRef(),
            ResponseMessageIdentifier: gmb.connector.Partner().NewResponseMessageIdentifier(),
            SubscriberRef:             sub.SubscriberRef,
Severity: Major
Found in core/general_message_broadcaster.go and 1 other location - About 1 hr to fix
core/situation_exchange_broadcaster.go on lines 105..114

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

func (sva *StopVisitArchiver) setDepartureTimeEventFromKind(sv *StopVisit, kind StopVisitScheduleType) bigquery.NullTimestamp {
    t := bigquery.NullTimestamp{}
    departureTime := sv.Schedules.DepartureTimeFromKind([]StopVisitScheduleType{kind})
    if departureTime == (time.Time{}) {
        t.Valid = false
Severity: Minor
Found in model/stop_visit_archiver.go and 1 other location - About 1 hr to fix
model/stop_visit_archiver.go on lines 100..111

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

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 (sva *StopVisitArchiver) setArrivalTimeEventFromKind(sv *StopVisit, kind StopVisitScheduleType) bigquery.NullTimestamp {
    t := bigquery.NullTimestamp{}
    arrivalTime := sv.Schedules.ArrivalTimeFromKind([]StopVisitScheduleType{kind})
    if arrivalTime == (time.Time{}) {
        t.Valid = false
Severity: Minor
Found in model/stop_visit_archiver.go and 1 other location - About 1 hr to fix
model/stop_visit_archiver.go on lines 113..124

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

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 (subscriber *SituationExchangeSubscriber) run() {
    c := subscriber.Clock().After(5 * time.Second)

    for {
        select {
Severity: Major
Found in core/siri_situation_exchange_subscriber.go and 4 other locations - About 55 mins to fix
core/siri_estimated_timetable_subscriber.go on lines 46..61
core/siri_general_message_subscriber.go on lines 67..82
core/siri_stop_monitoring_subscriber.go on lines 66..81
core/siri_vehicle_monitoring_subscriber.go on lines 67..82

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

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 (subscriber *VehicleMonitoringSubscriber) run() {
    c := subscriber.Clock().After(5 * time.Second)

    for {
        select {
Severity: Major
Found in core/siri_vehicle_monitoring_subscriber.go and 4 other locations - About 55 mins to fix
core/siri_estimated_timetable_subscriber.go on lines 46..61
core/siri_general_message_subscriber.go on lines 67..82
core/siri_situation_exchange_subscriber.go on lines 44..59
core/siri_stop_monitoring_subscriber.go on lines 66..81

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

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 (subscriber *StopMonitoringSubscriber) run() {
    c := subscriber.Clock().After(5 * time.Second)

    for {
        select {
Severity: Major
Found in core/siri_stop_monitoring_subscriber.go and 4 other locations - About 55 mins to fix
core/siri_estimated_timetable_subscriber.go on lines 46..61
core/siri_general_message_subscriber.go on lines 67..82
core/siri_situation_exchange_subscriber.go on lines 44..59
core/siri_vehicle_monitoring_subscriber.go on lines 67..82

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

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 (subscriber *EstimatedTimetableSubscriber) run() {
    c := subscriber.Clock().After(5 * time.Second)

    for {
        select {
Severity: Major
Found in core/siri_estimated_timetable_subscriber.go and 4 other locations - About 55 mins to fix
core/siri_general_message_subscriber.go on lines 67..82
core/siri_situation_exchange_subscriber.go on lines 44..59
core/siri_stop_monitoring_subscriber.go on lines 66..81
core/siri_vehicle_monitoring_subscriber.go on lines 67..82

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

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 (subscriber *GeneralMessageSubscriber) run() {
    c := subscriber.Clock().After(5 * time.Second)

    for {
        select {
Severity: Major
Found in core/siri_general_message_subscriber.go and 4 other locations - About 55 mins to fix
core/siri_estimated_timetable_subscriber.go on lines 46..61
core/siri_situation_exchange_subscriber.go on lines 44..59
core/siri_stop_monitoring_subscriber.go on lines 66..81
core/siri_vehicle_monitoring_subscriber.go on lines 67..82

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

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 (connector *SIRILiteStopMonitoringRequestCollector) broadcastNotCollectedEvents(events map[string]*model.StopVisitUpdateEvent, collectedStopVisitCodes []model.Code, t time.Time) {
    for _, stopVisitCode := range collectedStopVisitCodes {
        if _, ok := events[stopVisitCode.Value()]; !ok {
            logger.Log.Debugf("Send StopVisitNotCollectedEvent for %v", stopVisitCode)
            connector.broadcastUpdateEvent(model.NewNotCollectedUpdateEvent(stopVisitCode, t))
Severity: Minor
Found in core/siri_lite_stop_monitoring_request_collector.go and 1 other location - About 55 mins to fix
core/siri_stop_monitoring_request_collector.go on lines 168..175

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

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 (connector *SIRIStopMonitoringRequestCollector) broadcastNotCollectedEvents(events map[string]*model.StopVisitUpdateEvent, collectedStopVisitCodes []model.Code, t time.Time) {
    for _, stopVisitCode := range collectedStopVisitCodes {
        if _, ok := events[stopVisitCode.Value()]; !ok {
            logger.Log.Debugf("Send StopVisitNotCollectedEvent for %v", stopVisitCode)
            connector.broadcastUpdateEvent(model.NewNotCollectedUpdateEvent(stopVisitCode, t))
Severity: Minor
Found in core/siri_stop_monitoring_request_collector.go and 1 other location - About 55 mins to fix
core/siri_lite_stop_monitoring_request_collector.go on lines 131..138

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

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

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

      func (x *TranslatedImage) ProtoReflect() protoreflect.Message {
          mi := &file_gtfs_realtime_proto_msgTypes[12]
          if protoimpl.UnsafeEnabled && x != nil {
              ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
              if ms.LoadMessageInfo() == nil {
      Severity: Major
      Found in gtfs/gtfs-realtime.pb.go and 20 other locations - About 55 mins to fix
      gtfs/gtfs-realtime.pb.go on lines 798..808
      gtfs/gtfs-realtime.pb.go on lines 866..876
      gtfs/gtfs-realtime.pb.go on lines 952..962
      gtfs/gtfs-realtime.pb.go on lines 1112..1122
      gtfs/gtfs-realtime.pb.go on lines 1246..1256
      gtfs/gtfs-realtime.pb.go on lines 1399..1409
      gtfs/gtfs-realtime.pb.go on lines 1533..1543
      gtfs/gtfs-realtime.pb.go on lines 1602..1612
      gtfs/gtfs-realtime.pb.go on lines 1726..1736
      gtfs/gtfs-realtime.pb.go on lines 1818..1828
      gtfs/gtfs-realtime.pb.go on lines 1893..1903
      gtfs/gtfs-realtime.pb.go on lines 1987..1997
      gtfs/gtfs-realtime.pb.go on lines 2111..2121
      gtfs/gtfs-realtime.pb.go on lines 2193..2203
      gtfs/gtfs-realtime.pb.go on lines 2277..2287
      gtfs/gtfs-realtime.pb.go on lines 2402..2412
      gtfs/gtfs-realtime.pb.go on lines 2486..2496
      gtfs/gtfs-realtime.pb.go on lines 2567..2577
      gtfs/gtfs-realtime.pb.go on lines 2648..2658
      gtfs/gtfs-realtime.pb.go on lines 2714..2724

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

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

      func (x *TripUpdate_StopTimeEvent) ProtoReflect() protoreflect.Message {
          mi := &file_gtfs_realtime_proto_msgTypes[14]
          if protoimpl.UnsafeEnabled && x != nil {
              ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
              if ms.LoadMessageInfo() == nil {
      Severity: Major
      Found in gtfs/gtfs-realtime.pb.go and 20 other locations - About 55 mins to fix
      gtfs/gtfs-realtime.pb.go on lines 798..808
      gtfs/gtfs-realtime.pb.go on lines 866..876
      gtfs/gtfs-realtime.pb.go on lines 952..962
      gtfs/gtfs-realtime.pb.go on lines 1112..1122
      gtfs/gtfs-realtime.pb.go on lines 1246..1256
      gtfs/gtfs-realtime.pb.go on lines 1399..1409
      gtfs/gtfs-realtime.pb.go on lines 1533..1543
      gtfs/gtfs-realtime.pb.go on lines 1602..1612
      gtfs/gtfs-realtime.pb.go on lines 1726..1736
      gtfs/gtfs-realtime.pb.go on lines 1818..1828
      gtfs/gtfs-realtime.pb.go on lines 1893..1903
      gtfs/gtfs-realtime.pb.go on lines 1987..1997
      gtfs/gtfs-realtime.pb.go on lines 2047..2057
      gtfs/gtfs-realtime.pb.go on lines 2111..2121
      gtfs/gtfs-realtime.pb.go on lines 2277..2287
      gtfs/gtfs-realtime.pb.go on lines 2402..2412
      gtfs/gtfs-realtime.pb.go on lines 2486..2496
      gtfs/gtfs-realtime.pb.go on lines 2567..2577
      gtfs/gtfs-realtime.pb.go on lines 2648..2658
      gtfs/gtfs-realtime.pb.go on lines 2714..2724

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

      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