๋“ค์–ด๊ฐ€๋ฉฐ

์˜คํ”ˆ์†Œ์Šค๋ฅผ ๋ณด๋ฉด์„œ ๋งŽ์€ ๊ฐœ๋ฐœ์ž๋“ค์ด ์ผ์ •ํ•œ Convention์„ ์–ด๋–ป๊ฒŒ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ข‹์€ ๊ฐ€์ด๋“œ๊ฐ€ ์žˆ์–ด ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

EditorConfig๋ž€?

  • ๋งŽ์€ ๊ฐœ๋ฐœ์ž๋“ค์ด ๋‹ค์–‘ํ•œ Editor๋‚˜ IDE์˜ ๊ด€๊ณ„์—†์ด ์ผ์ •ํ•œ ์ฝ”๋“œ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ๋„์™€์ฃผ๋Š” ์„ค์ •ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.
  • ํŒŒ์ผ ํ˜•ํƒœ๋กœ ์œ ์ง€๋˜๋ฉฐ ์ฝ๊ธฐ ์‰ฝ๊ณ  ์Šคํƒ€์ผ์— ๋Œ€ํ•œ ํ˜•์ƒ๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•œ ์žฅ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

Example

  • .editorconfig๋ผ๋Š” ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๊ณ  ์„ค์ •์„ ์ถ”๊ฐ€ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

Spring-boot editorconfig

root=true

[*.{groovy,java,kt,xml}]
indent_style = tab
indent_size = 4
continuation_indent_size = 8

Mockito editorconfig

root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

์ง€์›๊ฐ€๋Šฅํ•œ ์„ค์ •์†์„ฑ

๋ชจ๋“  ์—๋””ํ„ฐ์—์„œ ์ง€์›๊ฐ€๋Šฅํ•œ ์†์„ฑ์€ ์•„๋‹Œ์ ์„ ์ฃผ์˜ํ•ด์ฃผ์„ธ์š” :)

  • indent_style
    • tab, space
  • tab_width, indent_size
    • number
  • end_of_line
    • lf, cr, crlf
  • charset
    • latin1, utf-8, utf-8-bom, utf-16be, utf-16le
  • trim_trailing_whitespace
    • ๊ณต๋ฐฑ ๋ฌธ์ž ์ œ๊ฑฐ
  • insert_final_newline
    • ํŒŒ์ผ ๋งจ๋งˆ์ง€๋ง‰์— newline์„ ์ถ”๊ฐ€ ์—ฌ๋ถ€
  • root

ํ”Œ๋Ÿฌ๊ทธ์ธ ์—†์ด ์ง€์›๊ฐ€๋Šฅํ•œ Editor

ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜ํ•ด์•ผ ์ง€์›๊ฐ€๋Šฅํ•œ Editor

Reference