code metrics
DESCRIPTION
TRANSCRIPT
Code Metrics-Albert-
Code metrics ?Code metrics is a set of software measures that provide
developers better insight into the code they are developing.
platohttps://github.com/es-analysis/plato
Javascript Source Code 분석툴
Installnpm install -g plato
runplato -r -d report src
Lines of code
Maintainability
Estimated errors
Complexity
Estimated Errors
Source lines of code
Difficulty
Maintainabilityindex(0~100) = 171 - 5.2 * In(Halstead Volume) - 0.23 *
(Cyclomatic Complexity) - 16.2 * In(Lines of Code)
Halstead complexity measures
operators, operands => program length, volume, difficulty, effort, bugs
Volume & Erros (Halstead)
Volume = total x log2(distinct) Bugs = Volume / 3000
Cyclomatic Complexitythe number of linearly
independent paths
뽀오나쓰~
Coupling모듈간의 의존도 또는 연관 관계 (낮을 수록 좋은거)
CouplingMessage Coupling : 상태 없음, 메시지나 파라미터를 통해서 통신
Data Coupling : 두 모듈 간에 파라미터로 작은 데이터만 공유
Stamp Coupling : 자료 구조를 공유
Control Coupling : 한 모듈이 정보를 전달함으로써 다른 모듈의 플로우를 제어
External Coupling : 외부로 노출된 프로토콜, 디바이스 인터페이스를 공유
Common Coupling : 두 모듈이 같은 데이터를 공유 (전역 변수)
Content Coupling : 다른 모듈의 내부 기능 및 자료를 변경
Cohesion한 모듈 내에서 요소들 간의 연관성 (높을 수록 좋은거)
CohesionFunctional Cohesion : 잘 정의된 한 기능이 하나의 모듈을 이룸
Sequential Cohesion : 모듈 내 한 작업의 출력이 다른 작업의 입력이 됨
Communication Cohesion : 같은 데이터를 다루는 것들을 묶음
Procedural Cohesion : 특정 실행 순서를 따르는 것들을 묶음
Temporal Cohesion : 특정 시간에만 수행되는 것들을 묶음
Logical Cohesion : 논리적으로 같은 일들을 하는 것들끼리 묶음
Coincidental Cohesion : 아무 관계 없는 처리 요소들을 묶음 (유틸리티)