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

ReturnCount: Make configuration parameter more explicit #5062

Merged
merged 2 commits into from Jul 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -59,7 +59,7 @@ class ReturnCount(config: Config = Config.empty) : Rule(config) {
@Configuration("define the maximum number of return statements allowed per function")
private val max: Int by config(2)

@Configuration("define functions to be ignored by this check")
@Configuration("define a free-form comma separated list of function names to be ignored by this check")
Copy link
Member Author

Choose a reason for hiding this comment

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

re "free-form": https://en.wikipedia.org/wiki/Free-form_language

In computer programming, a free-form language is a programming language in which the positioning of characters on the page in program text is insignificant. Program text does not need to be placed in specific columns as on old punched card systems, and frequently ends of lines are insignificant.

Copy link
Member

Choose a reason for hiding this comment

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

Interensting... this shouldn't be a String this should be a List<String>.

Copy link
Member Author

Choose a reason for hiding this comment

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

Different issue ;) in here I just wanted to focus on improving the docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

But on a related note: ForbiddenImport has the same problem, but there it's on the happy path, not an exceptional setup.

Copy link
Member

Choose a reason for hiding this comment

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

Why do you say that ForbiddenImport has that issue? It shouldn't.

Copy link
Member Author

Choose a reason for hiding this comment

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

ForbiddenImport was changed in v1.18.0-RC1 by 8e1328a, and we're on 1.18.1 and it still uses a single string, and it works, but anyway, I see in the JSON schema it's now an array and also it's history now :)

private val excludedFunctions: SplitPattern by config("equals") { SplitPattern(it) }

@Configuration("if labeled return statements should be ignored")
Expand Down