-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codestyle, chapter 6 #421
Codestyle, chapter 6 #421
Conversation
### What's done: 1) Added class related rules
@@ -10,7 +10,8 @@ | |||
| [2 Comments](#c2) | [Kdoc](#c2.1), [File header](#c2.2), [Function header comments](#c2.3), [Code comments](#c2.4) | | |||
| [3 General format](#c3) | [File-related rules](#c3.1), [Indentation](#c3.2), [Empty blocks](#c3.3), [Line width](#c3.4), [Line breaks (newlines)](#c3.5), [Blank lines](#c3.6), [Horiznotal alignment](#c3.7), [Enumerations](#c3.8), [Variable declaration](#c3.9), [When expression](#c3.10), [Annotations](#c3.11), [Comment layout](#c3.12), [Modifiers](#c3.13), [Strings](#c3.14)| | |||
| [4 Variables and types](#c4) | [Variables](#c4.1), [Types](#c4.2), [Null safety and variable declarations](#4.3)| | |||
| [5 Functions](#c5) | [Function design](#c5.1) [Function parameters](#c5.2)| | |||
| [5 Functions](#c5) | [Function design](#c5.1), [Function parameters](#c5.2)| | |||
| [6 Classes](#c6) | [Classes](#c6.1), [Interfaces](#c6.2), [Objects](#c6.3)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have no ideas by for now about 6.2. and 6.3, but I will think
already written too many rules ...
Codecov Report
@@ Coverage Diff @@
## master #421 +/- ##
============================================
+ Coverage 82.49% 82.71% +0.21%
- Complexity 1347 1359 +12
============================================
Files 65 66 +1
Lines 3314 3401 +87
Branches 1056 1078 +22
============================================
+ Hits 2734 2813 +79
+ Misses 179 172 -7
- Partials 401 416 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
``` | ||
|
||
### <a name="r6.1.2"></a> Rule 6.1.2: Prefer data classes instead of classes without any functional logic | ||
Some people say that data class - is a code smell, but in case you really need to use it and your is becoming more simple because of that - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some people say that data class - is a code smell, but in case you really need to use it and your is becoming more simple because of that - | |
Some people say that data class - is a code smell, but in case you really need to use it and your code is becoming more simple because of that - |
I thought data classes are one of the killer-features of kotlin, do we really need to mention in our code style that it is considered a code smell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's why I say "some people" say :))
https://refactoring.guru/smells/data-class
} | ||
``` | ||
|
||
In this case the name of backing property (`_table`) should be the same to the name of real property (`table`), but should have underscore (`_`) prefix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this clash with requirements of identifier naming chapter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, hm, that is true - I will mention it
### What's done: Review notes
### What's done: Review notes
…o feature/chapter6
What's done: