Showing 525 of 525 total issues

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

func (connector *SIRIStopMonitoringRequestCollector) broadcastUpdateEvents(events *CollectUpdateEvents) {
    if connector.updateSubscriber == nil {
        return
    }
    for _, e := range events.StopAreas {
Severity: Major
Found in core/siri_stop_monitoring_request_collector.go and 2 other locations - About 1 hr to fix
core/siri_estimated_timetable_subscription_collector.go on lines 152..170
core/siri_lite_stop_monitoring_request_collector.go on lines 104..123

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

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 *SIRILiteStopMonitoringRequestCollector) broadcastUpdateEvents(events *CollectUpdateEvents) {

    if connector.updateSubscriber == nil {
        return
    }
Severity: Major
Found in core/siri_lite_stop_monitoring_request_collector.go and 2 other locations - About 1 hr to fix
core/siri_estimated_timetable_subscription_collector.go on lines 152..170
core/siri_stop_monitoring_request_collector.go on lines 142..160

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

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 *SIRIEstimatedTimetableSubscriptionCollector) broadcastUpdateEvents(events *CollectUpdateEvents) {
    if connector.updateSubscriber == nil {
        return
    }
    for _, e := range events.StopAreas {
Severity: Major
Found in core/siri_estimated_timetable_subscription_collector.go and 2 other locations - About 1 hr to fix
core/siri_lite_stop_monitoring_request_collector.go on lines 104..123
core/siri_stop_monitoring_request_collector.go on lines 142..160

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

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 BroadcastSituationExchangeBuilder.buildAffectedLine has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (builder *BroadcastSituationExchangeBuilder) buildAffectedLine(affect model.Affect, ptSituationElement *siri.SIRIPtSituationElement, delivery *siri.SIRISituationExchangeDelivery) (*siri.AffectedLine, bool) {
    affect, _ = affect.(*model.AffectedLine)
    line, ok := builder.partner.Model().Lines().Find(model.LineId(affect.GetId()))
    if !ok {
        logger.Log.Debugf("Unknown Line %s", affect.GetId())
Severity: Minor
Found in core/broadcast_situation_exchange_builder.go - About 1 hr to fix

    Method SIRISituationExchangeRequestBroadcaster.buildAffectedLine has 59 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (connector *SIRISituationExchangeRequestBroadcaster) buildAffectedLine(affect model.Affect, ptSituationElement *siri.SIRIPtSituationElement, delivery *siri.SIRISituationExchangeDelivery) (*siri.AffectedLine, bool) {
        affect, _ = affect.(*model.AffectedLine)
        line, ok := connector.partner.Model().Lines().Find(model.LineId(affect.GetId()))
        if !ok {
            logger.Log.Debugf("Unknown Line %s", affect.GetId())
    Severity: Minor
    Found in core/siri_situation_exchange_request_broadcaster.go - About 1 hr to fix

      Method StopVisitArchiver.Archive has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (sva *StopVisitArchiver) Archive() {
          sv := sva.StopVisit
          sa := sva.StopArea()
          vj := sva.VehicleJourney()
          longTermStopVisitEvent := &audit.BigQueryLongTermStopVisitEvent{
      Severity: Minor
      Found in model/stop_visit_archiver.go - About 1 hr to fix

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

        func (manager *BroadcastManager) ettsbEvent_handler(event model.StopMonitoringBroadcastEvent) {
            connectorTypes := []string{SIRI_ESTIMATED_TIMETABLE_SUBSCRIPTION_BROADCASTER, TEST_ESTIMATED_TIMETABLE_SUBSCRIPTION_BROADCASTER}
            for _, partner := range manager.Referential.Partners().FindAllWithConnector(connectorTypes) {
                connector, ok := partner.Connector(SIRI_ESTIMATED_TIMETABLE_SUBSCRIPTION_BROADCASTER)
                if ok {
        Severity: Major
        Found in core/broadcast_manager.go and 3 other locations - About 1 hr to fix
        core/broadcast_manager.go on lines 82..98
        core/broadcast_manager.go on lines 117..133
        core/broadcast_manager.go on lines 135..151

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

        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

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

            for _, subscription := range subscriptions {
                for _, resource := range subscription.ResourcesByCodeCopy() {
                    if resource.SubscribedAt().IsZero() && resource.RetryCount <= 10 {
                        messageIdentifier := subscriber.connector.Partner().NewMessageIdentifier()
                        logger.Log.Debugf("send request for subscription with id : %v", subscription.id)
        Severity: Major
        Found in core/siri_situation_exchange_subscriber.go and 1 other location - About 1 hr to fix
        core/siri_general_message_subscriber.go on lines 101..113

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

        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 (manager *BroadcastManager) gmsbEvent_handler(event model.SituationBroadcastEvent) {
            connectorTypes := []string{SIRI_GENERAL_MESSAGE_SUBSCRIPTION_BROADCASTER, TEST_GENERAL_MESSAGE_SUBSCRIPTION_BROADCASTER}
            for _, partner := range manager.Referential.Partners().FindAllWithConnector(connectorTypes) {
                connector, ok := partner.Connector(SIRI_GENERAL_MESSAGE_SUBSCRIPTION_BROADCASTER)
                if ok {
        Severity: Major
        Found in core/broadcast_manager.go and 3 other locations - About 1 hr to fix
        core/broadcast_manager.go on lines 82..98
        core/broadcast_manager.go on lines 100..115
        core/broadcast_manager.go on lines 117..133

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

        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

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

            for _, subscription := range subscriptions {
                for _, resource := range subscription.ResourcesByCodeCopy() {
                    if resource.SubscribedAt().IsZero() && resource.RetryCount <= 10 {
                        messageIdentifier := subscriber.connector.Partner().NewMessageIdentifier()
                        logger.Log.Debugf("send request for subscription with id : %v", subscription.id)
        Severity: Major
        Found in core/siri_general_message_subscriber.go and 1 other location - About 1 hr to fix
        core/siri_situation_exchange_subscriber.go on lines 78..90

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

        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 (manager *BroadcastManager) vmEvent_handler(event model.VehicleBroadcastEvent) {
            connectorTypes := []string{SIRI_VEHICLE_MONITORING_SUBSCRIPTION_BROADCASTER, TEST_VEHICLE_MONITORING_SUBSCRIPTION_BROADCASTER}
            for _, partner := range manager.Referential.Partners().FindAllWithConnector(connectorTypes) {
                connector, ok := partner.Connector(SIRI_VEHICLE_MONITORING_SUBSCRIPTION_BROADCASTER)
                if ok {
        Severity: Major
        Found in core/broadcast_manager.go and 3 other locations - About 1 hr to fix
        core/broadcast_manager.go on lines 82..98
        core/broadcast_manager.go on lines 100..115
        core/broadcast_manager.go on lines 135..151

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

        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 (manager *BroadcastManager) smsbEvent_handler(event model.StopMonitoringBroadcastEvent) {
            connectorTypes := []string{SIRI_STOP_MONITORING_SUBSCRIPTION_BROADCASTER, TEST_STOP_MONITORING_SUBSCRIPTION_BROADCASTER}
            for _, partner := range manager.Referential.Partners().FindAllWithConnector(connectorTypes) {
                connector, ok := partner.Connector(SIRI_STOP_MONITORING_SUBSCRIPTION_BROADCASTER)
                if ok {
        Severity: Major
        Found in core/broadcast_manager.go and 3 other locations - About 1 hr to fix
        core/broadcast_manager.go on lines 100..115
        core/broadcast_manager.go on lines 117..133
        core/broadcast_manager.go on lines 135..151

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

        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 SIRISubscriptionRequestDispatcher.CancelSubscription has 58 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (connector *SIRISubscriptionRequestDispatcher) CancelSubscription(r *sxml.XMLDeleteSubscriptionRequest, message *audit.BigQueryMessage) *siri.SIRIDeleteSubscriptionResponse {
            message.RequestIdentifier = r.MessageIdentifier()
        
            currentTime := connector.Clock().Now()
            resp := &siri.SIRIDeleteSubscriptionResponse{
        Severity: Minor
        Found in core/siri_subscription_request_dispatcher.go - About 1 hr to fix

          Method Loader.Load has 58 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (loader Loader) Load(reader io.Reader) Result {
              // Config CSV reader
              csvReader := csv.NewReader(reader)
              csvReader.Comment = '#'
              csvReader.FieldsPerRecord = -1
          Severity: Minor
          Found in model/load_from_csv.go - About 1 hr to fix

            Method SIRIStopMonitoringRequestCollector.RequestStopAreaUpdate has 58 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (connector *SIRIStopMonitoringRequestCollector) RequestStopAreaUpdate(request *StopAreaUpdateRequest) {
                stopArea, ok := connector.partner.Model().StopAreas().Find(request.StopAreaId())
                if !ok {
                    logger.Log.Debugf("StopAreaUpdateRequest in StopMonitoringRequestCollector for unknown StopArea %v", request.StopAreaId())
                    return
            Severity: Minor
            Found in core/siri_stop_monitoring_request_collector.go - About 1 hr to fix

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

              func (connector *SIRIVehicleMonitoringSubscriptionBroadcaster) resolveStopAreaRef(reference model.Reference) string {
                  stopArea, ok := connector.partner.Model().StopAreas().FindByCode(*reference.Code)
                  if ok {
                      obj, ok := stopArea.ReferentOrSelfCode(connector.remoteCodeSpace)
                      if ok {
              Severity: Major
              Found in core/vehicle_monitoring_broadcaster.go and 2 other locations - About 1 hr to fix
              core/siri_lite_vehicle_monitoring_request_broadcaster.go on lines 169..178
              core/siri_vehicle_monitoring_request_broadcaster.go on lines 292..301

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

              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 *SIRILiteVehicleMonitoringRequestBroadcaster) resolveStopAreaRef(reference model.Reference) string {
                  stopArea, ok := connector.partner.Model().StopAreas().FindByCode(*reference.Code)
                  if ok {
                      obj, ok := stopArea.ReferentOrSelfCode(connector.remoteCodeSpace)
                      if ok {
              Severity: Major
              Found in core/siri_lite_vehicle_monitoring_request_broadcaster.go and 2 other locations - About 1 hr to fix
              core/siri_vehicle_monitoring_request_broadcaster.go on lines 292..301
              core/vehicle_monitoring_broadcaster.go on lines 237..246

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

              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 *SIRIVehicleMonitoringRequestBroadcaster) resolveStopAreaRef(reference model.Reference) string {
                  stopArea, ok := connector.partner.Model().StopAreas().FindByCode(*reference.Code)
                  if ok {
                      obj, ok := stopArea.ReferentOrSelfCode(connector.remoteCodeSpace)
                      if ok {
              Severity: Major
              Found in core/siri_vehicle_monitoring_request_broadcaster.go and 2 other locations - About 1 hr to fix
              core/siri_lite_vehicle_monitoring_request_broadcaster.go on lines 169..178
              core/vehicle_monitoring_broadcaster.go on lines 237..246

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

              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 (operator *Operator) UnmarshalJSON(data []byte) error {
                  type Alias Operator
                  aux := &struct {
                      Codes map[string]string
                      *Alias
              Severity: Major
              Found in model/operator.go and 1 other location - About 1 hr to fix
              model/vehicles.go on lines 110..128

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

              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 (vehicle *Vehicle) UnmarshalJSON(data []byte) error {
                  type Alias Vehicle
                  aux := &struct {
                      Codes map[string]string
                      *Alias
              Severity: Major
              Found in model/vehicles.go and 1 other location - About 1 hr to fix
              model/operator.go on lines 67..85

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

              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