Skip to content
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

Implementation of rule 3.5 - indentation #75

Merged
merged 11 commits into from
Jul 27, 2020
Merged

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Jul 17, 2020

This closes #62

What's done:

  • Implemented rule
  • Added tests
  • Updated rules-config.json
  • Updated available-rules.md

Fixmes:

  • Handle additional spaces before KDOC_LEADING_ASTERISKs
  • Improve handling of line after binary operators
  • Proper way to find top parent of chained dot calls
  • Update code style guide according to implementation

### What's done:
* Implemented rule
* Added tests
* Updated rules-config.json
* Updated available-rules.md
@codecov
Copy link

codecov bot commented Jul 17, 2020

Codecov Report

Merging #75 into master will increase coverage by 0.27%.
The diff coverage is 80.43%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #75      +/-   ##
============================================
+ Coverage     78.21%   78.48%   +0.27%     
- Complexity      407      435      +28     
============================================
  Files            23       27       +4     
  Lines          1207     1343     +136     
  Branches        389      428      +39     
============================================
+ Hits            944     1054     +110     
- Misses          114      119       +5     
- Partials        149      170      +21     
Flag Coverage Δ Complexity Δ
#unittests 78.48% <80.43%> (+0.27%) 435.00 <28.00> (+28.00)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...fn/diktat/common/config/rules/RulesConfigReader.kt 55.00% <ø> (ø) 4.00 <0.00> (ø)
...cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt 5.26% <0.00%> (-0.30%) 0.00 <0.00> (ø)
...tlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt 84.34% <50.00%> (-0.61%) 0.00 <0.00> (ø)
...tat/ruleset/utils/indentation/IndentationConfig.kt 60.00% <60.00%> (ø) 7.00 <7.00> (?)
.../cqfn/diktat/ruleset/utils/indentation/Checkers.kt 72.54% <72.54%> (ø) 0.00 <0.00> (?)
...cqfn/diktat/ruleset/rules/files/IndentationRule.kt 89.04% <89.04%> (ø) 20.00 <20.00> (?)
...tlin/org/cqfn/diktat/ruleset/constants/Warnings.kt 95.23% <100.00%> (+0.07%) 6.00 <0.00> (ø)
...eset/utils/indentation/CustomIndentationChecker.kt 100.00% <100.00%> (ø) 1.00 <1.00> (?)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a47ba89...c67a16d. Read the comment docs.

### What's done:
* Added indentation handler for KDoc
* Refactoring
# Conflicts:
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
#	diktat-rules/src/main/resources/rules-config.json
#	info/available-rules.md
@petertrr petertrr assigned petertrr and unassigned petertrr Jul 21, 2020
### What's done:
* Refactoring
* Added checker for super type list
* Added increase of indent after assignment operator
* Added checker for dot calls
* More tests
# Conflicts:
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt
#	diktat-rules/src/main/resources/rules-config.json
#	info/available-rules.md
@petertrr petertrr marked this pull request as ready for review July 22, 2020 14:47
### What's done:
* Fixed code style
### What's done:
* Refactoring
* Comments and documentation
### What's done:
* Moved IndentationRule after all other rules
configuration = IndentationConfig(configRules.getRuleConfig(WRONG_INDENTATION)?.configuration
?: mapOf())
customIndentationCheckers = listOf(
AssignmentOperatorChecker(configuration),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you check lambdas?
a newline after ->

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not explicitly; every opening brace causes increase of indentation, and as a consequence body of lambda is indented.

Copy link
Member

@orchestr7 orchestr7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's test it

@petertrr petertrr merged commit 2e3c15a into master Jul 27, 2020
@petertrr petertrr deleted the feature/#62-rule-3.5 branch July 27, 2020 08:56
petertrr added a commit that referenced this pull request Jul 31, 2020
* Implementation of rule 3.5 - indentation

### What's done:
* Implemented rule
* Added tests
* Updated rules-config.json
* Updated available-rules.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule 3.5: Use spaces for indentation, indenting is equal to 4 spaces
2 participants