Showing 525 of 525 total issues

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

package api

import (
    "net/http"

Severity: Major
Found in api/siri_stop_monitoring_deliveries_response_handler.go and 1 other location - About 1 day to fix
api/siri_estimated_timetable_deliveries_response_handler.go on lines 1..57

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

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

Partner has 59 methods (exceeds 20 allowed). Consider refactoring.
Open

type Partner struct {
    uuid.UUIDConsumer
    *s.PartnerSettings

    mutex *sync.RWMutex
Severity: Major
Found in core/partner.go - About 1 day to fix

    File situation_attributes.go has 768 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package model
    
    import (
        "fmt"
    )
    Severity: Major
    Found in model/situation_attributes.go - About 1 day to fix

      Method ETTBroadcaster.prepareSIRIEstimatedTimetable has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
      Open

      func (ett *ETTBroadcaster) prepareSIRIEstimatedTimetable() {
          ett.connector.mutex.Lock()
      
          events := ett.connector.toBroadcast
          ett.connector.toBroadcast = make(map[SubscriptionId][]model.StopVisitId)
      Severity: Minor
      Found in core/estimated_timetable_broadcaster.go - About 1 day 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

      XMLMonitoredVehicleJourney has 55 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type XMLMonitoredVehicleJourney struct {
          XMLCall
      
          datedVehicleJourneyRef string
          lineRef                string
      Severity: Major
      Found in siri/sxml/stop_monitoring_response.go - About 7 hrs to fix

        Function file_gtfs_realtime_proto_init has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
        Open

        func file_gtfs_realtime_proto_init() {
            if File_gtfs_realtime_proto != nil {
                return
            }
            if !protoimpl.UnsafeEnabled {
        Severity: Minor
        Found in gtfs/gtfs-realtime.pb.go - About 7 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

        Function main has 180 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func main() {
            cpuProfile := flag.String("cpuprofile", "", "Write cpu profile to file")
            memProfile := flag.String("memprofile", "", "Write memory profile to this file")
        
            uuidPtr := flag.Bool("testuuid", false, "Use the test uuid generator")
        Severity: Major
        Found in ara.go - About 6 hrs to fix

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

          func (connector *SIRIEstimatedTimetableSubscriptionBroadcaster) checkLines(ett *sxml.XMLEstimatedTimetableSubscriptionRequestEntry) (resources []*SubscribedResource, lineIds []string) {
              // check for subscription to all lines
              if len(ett.Lines()) == 0 {
                  var lv []string
                  //find all lines corresponding to the remoteCodeSpace
          Severity: Major
          Found in core/siri_estimated_timetable_subscription_broadcaster.go and 2 other locations - About 6 hrs to fix
          core/siri_production_timetable_subscription_broadcaster.go on lines 135..183
          core/siri_vehicle_monitoring_subscription_broadcaster.go on lines 134..182

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

          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 (connector *SIRIVehicleMonitoringSubscriptionBroadcaster) checkLines(vm *sxml.XMLVehicleMonitoringSubscriptionRequestEntry) (resources []*SubscribedResource, lineIds []string) {
              // check for subscription to all lines
              if len(vm.Lines()) == 0 {
                  var lv []string
                  //find all lines corresponding to the remoteCodeSpace
          Severity: Major
          Found in core/siri_vehicle_monitoring_subscription_broadcaster.go and 2 other locations - About 6 hrs to fix
          core/siri_estimated_timetable_subscription_broadcaster.go on lines 142..190
          core/siri_production_timetable_subscription_broadcaster.go on lines 135..183

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

          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 (connector *SIRIProductionTimetableSubscriptionBroadcaster) checkLines(ptt *sxml.XMLProductionTimetableSubscriptionRequestEntry) (resources []*SubscribedResource, lineIds []string) {
              // check for subscription to all lines
              if len(ptt.Lines()) == 0 {
                  var lv []string
                  //find all lines corresponding to the remoteCodeSpace
          Severity: Major
          Found in core/siri_production_timetable_subscription_broadcaster.go and 2 other locations - About 6 hrs to fix
          core/siri_estimated_timetable_subscription_broadcaster.go on lines 142..190
          core/siri_vehicle_monitoring_subscription_broadcaster.go on lines 134..182

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

          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 SIRIEstimatedTimetableRequestBroadcaster.getEstimatedTimetableDelivery has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
          Open

          func (connector *SIRIEstimatedTimetableRequestBroadcaster) getEstimatedTimetableDelivery(request *sxml.XMLEstimatedTimetableRequest) siri.SIRIEstimatedTimetableDelivery {
              currentTime := connector.Clock().Now()
          
              delivery := siri.SIRIEstimatedTimetableDelivery{
                  RequestMessageRef:  request.MessageIdentifier(),
          Severity: Minor
          Found in core/siri_estimated_timetable_request_broadcaster.go - About 6 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

          Function deepValueEqual has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
          Open

          func deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool) bool {
              if !v1.IsValid() || !v2.IsValid() {
                  return v1.IsValid() == v2.IsValid()
              }
              if v1.Type() != v2.Type() {
          Severity: Minor
          Found in model/diff.go - About 6 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

          File partner_settings.go has 658 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package settings
          
          import (
              "fmt"
              "regexp"
          Severity: Minor
          Found in core/settings/partner_settings.go - About 5 hrs to fix

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

            package siri
            
            import (
                "bytes"
                "fmt"
            Severity: Major
            Found in siri/siri/notify_general_message.go and 2 other locations - About 5 hrs to fix
            siri/siri/notify_estimated_timetable_response.go on lines 1..55
            siri/siri/notify_situation_exchange.go on lines 1..56

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

            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

            package siri
            
            import (
                "bytes"
                "fmt"
            Severity: Major
            Found in siri/siri/notify_estimated_timetable_response.go and 2 other locations - About 5 hrs to fix
            siri/siri/notify_general_message.go on lines 1..56
            siri/siri/notify_situation_exchange.go on lines 1..56

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

            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

            package siri
            
            import (
                "bytes"
                "fmt"
            Severity: Major
            Found in siri/siri/notify_situation_exchange.go and 2 other locations - About 5 hrs to fix
            siri/siri/notify_estimated_timetable_response.go on lines 1..55
            siri/siri/notify_general_message.go on lines 1..56

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

            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 *SIRIProductionTimetableSubscriptionBroadcaster) checkEvent(svId model.StopVisitId) {
                sv, ok := connector.Partner().Model().ScheduledStopVisits().Find(svId)
                if !ok {
                    return
                }
            Severity: Major
            Found in core/siri_production_timetable_subscription_broadcaster.go and 1 other location - About 5 hrs to fix
            core/siri_estimated_timetable_subscription_broadcaster.go on lines 223..262

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

            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 *SIRIEstimatedTimetableSubscriptionBroadcaster) checkEvent(svId model.StopVisitId) {
                sv, ok := connector.Partner().Model().StopVisits().Find(svId)
                if !ok {
                    return
                }
            Severity: Major
            Found in core/siri_estimated_timetable_subscription_broadcaster.go and 1 other location - About 5 hrs to fix
            core/siri_production_timetable_subscription_broadcaster.go on lines 205..245

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

            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 *SIRIStopMonitoringSubscriptionCollector) RequestStopAreaUpdate(request *StopAreaUpdateRequest) {
                stopArea, ok := connector.partner.Model().StopAreas().Find(request.StopAreaId())
                if !ok {
                    logger.Log.Debugf("StopAreaUpdateRequest in StopMonitoring SubscriptionCollector for unknown StopArea %v", request.StopAreaId())
                    return
            Severity: Major
            Found in core/siri_stop_monitoring_subscription_collector.go and 1 other location - About 4 hrs to fix
            core/siri_estimated_timetable_subscription_collector.go on lines 61..99

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

            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 *SIRIEstimatedTimetableSubscriptionCollector) RequestLineUpdate(request *LineUpdateRequest) {
                line, ok := connector.partner.Model().Lines().Find(request.LineId())
                if !ok {
                    logger.Log.Debugf("LineUpdateRequest in EstimatedTimetable SubscriptionCollector for unknown Line %v", request.LineId())
                    return
            Severity: Major
            Found in core/siri_estimated_timetable_subscription_collector.go and 1 other location - About 4 hrs to fix
            core/siri_stop_monitoring_subscription_collector.go on lines 61..98

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

            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