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

Reuse configs for KotlinExtension and KotlinGradleExtension #1890

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

Goooler
Copy link
Contributor

@Goooler Goooler commented Nov 18, 2023

  • KotlinFormatExtension might be a typo, renames it.
  • Unify all inner class names to *Config.
  • Eliminate boilerplates.

@Goooler
Copy link
Contributor Author

Goooler commented Nov 18, 2023

@Goooler Goooler changed the title Rename KotlinFormatExtension to KtlintFormatExtension Rename inner class names in KotlinExtension and KotlinGradleExtension Nov 18, 2023
@Goooler

This comment was marked as outdated.

@Goooler Goooler changed the title Rename inner class names in KotlinExtension and KotlinGradleExtension Reuse configs for KotlinExtension and KotlinGradleExtension Nov 18, 2023
Comment on lines -41 to +24
public class KotlinExtension extends FormatExtension implements HasBuiltinDelimiterForLicense, JvmLang {
public class KotlinExtension extends BaseKotlinExtension implements HasBuiltinDelimiterForLicense, JvmLang {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we implement HasBuiltinDelimiterForLicense for KotlinGradleExtension? If so we can move this into BaseKotlinExtension as well.

Copy link
Member

Choose a reason for hiding this comment

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

Same problem as for Groovy imo.

@nedtwigg
Copy link
Member

Another nice refactor!

@nedtwigg nedtwigg merged commit 2c2c4f7 into diffplug:main Nov 20, 2023
11 checks passed
@Goooler Goooler deleted the rename-kt-format-extension branch November 21, 2023 00:28
@msfjarvis
Copy link

I configure Spotless in my project via a local plugin which is now broken by this refactor:

e: file:///home/runner/work/compose-lobsters/compose-lobsters/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/SpotlessPlugin.kt:29:30 Cannot access 'BaseKotlinExtension': it is package-private in 'com.diffplug.gradle.spotless'
e: file:///home/runner/work/compose-lobsters/compose-lobsters/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/SpotlessPlugin.kt:35:30 Cannot access 'BaseKotlinExtension': it is package-private in 'com.diffplug.gradle.spotless'

BaseKotlinExtension not being public causes its public subclasses to also be hidden.

@Goooler
Copy link
Contributor Author

Goooler commented Nov 27, 2023

This use-case is not been covered by tests, fixing it in #1912.

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.

None yet

3 participants