-
[MAC] [IntelliJ] Google style guide format 적용하기IT/Tool 2022. 12. 17. 15:01
java Google style guide 가 무엇인가?
2022.07.08 - [IT/JAVA | Spring] - [JAVA] Google Java Style Guide link
[JAVA] Google Java Style Guide link
클린코드를 공부하던 중 google java style guide 를 아주 잘 번역되어있는 블로그를 발견했다. 이 블로그는 해당 블로그를 작성하신 작성자분께 허락을 구하고 링크만 남겨놓는다. Google Java Style Guide
kangyb.tistory.com
IDE(intellij, eclipse 등)은 code format을 적용할 수 있다.
그 중 java 개발할 때 많이 참고하는 google java format 을 적용해보자
1. google style guide 파일 다운로드
https://github.com/google/styleguide
GitHub - google/styleguide: Style guides for Google-originated open-source projects
Style guides for Google-originated open-source projects - GitHub - google/styleguide: Style guides for Google-originated open-source projects
github.com
2. intellij 실행 후 preferences 들어가기
상단 바 -> intellij IDEA -> Preferences
또는
command + ,
Preferences 3. code format 검색 또는 editor -> Code Style 접근
editor -> Code Style 4. 다운받은 파일 적용
Scheme -> 우측 점3개 클릭 -> import Scheme -> Intellij IDEA code style XML 클릭
다운받은 zip파일을 풀면 아래에 intellij-java-google-style.xml에 있다.
intellij-java-google-style.xml 선택
Scheme를 확인했을때 GoogleStyle이 아니면 아래 화살표를 눌러서 적용
GoogleStyle 5. Preferences -> Code Style -> Java 선택
java 6. Tab size와 Indent 조정
Tab size : 4
Indent : 4
Continuation indent : 4
이미 아래와 같이 수정되어있다면 건들이지 않아도 된다.
java option 7. 기존 소스에 format 적용
mac intellij 기준 command + option + L 을 누르면 적용됨
'IT > Tool' 카테고리의 다른 글
[IntelliJ] 테스트 커버리지, 내 테스트 코드는 얼마나 잘 만들었을까 (0) 2023.02.11 [IntelliJ] Editor에 코드 호출, 구현 등 한눈에 보기 ( Inlay hints ) (0) 2022.12.18 [MAC] M1 맥북 homebrew 설치 후 command not found:brew 해결 (0) 2022.08.15 [MAC] iTerm2 꾸미기 (powerlevel10k, sysntaxt highlighting, status bar 등) iTerm 커스텀 (6) 2022.08.15 [MAC] iTerm2 꾸미기 (oh-my-zsh, font, theme 등) iTerm 커스텀 (0) 2022.08.15