Skip to content

Commit dfbfa5f

Browse files
HyukjinKwonrxin
authored andcommitted
Clarify each argument in each line, two lines limit and add invocation style guide (databricks#64)
* Each argument in each line, two lines limit and invocation style * Address comments
1 parent 40b7d1b commit dfbfa5f

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

README-KO.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ Scala는 매우 강력하며 여러가지 페러다임에 적용 가능한 언
189189
}
190190
```
191191

192-
- 함수 선언에서 파라메터가 한 줄에 맞지 않아 들여쓰기를 하는 경우, 4칸 공백을 합니다. 반환 타입은 다음 줄에 배치되거나 같은 라인에 배치될 수 있습니다. 다음 라인에 쓰는 경우, 2칸 들여쓰기를 합니다.
192+
- 함수 선언에서 파라메터가 두 줄에 맞지 않아 들여쓰기를 하는 경우, 각 인자에 4칸 공백을 사용하고 각 라인에 배치 합니다. 반환 타입은 다음 줄에 배치되거나 같은 라인에 배치될 수 있습니다. 다음 라인에 쓰는 경우, 2칸 들여쓰기를 합니다.
193+
193194
```scala
194195
def newAPIHadoopFile[K, V, F <: NewInputFormat[K, V]](
195196
path: String,
@@ -211,7 +212,8 @@ Scala는 매우 강력하며 여러가지 페러다임에 적용 가능한 언
211212
}
212213
```
213214

214-
- Class의 해더가 한 줄에 맞지 않을 때는 2칸 공백 들여쓰기를 합니다. 그리고 그 해더 뒤에 한 개의 빈 줄을 입력 합니다.
215+
- 클래스의 해더가 두 줄에 맞지 않을 때는, 각 인자에 4칸 공백을 사용하고 각 라인에 배치 합니다. 또한, extends를 2칸 공백 뒤에 배치하고, 그 뒤에 한 개의 빈 줄을 입력 합니다.
216+
215217
```scala
216218
class Foo(
217219
val param1: String, // 4 space indent for parameters
@@ -224,6 +226,22 @@ Scala는 매우 강력하며 여러가지 페러다임에 적용 가능한 언
224226
}
225227
```
226228

229+
- 함수와 클래스 생성자 호출이 두 줄에 맞지 않는 경우는, 각 인자에 2칸 공백을 사용하고 각 라인에 배치 합니다.
230+
231+
```scala
232+
foo(
233+
someVeryLongFieldName, // 2 space indent here
234+
andAnotherVeryLongFieldName,
235+
"this is a string",
236+
3.1415)
237+
238+
new Bar(
239+
someVeryLongFieldName, // 2 space indent here
240+
andAnotherVeryLongFieldName,
241+
"this is a string",
242+
3.1415)
243+
```
244+
227245
- 수직 정렬을 사용하지 않습니다. 이것은 중요치 않은 코드에 집중하게 하고, 차후에 코드 수정을 어렵게 만듭니다.
228246
```scala
229247
// Don't align vertically

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ In general:
191191
}
192192
```
193193

194-
- For method declarations, use 4 space indentation for its parameters when they don't fit in a single line. Return types can be either on the same line as the last parameter, or put to next line with 2 space indent.
194+
- For method declarations, use 4 space indentation for their parameters and put each in each line when the parameters don't fit in two lines. Return types can be either on the same line as the last parameter, or start a new line with 2 space indent.
195+
195196
```scala
196197
def newAPIHadoopFile[K, V, F <: NewInputFormat[K, V]](
197198
path: String,
@@ -213,7 +214,8 @@ In general:
213214
}
214215
```
215216

216-
- For classes whose header doesn't fit in a single line, put the extend on the next line with 2 space indent, and add a blank line after class header.
217+
- For classes whose header doesn't fit in two lines, use 4 space indentation for its parameters, put each in each line, put the extends on the next line with 2 space indent, and add a blank line after class header.
218+
217219
```scala
218220
class Foo(
219221
val param1: String, // 4 space indent for parameters
@@ -226,6 +228,22 @@ In general:
226228
}
227229
```
228230

231+
- For method and class constructor invocations, use 2 space indentation for its parameters and put each in each line when the parameters don't fit in two lines.
232+
233+
```scala
234+
foo(
235+
someVeryLongFieldName, // 2 space indent here
236+
andAnotherVeryLongFieldName,
237+
"this is a string",
238+
3.1415)
239+
240+
new Bar(
241+
someVeryLongFieldName, // 2 space indent here
242+
andAnotherVeryLongFieldName,
243+
"this is a string",
244+
3.1415)
245+
```
246+
229247
- Do NOT use vertical alignment. They draw attention to the wrong parts of the code and make the aligned code harder to change in the future.
230248
```scala
231249
// Don't align vertically

0 commit comments

Comments
 (0)