Skip to content

Commit fd32aee

Browse files
author
oguz.celik
committed
add ktlint rules for code style guideline
1 parent 637cfd8 commit fd32aee

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ List of Architecture and code guidelines at Trendyol when developing for Android
33

44
* [Package Guideline](package_guideline/package_guideline.md)
55
* [App Architecture Guideline](README.md)
6-
* [Code Style Guideline](README.md)
6+
* [Code Style Guideline](code_style_guideline/code_style_guideline.md)
77
* [Gradle Guideline](README.md)
88
* [Analytics Architecture Guideline](README.md)
99
* [Resources Naming Guideline](resource_naming_guideline/resource_naming_guideline.md)

code_style_guideline/.DS_Store

6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Kotlin Rules
2+
3+
- 4 spaces for indentation
4+
- No semicolons (unless used to separate multiple statements on the same line)
5+
- No wildcard / unused `import`s
6+
- No consecutive blank lines
7+
- No blank lines before `}`
8+
- No trailing whitespaces
9+
- No `Unit` returns (`fun fn {}` instead of `fun fn: Unit {}`)
10+
- No empty (`{}`) class bodies
11+
- No spaces around range (`..`) operator
12+
- No newline before (binary) `+` & `-`, `*`, `/`, `%`, `&&`, `||`
13+
- When wrapping chained calls `.`, `?.` and `?:` should be placed on the next line
14+
- When a line is broken at an assignment (`=`) operator the break comes after the symbol
15+
- When class/function signature doesn't fit on a single line, each parameter must be on a separate line
16+
- Consistent string templates (`$v` instead of `${v}`, `${p.v}` instead of `${p.v.toString()}`)
17+
- Consistent order of modifiers
18+
- Consistent spacing after keywords, commas; around colons, curly braces, parens, infix operators, comments, etc
19+
20+
These are the [default rules for ktlint](https://github.com/shyiko/ktlint/blob/master/README.md#standard-rules)

0 commit comments

Comments
 (0)