There should be a single space for type modifiers for a function type and the parameters or receiver.
Non-Compliant Code Examples
// Function type
valprocess:suspend()->Unit={}// Function type with receiver
valprocess:suspendString.()->Unit={println(this)}// Function type with nullable receiver
valprocess:suspendString?.()->Unit={if(this!=null)println(this)}// Nullable function type
valprocess:(suspend()->Unit)?=null// Function type as parameter
suspendfunexecute(task:suspend()->Unit){task()}
Compliant Code Examples
// Function type
valprocess:suspend()->Unit={}// Function type with receiver
valprocess:suspendString.()->Unit={println(this)}// Function type with nullable receiver
valprocess:suspendString?.()->Unit={if(this!=null)println(this)}// Nullable function type
valprocess:(suspend()->Unit)?=null// Function type as parameter
suspendfunexecute(task:suspend()->Unit){task()}
원활한 통합. Datadog Code Security 사용해 보기
Datadog Code Security
이 규칙을 사용해 Datadog Code Security로 코드 분석해 보기
이 규칙의 사용법
1
2
rulesets:- kotlin-code-style # Rules to enforce Kotlin code style.
리포지토리 루트에서 위의 콘텐츠를 사용해 static-analysis.datadog.yml 생성
Datadog의 무료 IDE Plugins를 사용하거나 Code Security 스캔을 CI 파이프라인에 추가