-
Notifications
You must be signed in to change notification settings - Fork 460
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
Check if ktlint_code_style is set in .editorconfig before overriding it #2143
Changes from 1 commit
cf6c76f
0be12f5
ccf141e
1453214
2effcbd
f33f8be
397a7fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2016-2023 DiffPlug | ||
* Copyright 2016-2024 DiffPlug | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -127,6 +127,25 @@ void testReadCodeStyleFromEditorConfigFile() throws IOException { | |
checkKtlintOfficialStyle(); | ||
} | ||
|
||
@Test | ||
void testEditorConfigOverrideWithUnsetCodeStyleDoesNotOverrideEditorConfigCodeStyleWithDefault() throws IOException { | ||
setFile(".editorconfig").toResource("kotlin/ktlint/ktlint_official/.editorconfig"); | ||
setFile("build.gradle").toLines( | ||
"plugins {", | ||
" id 'org.jetbrains.kotlin.jvm' version '1.6.21'", | ||
" id 'com.diffplug.spotless'", | ||
"}", | ||
"repositories { mavenCentral() }", | ||
"spotless {", | ||
" kotlin {", | ||
" ktlint().editorConfigOverride([", | ||
" ktlint_test_key: true,", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, can you add a test case like 87537c0 for maven as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! While adding the test I realised that |
||
" ])", | ||
" }", | ||
"}"); | ||
checkKtlintOfficialStyle(); | ||
} | ||
|
||
@Test | ||
void testSetEditorConfigCanOverrideEditorConfigFile() throws IOException { | ||
setFile(".editorconfig").toResource("kotlin/ktlint/intellij_idea/.editorconfig"); | ||
|
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.
The key point is here, I missed checking EditorConfig file properties in #1808.