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

Fix backward incompatibility issues released via KtLint 0.45.0 and 0.45.1 #1442

Conversation

paul-dingemans
Copy link
Collaborator

Description

  • Deprecate data class 'Params' as it only provides the userData parameter which prohibits API Consumers to split the '.editorconfig' properties from the other user data.
  • Deprecate function 'toExperimentalParams' to force API Consumers to start using the 'ExperimentalParams'.
  • In ExperimentalParams clarify that 'userData' should not contain any '.editorconfig' properties. Now also a runtime error is thrown whenever the lint/format methods are called and 'userData' contains '.editorconfig' properties.
  • Remove confusing TODO's about moving methods 'lint' and 'format' to the 'ktlint-test' module.
  • Update deprecation messages to clarify intention.
  • The 'lint' and 'format' methods in module 'ktlint-core' no longer call the 'VisitorProvider' with parameter 'isUnitTestContext' enabled. API Consumers call these methods with production code for which this parameter should be disabled.
  • The RuleExtension calls the 'lint' and 'format' methods but do provide a VisitorProvider for which the parameter 'isUnitTestContext' is enabled.
  • Deprecate the 'format' which accepted the 'ExperimentalParams' and 'Iterable' while the latter is already included in the first.
  • Add new 'format' method which accepts 'ExperimentalParams' and 'VisitorProvider' only.
  • Move 'EditorConfigOverride' from 'ktlint-test' to 'ktlint-core'

Closes #1434

Checklist

  • PR description added
  • tests are added
  • CHANGELOG.md is updated

In case of adding a new rule:

  • README.md is updated
  • Rule has been applied on Ktlint itself and violations are fixed

…45.1.

* Deprecate data class 'Params' as it only provides the userData parameter
  which prohibits API Consumers to split the '.editorconfig' properties
  from the other user data.
* Deprecate function 'toExperimentalParams' to force API Consumers to
  start using the 'ExperimentalParams'.
* In ExperimentalParams clarify that 'userData' should not contain any
  '.editorconfig' properties. Now also a runtime error is thrown
  whenever the lint/format methods are called and 'userData' contains
  '.editorconfig' properties.
* Remove confusing TODO's about moving methods 'lint' and 'format' to
  the 'ktlint-test' module.
* Update deprecation messages to clarify intention.
* The 'lint' and 'format' methods in module 'ktlint-core' no longer
  call the 'VisitorProvider' with parameter 'isUnitTestContext'
  enabled. API Consumers call these methods with production code
  for which this parameter should be disabled.
* The RuleExtension calls the 'lint' and 'format' methods but do
  provide a VisitorProvider for which the parameter
  'isUnitTestContext' is enabled.
* Deprecate the 'format' which accepted the 'ExperimentalParams'
  and 'Iterable<RuleSet>' while the latter is already included
  in the first.
* Add new 'format' method which accepts 'ExperimentalParams' and
  'VisitorProvider' only.
* Move 'EditorConfigOverride' from 'ktlint-test' to 'ktlint-core'

Closes pinterest#1434
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Goooler <wangzongler@gmail.com>
@paul-dingemans paul-dingemans merged commit 71c553b into pinterest:master Apr 5, 2022
@paul-dingemans paul-dingemans deleted the 1434-backward-compatibility-0.45.1 branch April 7, 2022 17:25
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.

0.45.0 backwards incompatibility: KtLint.Params#userData gets ignored, unclear migration path + more feedback
2 participants