2.5 Cyclomatic Complexity McCabe

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

Комментарии • 4

  • @mido222100
    @mido222100 4 года назад

    Why is the number of connected components equal to 1 in each example?

  • @markemerson98
    @markemerson98 3 года назад

    i dont see 7 nodes, can you highlight the code which you are including as a node

    • @longlivespock
      @longlivespock 2 года назад +2

      I'm not sure if you still curious, but this is the breakdown for the second example.
      -Node 1: Start [line 01]
      -Node 2: Declare wasRunning() [line 03]
      -Node 3: Reset the timer [line 04]
      -Node 4: Call wasRunning() in the if statement [line 06]
      -Node 5: Call isRunning() [line 03, this one is tricky because of the lambda operator]
      -Node 6: If true, start the timer [line 07, no false condition to add a node]
      -Node 7: Exit [line 08]

    • @vonn9737
      @vonn9737 2 года назад

      @@longlivespock No. It is as below:
      1. restart() [Entry point]
      2. m_time->isRunning() [Incorrectly numbered as 3 (duplicate) in diagram]
      3. wasRunning()
      4. m_time->reset()
      5. if(wasRunning) [Incorrectly numbered as 6 in diagram]
      6. m_time->start() [Incorrectly numbered as 7 in diagram]
      7. Exit. [Incorrectly numbered as 8 in diagram]