개요
코드 스타일 통일을 위해 IntelliJ에 Linter와 Formatter를 적용해보았다
옛날에 파이썬 쓸 때, black, flake8같은 도구들이 매우 좋았는데 자바에는 없나 싶어서 찾아보니 있었다!
CheckStyle 설치
IntelliJ에서 설정 → Plugins → Marketplace에 CheckStyle 플러그인 설치
Linter(CheckStyle), Formatter(Code Style) 적용
네이버 캠퍼스 핵데이 Java 코딩 컨벤션
1. Formatter (Code Style)
naver-intellij-formatter.xml 설치
설정 → Editor → Code Style → Java에서 설치한 naver-intellij-formatter.xml import
적용
2. Linter (CheckStyle)
naver-checkystyle-rules.xml, naver-checkstyle-suppressions.xml 설치
설정 → Tools → Checkstyle에서 설치한 naver-checkstyle-rules.xml import
next → 설치한 naver-checkstyle-suppressions.xml 등록
주의점!! CheckStyle 버전을 8.24로 해야한다고 한다.
Google Java Style
1. Formatter (Code Style)
intellij-java-google-style.xml 설치
설정 → Editor → Code Style → Java에서 설치한 intellij-java-google-style.xml import
적용
2. Linter (CheckStyle)
google_checks.xml 설치
설정 → Tools → Checkstyle에서 설치한 google_checks.xml import
별도의 Property 작성이나 버전 변경 없이 그대로 사용
참고사항!! Missing JavaDoc Warning은 표시하고 싶지 않을 때
설치한 google_checks.xml에서 이 부분에 위처럼 작성
Reference
https://velog.io/@geun/Intellij-Formatter-Checkstyle-세팅하기
[Intellij] Formatter, Checkstyle 세팅하기!
Formatter, Linter를 적용해서 클린 코드를 작성해봅시다..!
velog.io
https://naver.github.io/hackday-conventions-java/#class-noun
캠퍼스 핵데이 Java 코딩 컨벤션
중괄호({,}) 는 클래스, 메서드, 제어문의 블럭을 구분한다. 5.1. K&R 스타일로 중괄호 선언 클래스 선언, 메서드 선언, 조건/반복문 등의 코드 블럭을 감싸는 중괄호에 적용되는 규칙이다. 중괄호
naver.github.io
How to fully disable javadoc checking with checkstyle maven plugin
i want to use the Maven Checkstyle plugin with a custom configuration that tells Checkstyle to not warn or error on missing Javadoc. Is there a way to do this?
stackoverflow.com
'Java > IntelliJ' 카테고리의 다른 글
[IntelliJ] JUnit Test 한글 깨짐 해결 (0) | 2024.02.03 |
---|---|
[IntelliJ] no matching in any candidates test task 해결법 (0) | 2024.02.03 |