Showing 146 of 546 total issues
Method SIRIStopMonitoringSubscriptionBroadcaster.HandleSubscriptionRequest
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (connector *SIRIStopMonitoringSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
var monitoringRefs, subIds []string
for _, sm := range request.XMLSubscriptionSMEntries() {
rs := siri.SIRIResponseStatus{
Method VMSubscriber.prepareSIRIVehicleMonitoringSubscriptionRequest
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (subscriber *VMSubscriber) prepareSIRIVehicleMonitoringSubscriptionRequest() {
collectSubscriber := NewCollectSubcriber(subscriber.connector, VehicleMonitoringCollect)
subscriptionRequests := collectSubscriber.GetSubscriptionRequest()
if len(subscriptionRequests) == 0 {
Method SIRISubscriptionRequestDispatcher.Dispatch
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (connector *SIRISubscriptionRequestDispatcher) Dispatch(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (*siri.SIRISubscriptionResponse, error) {
response := siri.SIRISubscriptionResponse{
Address: connector.Partner().Address(),
ResponderRef: connector.Partner().RequestorRef(),
ResponseTimestamp: connector.Clock().Now(),
Method PushHandler.serve
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (handler *PushHandler) serve(response http.ResponseWriter, request *http.Request) {
// Check if request header is protobuf or return an error
if request.Header.Get("Content-Type") != "application/x-protobuf" {
http.Error(response, "Expected application/x-protobuf content", http.StatusUnsupportedMediaType)
return
Method CollectSubscriber.HandleResponse
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (cs *CollectSubscriber) HandleResponse(subscriptionRequests map[SubscriptionId]*subscriptionRequest, message *audit.BigQueryMessage, response *sxml.XMLSubscriptionResponse) {
for _, responseStatus := range response.ResponseStatus() {
var subscriptionRequest *subscriptionRequest
var ok bool
- 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 CollectManager.UpdateStopArea
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (manager *CollectManager) UpdateStopArea(request *StopAreaUpdateRequest) {
stopArea, ok := manager.referential.Model().StopAreas().Find(request.StopAreaId())
localLogger := NewStopAreaLogger(manager.referential, stopArea)
if !ok {
- 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 NewSIRICheckStatusResponse
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
address string,
producerRef string,
requestMessageRef string,
responseMessageIdentifier string,
status bool,
Method SMBroadcaster.prepareSIRIStopMonitoringNotify
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (smb *SMBroadcaster) prepareSIRIStopMonitoringNotify() {
smb.connector.mutex.Lock()
events := smb.connector.toBroadcast
smb.connector.toBroadcast = make(map[SubscriptionId][]model.StopVisitId)
- 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 SIRISubscriptionRequestDispatcher.Dispatch
has 13 return statements (exceeds 4 allowed). Open
func (connector *SIRISubscriptionRequestDispatcher) Dispatch(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (*siri.SIRISubscriptionResponse, error) {
response := siri.SIRISubscriptionResponse{
Address: connector.Partner().Address(),
ResponderRef: connector.Partner().RequestorRef(),
ResponseTimestamp: connector.Clock().Now(),
Method GMBroadcaster.prepareSIRIGeneralMessageNotify
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (gmb *GMBroadcaster) prepareSIRIGeneralMessageNotify() {
gmb.connector.mutex.Lock()
events := gmb.connector.toBroadcast
gmb.connector.toBroadcast = make(map[SubscriptionId][]model.SituationId)
Method CollectSubscriber.HandleResponse
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (cs *CollectSubscriber) HandleResponse(subscriptionRequests map[SubscriptionId]*subscriptionRequest, message *audit.BigQueryMessage, response *sxml.XMLSubscriptionResponse) {
for _, responseStatus := range response.ResponseStatus() {
var subscriptionRequest *subscriptionRequest
var ok bool
Method SIRIEstimatedTimetableSubscriptionBroadcaster.HandleSubscriptionRequest
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (connector *SIRIEstimatedTimetableSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
var lineIds, subIds []string
for _, ett := range request.XMLSubscriptionETTEntries() {
rs := siri.SIRIResponseStatus{
Method SIRIProductionTimetableSubscriptionBroadcaster.HandleSubscriptionRequest
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (connector *SIRIProductionTimetableSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
var lineIds, subIds []string
for _, ptt := range request.XMLSubscriptionPTTEntries() {
rs := siri.SIRIResponseStatus{
Method SIRIVehicleMonitoringSubscriptionBroadcaster.HandleSubscriptionRequest
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (connector *SIRIVehicleMonitoringSubscriptionBroadcaster) HandleSubscriptionRequest(request *sxml.XMLSubscriptionRequest, message *audit.BigQueryMessage) (resps []siri.SIRIResponseStatus) {
var lineIds, subIds []string
for _, vm := range request.XMLSubscriptionVMEntries() {
rs := siri.SIRIResponseStatus{
Method CollectManager.UpdateStopArea
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (manager *CollectManager) UpdateStopArea(request *StopAreaUpdateRequest) {
stopArea, ok := manager.referential.Model().StopAreas().Find(request.StopAreaId())
localLogger := NewStopAreaLogger(manager.referential, stopArea)
if !ok {
Method CollectManager.requestStopAreaFilteredSituation
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
func (manager *CollectManager) requestStopAreaFilteredSituation(requestedId string) {
stopArea, ok := manager.referential.Model().StopAreas().Find(model.StopAreaId(requestedId))
if !ok {
logger.Log.Debugf("Can't find StopArea to request %v", requestedId)
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 CollectManager.requestStopAreaFilteredSituation
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (manager *CollectManager) requestStopAreaFilteredSituation(requestedId string) {
stopArea, ok := manager.referential.Model().StopAreas().Find(model.StopAreaId(requestedId))
if !ok {
logger.Log.Debugf("Can't find StopArea to request %v", requestedId)
return
Method MemoryStopVisits.Load
has 51 lines of code (exceeds 50 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())
Method SXBroadcaster.prepareSIRISituationExchangeNotify
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (sxb *SXBroadcaster) prepareSIRISituationExchangeNotify() {
sxb.connector.mutex.Lock()
events := sxb.connector.toBroadcast
sxb.connector.toBroadcast = make(map[SubscriptionId][]model.SituationId)
Method SIRILiteStopMonitoringRequestCollector.RequestStopAreaUpdate
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (connector *SIRILiteStopMonitoringRequestCollector) RequestStopAreaUpdate(request *StopAreaUpdateRequest) {
stopArea, ok := connector.partner.Model().StopAreas().Find(request.StopAreaId())
if !ok {
logger.Log.Debugf("StopAreaUpdateRequest in LiteStopMonitoringRequestCollector for unknown StopArea %v", request.StopAreaId())
return