Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel
borderColor#C3CCD7
bgColor#FCFCFC

Table of Contents

Table of Contents
indent16px



LanguagesNotes
ABAP

다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다:

 

AND,

 CATCH

  CATCH,

 CONTINUE

CONTINUE,

 DO

DO,

 ELSEIF

ELSEIF,

 IF

IF,

 LOOP

LOOP,

 LOOPAT

LOOPAT,

 OR

OR,

 PROVIDE

PROVIDE,

SELECT…ENDSELECT

SELECTENDSELECT,

 TRY

TRY,

 WHEN

WHEN,

 WHILE

WHILE

C/C++/Objective-C

다음 구문 혹은 키워들 키워드를 만날 때마다 복잡도가 1씩 증가합니다: 합수 정의함수 선언(function definitions), whiledo while, for, throw 구문, return (함수의 가장 마지막 구문인 경우는 제외), switchcasedefault&& 연산자, || 연산자, ? 삼항  삼항 연산자, catchbreakcontinuegoto.

Cobol다음 명령어를 만날 때마다 복잡도가 1씩 증가합니다(해당 키워드가 카피북(copybook)에서 사용되는 경우는 제외): ALSO, ALTER, AND, DEPENDING, END_OF_PAGE, ENTRY, EOP, EXCEPTION, EXIT, GOBACK, CONTINUE, IF, INVALID, OR, OVERFLOW, SIZE, STOP, TIMES, UNTIL, USE, VARYING, WHEN, EXEC CICS HANDLE, EXEC CICS LINK, EXEC CICS XCTL, EXEC  EXEC CICS RETURN
Java
  • 다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다: ifforwhilecasecatchthrowreturn (함수의 가장 마지막 구문인 경우는 제외), && 연산자|| 연산자? 삼항연산자
  • 주의:
    • elsedefaultfinally 키워드는 복잡도를 증가시키지 않습니다.
    • 하나의 switch 구문을 포함한 간단한 메소드 및 거대한 case 구문 블럭의 복잡도는 기하급수적으로 증가할 수 있습니다(해당 switch 블록을 동일한 시퀀스의 if 구문으로 변경해도 복잡도 값은 동일합니다).


예: 다음 메소드의 복잡도 값은 5입니다.

public void process(Car myCar){          // +1
    if(myCar.isNotMine()){               // +1
         return;                         // +1
    }
    car.paint("red");
    car.changeWheel();
    while(car.hasGazol() && car.getDriver().isNotStressed()){   // +2
         car.drive();
    }
    return;
}


JavaScript, PHP

복잡도는 다음의 경우, 복잡도가 1씩 증가합니다:

  • 함수 (즉, 비-추상화 및 비-임의 생성자(constructor), 함수(function), 프로시져(procedure) 혹은 메소드(method))
  • if 구문
  • short-circuit (AKA lazy) logical conjunction (&&)
  • short-circuit (AKA lazy) logical disjunction (||)
  • 삼항 조건 표현식(ternary conditional expressions)조건문
  • 루프(loop)
  • switch 구문의 case 조건
  • throw & catch 구문
  • return 구문(함수의 마지막 구문인 경우는 제외)
  • go to 구문 (PHP 만 해당)
PL/I다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다: PROC, PROCEDURE, GOTO, GO TO, RETURN, DO, IF, WHEN, |, !, |=, !=, &, &=
PL/SQLThe complexity gets incremented by one for다음의 경우 복잡도가 1씩 증가합니다: the main PL/SQL anonymous block (not inner ones), create procedure, create trigger, procedure_definition, basic loop statement, when_clause_statement (the “when” of simple_case_statement and searched_case_statement), continue_statement, cursor_for_loop_statement, continue_exit_when_clause (The “WHEN” part of the continue and exit statements), exception_handler (every individual “WHEN”), exit_statement, for_loop_statement, forall_statement, if_statement, elsif_clause, raise_statement, return_statement, while_loop_statement, and_expression (“and” reserved word used within PL/SQL expressions), or_expression (“or” reserved word used within PL/SQL expressions), when_clause_expression (the “when” of simple_case_expression and searched_case_expression)
VB.NETThe complexity gets incremented by one for: method or constructor declaration (Sub다음의 경우 복잡도가 1씩 증가합니다: 메소드 혹은 생성자 선언(SubFunction), AndAlso, Case Case, Continue, End, Error Error, Exit Exit, If If, Loop Loop, On Error, GoTo, OrElse, Resume, Return (except if it is the last statement of a function함수의 마지막 구문인 경우는 제외), Stop, Throw Throw, Try Try.
Web

Complexity of the web page is measured by counting the decision tags (such as if and forEach) and boolean operators in expressions 결정 태그(ifforEach 등) 및 불리언 연산자(&& and  ||), plus one for the body of the document. The decision tags and the operators are configurable through the Complexity rule문서의 body를 만날 때마다 복잡도가 1씩 증가합니다. 결정 태그 및 연산자는 Complexity rule을 통해 지정할 수 있습니다.