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

Wrapping rule should not prevent comments for interfaces on separate lines #1457

Merged
merged 5 commits into from
May 8, 2022

Conversation

hbmartin
Copy link
Contributor

@hbmartin hbmartin commented Apr 27, 2022

Description

Currently, comments on interfaces will report an error. This behavior is different than i.e. legal commenting on function parameters.

If the PR solves an issue than provide a link to that issue. -->

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

@paul-dingemans
Copy link
Collaborator

Tnx for your contribution. Most important remark is that the test case which is added also succeeds without changing the WrappingRule.

@hbmartin
Copy link
Contributor Author

hbmartin commented May 4, 2022

@paul-dingemans I've fixed your PR comments re: testing and single line.
Fwiw, this is what I see without the rule change:
image

@hbmartin
Copy link
Contributor Author

hbmartin commented May 6, 2022

@paul-dingemans thanks, should I update the changelog or is anything else needed?
Also how are you auth'd to push to my branch? afaict GHthe GitHub settings on my fork shouldn't allow that.

@paul-dingemans
Copy link
Collaborator

@paul-dingemans thanks, should I update the changelog or is anything else needed?
Indeed, changelog needs to be updated. In a next PR you can do that immediately when submitting the PR. I will now update it myself and merge the change.

Also how are you auth'd to push to my branch? afaict GHthe GitHub settings on my fork shouldn't allow that.
When creating the PR you can untick the checkbox that allows maintainers of the original repository to make changes to the branch. But for me a maintainer, it is way more comfortable to be able to push changes to your branch.

@paul-dingemans paul-dingemans merged commit 504162c into pinterest:master May 8, 2022
@paul-dingemans paul-dingemans added this to the 0.46.0 milestone May 18, 2022
paul-dingemans pushed a commit to paul-dingemans/ktlint that referenced this pull request May 19, 2022
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 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.

In order to achieve above, following is changed as well:
* 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.

Closes pinterest#1457
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.

2 participants