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

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

Closed
petertrr opened this issue Dec 7, 2020 · 8 comments · Fixed by #816
Assignees
Labels
help wanted Extra attention is needed

Comments

@petertrr
Copy link
Member

petertrr commented Dec 7, 2020

We can't merge #615 now, because file_path is not present in user data. Ktlint now uses editorconfig (EditorConfigLoader.loadPropertiesForFile), we need to workaround it somehow.

@petertrr petertrr self-assigned this Dec 7, 2020
@petertrr
Copy link
Member Author

petertrr commented Dec 7, 2020

Similar bugs are reported in ktlint already: pinterest/ktlint#997

@petertrr petertrr changed the title KtLint 0.40.0 has changed mechanism for file path loading, need to support it KtLint 0.40.0 has changed mechanism for file path loading, we face errors when .editorconfig is missing Dec 7, 2020
@petertrr
Copy link
Member Author

They have solved this on their side, once ktlint 0.41 is out is should be safe for us to upgrade.

@petertrr
Copy link
Member Author

petertrr commented Apr 1, 2021

For ktlint 0.41, different configuration is required for gradle dependency: pinterest/ktlint#1114

@dimsuz
Copy link

dimsuz commented Apr 26, 2021

But this configuration also results in the following warning:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil (file:/home/***/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.4.31/6451ea797cef544e81f507b0d9959cd97ae09c0/kotlin-compiler-embeddable-1.4.31.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

@orchestr7
Copy link
Member

orchestr7 commented Apr 26, 2021

@petertrr what do you think? Are these warnings related to ktlint? #615 #816 pinterest/ktlint#1133

@orchestr7 orchestr7 added the help wanted Extra attention is needed label Apr 26, 2021
@orchestr7 orchestr7 linked a pull request Apr 26, 2021 that will close this issue
@orchestr7
Copy link
Member

It looks like it is a bug in Kotlin compiler: https://youtrack.jetbrains.com/issue/KT-43520

@petertrr
Copy link
Member Author

@dimsuz this warning indeed originates from ktlint, or even from kotlin compiler. It has been there in previous versions too, and it is indeed a warning, i.e. ktlint still works as expected, until this will be deprecated in JVM.

@dimsuz
Copy link

dimsuz commented Apr 26, 2021

I see, I'll star it, thanks!

petertrr added a commit that referenced this issue Nov 8, 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

Closes #616

Co-authored-by: Peter Trifanov <peter.trifanov@mail.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants