Showing 134 of 525 total issues
Method ETTSubscriber.prepareSIRIEstimatedTimetableSubscriptionRequest
has 109 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (subscriber *ETTSubscriber) prepareSIRIEstimatedTimetableSubscriptionRequest() {
subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(EstimatedTimetableCollect)
if len(subscriptions) == 0 {
logger.Log.Debugf("EstimatedTimetableSubscriber visit without EstimatedTimetableCollect subscriptions")
return
Method SIRIHandler.serve
has 108 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (handler *SIRIHandler) serve(response http.ResponseWriter, request *http.Request) {
response.Header().Set("Content-Type", "text/xml; charset=utf-8")
m := &audit.BigQueryMessage{
Protocol: "siri",
Method PTTBroadcaster.prepareSIRIProductionTimetable
has 107 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ptt *PTTBroadcaster) prepareSIRIProductionTimetable() {
ptt.connector.mutex.Lock()
events := ptt.connector.toBroadcast
ptt.connector.toBroadcast = make(map[SubscriptionId][]model.StopVisitId)
Method SIRISituationExchangeRequestBroadcaster.buildSituation
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
func (connector *SIRISituationExchangeRequestBroadcaster) buildSituation(delivery *siri.SIRISituationExchangeDelivery, situation model.Situation) {
if !connector.canBroadcast(situation) {
return
}
- Read upRead up
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 BroadcastSituationExchangeBuilder.BuildSituationExchange
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
func (builder *BroadcastSituationExchangeBuilder) BuildSituationExchange(situation model.Situation) (situationExchangeDelivery *siri.SIRISituationExchangeDelivery) {
if !builder.canBroadcast(situation) {
return nil
}
- Read upRead up
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 VMBroadcaster.prepareSIRIVehicleMonitoring
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
func (vm *VMBroadcaster) prepareSIRIVehicleMonitoring() {
vm.connector.mutex.Lock()
defer vm.connector.mutex.Unlock()
events := vm.connector.toBroadcast
- Read upRead up
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 SXSubscriber.prepareSIRISituationExchangeSubscriptionRequest
has 106 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (subscriber *SXSubscriber) prepareSIRISituationExchangeSubscriptionRequest() {
subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(SituationExchangeCollect)
if len(subscriptions) == 0 {
logger.Log.Debugf("SituationExchangeSubscriber visit without SituationExchangeCollect subscriptions")
return
Method GMSubscriber.prepareSIRIGeneralMessageSubscriptionRequest
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (subscriber *GMSubscriber) prepareSIRIGeneralMessageSubscriptionRequest() {
subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(GeneralMessageCollect)
if len(subscriptions) == 0 {
logger.Log.Debugf("GeneralMessageSubscriber visit without GeneralMessageCollect subscriptions")
return
Method VMBroadcaster.prepareSIRIVehicleMonitoring
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (vm *VMBroadcaster) prepareSIRIVehicleMonitoring() {
vm.connector.mutex.Lock()
defer vm.connector.mutex.Unlock()
events := vm.connector.toBroadcast
Method VMSubscriber.prepareSIRIVehicleMonitoringSubscriptionRequest
has 101 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (subscriber *VMSubscriber) prepareSIRIVehicleMonitoringSubscriptionRequest() {
subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(VehicleMonitoringCollect)
if len(subscriptions) == 0 {
logger.Log.Debugf("VehicleMonitoringSubscriber visit without VehicleMonitoringCollect subscriptions")
return
Method BroadcastSituationExchangeBuilder.BuildSituationExchange
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (builder *BroadcastSituationExchangeBuilder) BuildSituationExchange(situation model.Situation) (situationExchangeDelivery *siri.SIRISituationExchangeDelivery) {
if !builder.canBroadcast(situation) {
return nil
}
Method UpdateManager.updateStopVisit
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (manager *UpdateManager) updateStopVisit(event *StopVisitUpdateEvent) {
if event.Code.Value() == "" { // Avoid creating a StopVisit with an empty code
return
}
Method ETTSubscriber.prepareSIRIEstimatedTimetableSubscriptionRequest
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (subscriber *ETTSubscriber) prepareSIRIEstimatedTimetableSubscriptionRequest() {
subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(EstimatedTimetableCollect)
if len(subscriptions) == 0 {
logger.Log.Debugf("EstimatedTimetableSubscriber visit without EstimatedTimetableCollect subscriptions")
return
- Read upRead up
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 MemoryStopVisits.Load
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (manager *MemoryStopVisits) Load(referentialSlug string) error {
var selectStopVisits []SelectStopVisit
modelName := manager.model.Date()
sqlQuery := fmt.Sprintf("select * from stop_visits where referential_slug = '%s' and model_name = '%s'", referentialSlug, modelName.String())
- Read upRead up
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 93 lines of code (exceeds 50 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() {
Method SIRIHandler.requestHandler
has 93 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (handler *SIRIHandler) requestHandler(envelope *remote.SIRIEnvelope) SIRIRequestHandler {
switch envelope.BodyType() {
case "CheckStatus":
return &SIRICheckStatusRequestHandler{
xmlRequest: sxml.NewXMLCheckStatusRequest(envelope.Body()),
Method SMSubscriber.prepareSIRIStopMonitoringSubscriptionRequest
has 92 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (subscriber *SMSubscriber) prepareSIRIStopMonitoringSubscriptionRequest() {
subscriptions := subscriber.connector.partner.Subscriptions().FindSubscriptionsByKind(StopMonitoringCollect)
if len(subscriptions) == 0 {
logger.Log.Debugf("StopMonitoringSubscriber visit without StopMonitoringCollect subscriptions")
return
Function NewConnectorFactory
has 90 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewConnectorFactory(connectorType string) ConnectorFactory {
switch connectorType {
case GRAPHQL_SERVER:
return &GraphqlServerFactory{}
case PUSH_COLLECTOR:
SIRIClient
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
type SIRIClient struct {
httpClient *HTTPClient
siriEnvelopeType string
}
Method LiteStopMonitoringUpdateEventBuilder.buildUpdateEvents
has 87 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (builder *LiteStopMonitoringUpdateEventBuilder) buildUpdateEvents(StopVisitEvent *slite.MonitoredStopVisit) {
// When Order is not defined, we should ignore the MonitoredStopVisit
// see ARA-1240 "Special cases"
if !StopVisitEvent.HasOrder() {
return