remote/siri_client.go

Summary

Maintainability
D
1 day
Test Coverage

SIRIClient has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

type SIRIClient struct {
    httpClient       *HTTPClient
    siriEnvelopeType string
}
Severity: Minor
Found in remote/siri_client.go - About 2 hrs to fix

    Method SIRIClient.prepareAndSendRequest has 51 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (client *SIRIClient) prepareAndSendRequest(args siriClientArguments) (xml.Node, error) {
        // Wrap the request XML
        buffer := NewSIRIBuffer(client.siriEnvelopeType)
    
        xml, err := args.request.BuildXML(client.siriEnvelopeType)
    Severity: Minor
    Found in remote/siri_client.go - About 1 hr to fix

      Method 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

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

        func (client *SIRIClient) EstimatedTimetableSubscription(request *siri.SIRIEstimatedTimetableSubscriptionRequest) (*sxml.XMLSubscriptionResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                requestType:       SUBSCRIPTION,
                expectedResponses: []string{"SubscribeResponse", "SubscriptionResponse"},
        Severity: Major
        Found in remote/siri_client.go and 2 other locations - About 50 mins to fix
        remote/siri_client.go on lines 328..340
        remote/siri_client.go on lines 342..355

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

        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 (client *SIRIClient) DeleteSubscription(request *siri.SIRIDeleteSubscriptionRequest) (*sxml.XMLDeleteSubscriptionResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                requestType:       SUBSCRIPTION,
                expectedResponses: []string{"DeleteSubscriptionResponse", "TerminateSubscriptionResponse"},
        Severity: Major
        Found in remote/siri_client.go and 2 other locations - About 50 mins to fix
        remote/siri_client.go on lines 314..326
        remote/siri_client.go on lines 328..340

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

        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 (client *SIRIClient) VehicleMonitoringSubscription(request *siri.SIRIVehicleMonitoringSubscriptionRequest) (*sxml.XMLSubscriptionResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                requestType:       SUBSCRIPTION,
                expectedResponses: []string{"SubscribeResponse", "SubscriptionResponse"},
        Severity: Major
        Found in remote/siri_client.go and 2 other locations - About 50 mins to fix
        remote/siri_client.go on lines 314..326
        remote/siri_client.go on lines 342..355

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

        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 (client *SIRIClient) StopMonitoringSubscription(request *siri.SIRIStopMonitoringSubscriptionRequest) (*sxml.XMLSubscriptionResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                requestType:       SUBSCRIPTION,
                expectedResponses: []string{"SubscribeResponse"},
        Severity: Major
        Found in remote/siri_client.go and 2 other locations - About 50 mins to fix
        remote/siri_client.go on lines 286..298
        remote/siri_client.go on lines 300..312

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

        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 (client *SIRIClient) GeneralMessageSubscription(request *siri.SIRIGeneralMessageSubscriptionRequest) (*sxml.XMLSubscriptionResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                requestType:       SUBSCRIPTION,
                expectedResponses: []string{"SubscribeResponse"},
        Severity: Major
        Found in remote/siri_client.go and 2 other locations - About 50 mins to fix
        remote/siri_client.go on lines 272..284
        remote/siri_client.go on lines 286..298

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

        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 (client *SIRIClient) SituationExchangeSubscription(request *siri.SIRISituationExchangeSubscriptionRequest) (*sxml.XMLSubscriptionResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                requestType:       SUBSCRIPTION,
                expectedResponses: []string{"SubscribeResponse"},
        Severity: Major
        Found in remote/siri_client.go and 2 other locations - About 50 mins to fix
        remote/siri_client.go on lines 272..284
        remote/siri_client.go on lines 300..312

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

        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 (client *SIRIClient) SituationExchangeMonitoring(request *siri.SIRIGetSituationExchangeRequest) (*sxml.XMLSituationExchangeResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                expectedResponses: []string{"GetSituationExchangeResponse"},
                acceptGzip:        true,
        Severity: Major
        Found in remote/siri_client.go and 4 other locations - About 45 mins to fix
        remote/siri_client.go on lines 188..200
        remote/siri_client.go on lines 216..228
        remote/siri_client.go on lines 230..242
        remote/siri_client.go on lines 258..270

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

        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 (client *SIRIClient) StopMonitoring(request *siri.SIRIGetStopMonitoringRequest) (*sxml.XMLStopMonitoringResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                expectedResponses: []string{"GetStopMonitoringResponse"},
                acceptGzip:        true,
        Severity: Major
        Found in remote/siri_client.go and 4 other locations - About 45 mins to fix
        remote/siri_client.go on lines 188..200
        remote/siri_client.go on lines 230..242
        remote/siri_client.go on lines 244..256
        remote/siri_client.go on lines 258..270

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

        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 (client *SIRIClient) StopDiscovery(request *siri.SIRIStopPointsDiscoveryRequest) (*sxml.XMLStopPointsDiscoveryResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                expectedResponses: []string{"StopPointsDiscoveryResponse"},
                acceptGzip:        true,
        Severity: Major
        Found in remote/siri_client.go and 4 other locations - About 45 mins to fix
        remote/siri_client.go on lines 216..228
        remote/siri_client.go on lines 230..242
        remote/siri_client.go on lines 244..256
        remote/siri_client.go on lines 258..270

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

        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 (client *SIRIClient) SituationMonitoring(request *siri.SIRIGetGeneralMessageRequest) (*sxml.XMLGeneralMessageResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                expectedResponses: []string{"GetGeneralMessageResponse"},
                acceptGzip:        true,
        Severity: Major
        Found in remote/siri_client.go and 4 other locations - About 45 mins to fix
        remote/siri_client.go on lines 188..200
        remote/siri_client.go on lines 216..228
        remote/siri_client.go on lines 244..256
        remote/siri_client.go on lines 258..270

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

        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 (client *SIRIClient) VehicleMonitoring(request *siri.SIRIGetVehicleMonitoringRequest) (*sxml.XMLVehicleMonitoringResponse, error) {
            node, err := client.prepareAndSendRequest(siriClientArguments{
                request:           request,
                expectedResponses: []string{"GetVehicleMonitoringResponse"},
                acceptGzip:        true,
        Severity: Major
        Found in remote/siri_client.go and 4 other locations - About 45 mins to fix
        remote/siri_client.go on lines 188..200
        remote/siri_client.go on lines 216..228
        remote/siri_client.go on lines 230..242
        remote/siri_client.go on lines 244..256

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

        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 (client *SIRIClient) getURL(requestType requestType) string {
            switch requestType {
            case SUBSCRIPTION:
                if client.httpClient.SubscriptionsUrl != "" {
                    return client.httpClient.SubscriptionsUrl
        Severity: Minor
        Found in remote/siri_client.go and 1 other location - About 45 mins to fix
        remote/siri_lite_client.go on lines 135..147

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

        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

        There are no issues that match your filters.

        Category
        Status