Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Table of Contents


LanguagesNotes
ABAP

다음 키워드를 만날 때마다 복잡도가 1씩 증가합니다: ANDCATCH, CONTINUE, DO, ELSEIF, IF, LOOP, LOOPAT, OR, PROVIDE, SELECTENDSELECT, TRY, WHEN, WHILE

C/C++/Objective-C

다음 구문 혹은 키워들 만날 때마다 복잡도가 1씩 증가합니다: 함수 선언(function definitions), whiledo whilefor, 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 XCTLEXEC 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: 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.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.