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

Update ktlint.version from 0.39.0 to 0.43.0 #816

Merged
merged 35 commits into from
Nov 8, 2021
Merged

Conversation

Cheshiriks
Copy link
Member

@Cheshiriks Cheshiriks commented Apr 1, 2021

What's done:

  • Updates ktlint.version from 0.39.0 to 0.43.0
  • Increased minimum required gradle version to 5.3
  • Fix how file path is passed to Params in diktat-maven-plugin
  • gradle plugin with absolute paths doesn' work on Windows and Mac (windows - because of short directory names like C:\Users\MYUSER~1\... that can't be properly resolved in Java) - so forbid absolute path in gradle plugin
  • Disable standard ruleset in CLI test
  • Add tests for CLI execution with absolute paths

### What's done:
* Updates ktlint.version from 0.39.0 to 0.41.0
@petertrr
Copy link
Member

petertrr commented Apr 3, 2021

Looking at the tests, it seems that since gradle metadata has seen its first stable release in 5.3, we should increase a minimum required gradle version and increase the version in tests. 5.0, which we have now, is pretty outdated now anyway.
Btw, actual error is because class Bundling is available since 5.3.

@@ -27,6 +27,7 @@ import sun.reflect.ReflectionFactory
/**
* A class that wraps kotlin compiler's code parser and converts source code into AST
*/
@Suppress("EMPTY_BLOCK_STRUCTURE_ERROR")
Copy link
Member

Choose a reason for hiding this comment

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

Why? It should be fine with current snapshot

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the project failed on this error

### What's done:
* Updates ktlint.version from 0.39.0 to 0.41.0
@codecov
Copy link

codecov bot commented Apr 5, 2021

Codecov Report

Merging #816 (ce196cf) into master (9fb026f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #816      +/-   ##
============================================
+ Coverage     83.74%   83.75%   +0.01%     
  Complexity     2433     2433              
============================================
  Files           102      102              
  Lines          6126     6132       +6     
  Branches       1820     1820              
============================================
+ Hits           5130     5136       +6     
  Misses          273      273              
  Partials        723      723              
Flag Coverage Δ
unittests 83.75% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
...rg/cqfn/diktat/plugin/gradle/DiktatGradlePlugin.kt 100.00% <100.00%> (ø)
...qfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt 89.02% <100.00%> (+0.56%) ⬆️
...lin/org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt 74.13% <100.00%> (ø)

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 9fb026f...ce196cf. Read the comment docs.

### What's done:
* Updates ktlint.version from 0.39.0 to 0.41.0
@Cheshiriks Cheshiriks force-pushed the feature/ktlint-0.41.0 branch 2 times, most recently from 8db36b6 to df40d26 Compare April 7, 2021 16:13
### What's done:
* Updates ktlint.version from 0.39.0 to 0.41.0
@Cheshiriks
Copy link
Member Author

Cheshiriks commented Apr 8, 2021

Now userData["file_path"] in Ktlint contains only file name. This makes full path not available for rules. Some tests also crashed

issue pinterest/ktlint#1133

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.

It looks like we need to think about the move to the newest version of ktlint or some other framework, because diktat cli is working incorectly with ktlint 0.39 (not able to disable standard ruleset)

@petertrr
Copy link
Member

@Cheshiriks ktlint 0.42.0 is out. Please update this PR, bump version and see, if any of our problems are solved in the new version (IIRC, file patterns should work better now)

# Conflicts:
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter2/kdoc/KdocMethods.kt
#	pom.xml
### What's done:
* Update ktlint version
@petertrr
Copy link
Member

petertrr commented Aug 4, 2021

We should also disable standard rulesetes in our test for CLI execution

@petertrr petertrr changed the title Update ktlint.version from 0.39.0 to 0.41.0 Update ktlint.version from 0.39.0 to 0.42.0 Aug 5, 2021
### What's done:
* Debug logging
* Cleanup
### What's done:
* Fix in maven plugin
### What's done:
* Use snapshot version
* Enable content filtering of gradle repos
### What's done:
* Use snapshot version
* Enable content filtering of gradle repos
### What's done:
* Disable gradle tests with absolute paths on Windows
* Add CLI tests with absolute paths
### What's done:
* Disable gradle tests with absolute paths on Windows
* Add CLI tests with absolute paths
### What's done:
* Disable gradle tests with absolute paths on Windows
* Add CLI tests with absolute paths
@petertrr petertrr changed the title Update ktlint.version from 0.39.0 to 0.42.0 Update ktlint.version from 0.39.0 to 0.43.0-SNAPSHOT Aug 23, 2021
### What's done:
* Revert changes related to snapshot ktlint
* Update gradle to 7.2
@petertrr petertrr changed the title Update ktlint.version from 0.39.0 to 0.43.0-SNAPSHOT Update ktlint.version from 0.39.0 to 0.43.0 Nov 3, 2021
### What's done:
* Align version of kotlin plugin for gradle plugin with embedded kotlin into gradle
* Code style
### What's done:
* Remove -Werror from diktat-gradle-plugin
### What's done:
* Forbid usage of absolute paths in diktat-gradle-plugin
### What's done:
* Forbid usage of absolute paths in diktat-gradle-plugin
@orchestr7 orchestr7 marked this pull request as ready for review November 8, 2021 11:11
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2021

Codecov Report

Merging #816 (7ef53cf) into master (631c10e) will decrease coverage by 0.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #816      +/-   ##
============================================
- Coverage     83.41%   83.40%   -0.02%     
  Complexity     2453     2453              
============================================
  Files           102      102              
  Lines          6137     6139       +2     
  Branches       1838     1839       +1     
============================================
+ Hits           5119     5120       +1     
  Misses          274      274              
- Partials        744      745       +1     
Flag Coverage Δ
unittests 83.40% <66.66%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
...qfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt 88.46% <ø> (ø)
...lin/org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt 70.17% <0.00%> (-1.76%) ⬇️
...rg/cqfn/diktat/plugin/gradle/DiktatGradlePlugin.kt 100.00% <100.00%> (ø)

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 631c10e...7ef53cf. Read the comment docs.

### What's done:
* Use ktlint fat jar from maven central, because the one at GH releases is broken
### What's done:
* Use ktlint fat jar from maven central, because the one at GH releases is broken
@petertrr petertrr merged commit 45f91c9 into master Nov 8, 2021
@petertrr petertrr deleted the feature/ktlint-0.41.0 branch November 8, 2021 12:11
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.

KtLint 0.40.0 has changed mechanism for file path loading, we face errors when .editorconfig is missing
4 participants