Showing 146 of 546 total issues

Method SIRISituationExchangeRequestBroadcaster.canBroadcast has 5 return statements (exceeds 4 allowed).
Open

func (connector *SIRISituationExchangeRequestBroadcaster) canBroadcast(situation model.Situation) bool {
    if situation.Origin == string(connector.partner.Slug()) {
        return false
    }

Severity: Major
Found in core/siri_situation_exchange_request_broadcaster.go - About 35 mins to fix

    Method UpdateManager.updateStopVisit has 5 return statements (exceeds 4 allowed).
    Open

    func (manager *UpdateManager) updateStopVisit(event *StopVisitUpdateEvent) {
        if event.Code.Value() == "" { // Avoid creating a StopVisit with an empty code
            return
        }
    
    
    Severity: Major
    Found in model/update_manager.go - About 35 mins to fix

      Method MemoryReferentials.Load has 5 return statements (exceeds 4 allowed).
      Open

      func (manager *MemoryReferentials) Load() error {
          selectReferentials := []model.SelectReferential{}
          _, err := model.Database.Select(&selectReferentials, "select * from referentials")
          if err != nil {
              return err
      Severity: Major
      Found in core/referential.go - About 35 mins to fix

        Method Purifier.Purge has 5 return statements (exceeds 4 allowed).
        Open

        func (p *Purifier) Purge() error {
            if p.date == "" {
                return fmt.Errorf("purifier date is empty")
            }
        
        
        Severity: Major
        Found in model/purge.go - About 35 mins to fix

          Method APISituation.Validate has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func (apiSituation *APISituation) Validate() bool {
              if apiSituation.CodeSpace == "" {
                  apiSituation.Errors.Add("CodeSpace", e.ERROR_BLANK)
              }
          
          
          Severity: Minor
          Found in model/situation.go - About 25 mins 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

          Method Controller.serve has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func (controller *Controller) serve(response http.ResponseWriter, request *http.Request, requestData *RequestData) {
              // Check request body
              if requestData.Method == "PUT" || (requestData.Method == "POST" && requestData.Id != "save" && requestData.Action != "reload") {
                  requestData.Body = getRequestBody(response, request)
                  if requestData.Body == nil {
          Severity: Minor
          Found in api/controller.go - About 25 mins 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

          Severity
          Category
          Status
          Source
          Language