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
The following keywords increase the complexity by one
다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다AND, CATCH, CONTINUE, DO, ELSEIF, IF, LOOP, LOOPAT, OR, PROVIDE, SELECT…ENDSELECT, TRY, WHEN, WHILE
C/C++/Objective-C
The complexity gets incremented by one for: function definitions

다음 구문 혹은 키워들 만날 때마다 복잡도가 1씩 증가합니다: 합수 정의(function definitions)whiledo while, for, throw

statements

구문return (

except if it is the last statement of a function

함수의 가장 마지막 구문인 경우는 제외), switchcasedefault&&

 operator

 연산자||

 operator

 연산자?

 ternary operator

 삼항 연산자catchbreakcontinuegoto.

Cobol
The following commands increase the complexity by one (except when they are used in a copybook
다음 명령어를 만날 때마다 복잡도가 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 CICS RETURN
Java
Keywords incrementing the complexity
  • 다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다ifforwhilecasecatchthrowreturn (
that is not the last statement of a method
  • 함수의 가장 마지막 구문인 경우는 제외), && 연산자|| 연산자? 삼항연산자
Notes
  • 주의:
    • elsedefault
, and finally keywords do not increment the complexity.
  • a simple method with a switch statement and a huge block of case statements can have a surprisingly high complexity value (still it has the same value when converting a switch block to an equivalent sequence of if statements).
  • Example: the following method has a complexity of 5
      • finally 키워드는 복잡도를 증가시키지 않습니다.
      • 하나의 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
    Complexity is incremented by one for eachif statement

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

  • function (i.e non-abstract and non-anonymous constructors, functions, procedures or methods)
    • 함수 (즉, 비-추상화 및 비-임의 생성자(constructor), 함수(function), 프로시져(procedure) 혹은 메소드(method))
    • if 구문
    • short-circuit (AKA lazy) logical conjunction (&&)
    • short-circuit (AKA lazy) logical disjunction (||)
    • 삼항 조건 표현식(ternary conditional expressions)
    • 루프(loop)
    case clauses of a switch statement
    • switch 구문의 case 조건
    • throw
    and
    • & catch
    statement
    • 구문
    • return
    statement (except when it is the very last statement of a function
    • 구문(함수의 마지막 구문인 경우는 제외)
    • go to
    statement
    • 구문 (
    only for
    • PHP 만 해당)
    PL/I
    The following keywords increase the complexity by one
    다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다PROC, PROCEDURE, GOTO, GO TO, RETURN, DO, IF, WHEN, |, !, |=, !=, &, &=
    PL/SQLThe complexity gets incremented by one for: 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 (SubFunction), AndAlso, Case, Continue, End, Error, Exit, If, Loop, On Error, GoTo, OrElse, Resume, Return (except if it is the last statement of a function), Stop, Throw, Try.
    Web

    Complexity of the web page is measured by counting the decision tags (such as if and forEach) and boolean operators in expressions (&& and ||), plus one for the body of the document. The decision tags and the operators are configurable through the Complexity rule.