-
Notifications
You must be signed in to change notification settings - Fork 506
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
Run rules during unit tests in correct order #1460
Closed
paul-dingemans
wants to merge
8
commits into
pinterest:master
from
paul-dingemans:ktlintAssertThat-rule-order
Closed
Run rules during unit tests in correct order #1460
paul-dingemans
wants to merge
8
commits into
pinterest:master
from
paul-dingemans:ktlintAssertThat-rule-order
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…specific rule. In addition to that rule, it is possible to run additional rules. In case the rule which is to be tested has defined a VisitorModifier which requires one or more additional rules to be loaded and to be enabled, it is even mandatory that those rules are added to the unit test. The goal is to execute the rules during unit tests in the same order as when running the CLI version of KtLint. During each unit test a dynamic RuleSet is being created for a limited set of rules (e.g. the rule for which the `assertThat` is created plus the additional rules specified in the unit tests). The rules in this minimized ruleSet are executed in the order as defined by the VisitorModifier as defined in the rules. * Split naming policy of rule id and rule set id. The naming policy of the latter is not changed. The naming policy of the ruleId is changed so that the ruleSetId prefix can be specified optionally. If the ruleId is not prefixed with a ruleSetId then it is assumed to be equal to "standard". For all experimental rules, the ruleSetId has been added. * Remove obsolete parameter "isUnitTestContext" from VisitorProvider * As the VisitorModifiers are now also used and checked during unit tests, it is required to run the additional rules during the lint phase as well. Some code examples in tests in which the IndentationRule is added as additional rule are changed to comply with that rule.
* Run CI on java 17 * Run tests on all LTS JDKs * Cleanup * Increase jvm heap size * Remove PR limit & Correct upload actions
* Bump Kotlin dev version to 1.7.0-Beta * Remove dup `Removed` in changelog
…lines (pinterest#1457) * Wrapping rule should not prevent comments for interfaces on separate lines Closes pinterest#1457 Co-authored-by: paul-dingemans
Includes: * removal of extra apiVersion as it by default is in sync with the kotlin version. * Kotlin 1.6.21, follow up pinterest#1455 * Enable gradle-enterprise
This rule rewrites the function signature to a single line when possible (e.g. when not exceeding the "max_line_length" property) or a multiline signature otherwise. In case of function with a body expression, the body expression is placed on the same line as the function signature when not exceeding the "max_line_length" property. Optionally the function signature can be forced to be written as a multiline signature in case the function has more than a specified number of parameters (".editorconfig" property "ktlint_function_signature_wrapping_rule_always_with_minimum_parameters")
…o ktlintAssertThat-rule-order # Conflicts: # ktlint-test/src/main/kotlin/com/pinterest/ktlint/test/KtLintAssertThat.kt
Closed as due to incorrect merge with master the squashed commit would contain too much changes. Replaced with PR #1470 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
With KtLintAssertThat an AssertJ style
assertThat
is created for a specific rule. In addition to that rule, it is possible to run additional rules. In case the rule which is to be tested has defined a VisitorModifier which requires one or more additional rules to be loaded and to be enabled, it is even mandatory that those rules are added to the unit test.The goal is to execute the rules during unit tests in the same order as when running the CLI version of KtLint. During each unit test a dynamic RuleSet is being created for a limited set of rules (e.g. the rule for which the
assertThat
is created plus the additional rules specified in the unit tests). The rules in this minimized ruleSet are executed in the order as defined by the VisitorModifier as defined in the rules.Checklist
CHANGELOG.md
is updatedIn case of adding a new rule:
README.md
is updated