인텔리제이 코딩 컨벤션 적용(구글 코딩 컨벤션)
인텔리제이 코드 스타일 설정
mac 기준 인텔리제이 내에서 세팅-> 코드 스타일에서 한 줄의 가로길이와 같은 세팅을 설정할 수 있다.
구글 자바 코딩 스타일
[구글 자바 스타일 가이드]https://google.github.io/styleguide/javaguide.html#s4.5-line-wrapping
Google Java Style Guide
1 Introduction This document serves as the complete definition of Google's coding standards for source code in the Java™ Programming Language. A Java source file is described as being in Google Style if and only if it adheres to the rules herein. Like ot
google.github.io
구글 자바 코딩 스타일을 인텔리제이에서 적용하기
위에 작성된 것처럼 직접 수정할 수도 있지만 xml 파일을 임포트 해서 사용할 수도 있다.
[구글코딩컨벤션]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
위 깃허브 사이트에서 원하는 언어의 style.xml 파일을 다운로드한다.
자바의 경우 인텔리제이와 이클립스 두 가지가 있다.
귀찮다면 아래 사이트에 들어가서 인텔리제이 자바 구글 스타일을 다운로드하면 된다.
[자바xml파일]https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml
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
파일을 다운로드한다.
이후에 mac 기준 -> 인텔리 제이 -> 세팅 -> 코드 스타일 -> 자바에서 스키마를 임포트 한다.
다운로드 한 파일을 설정하면 된다.
임포트 이후에 아래와 같이 구글 스타일이 추가된 것을 확인할 수 있다.
참고로 구글 코드 스타일은 들여 쓰기가 2번이기 때문에 4번으로 수정하고 사용하는 것이 좋을 수도 있다
아래와 같이 탭과 들여 쓰기에서 탭 사이즈를 변경하면 된다.(tab,indent,continuation indent함께 수정했다)
이후에 mac 기준 option+command+l을 누르면 코드 스타일이 적용된 것을 볼 수 있다.
윈도는 comand + shift + l
참고, 출처