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

Option to disable missing_docs for trivial public init's #4107

Closed
2 tasks done
bobbradley opened this issue Aug 17, 2022 · 0 comments · Fixed by #4152
Closed
2 tasks done

Option to disable missing_docs for trivial public init's #4107

bobbradley opened this issue Aug 17, 2022 · 0 comments · Fixed by #4152
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@bobbradley
Copy link

bobbradley commented Aug 17, 2022

New Issue Checklist

New rule request

We often need trivial public init functions to allow an object to created. But this causes a missing_docs warning from SwiftLint unless we add doc comments with something generic like "Initializes xyz".

  1. Why should this rule be added? Share links to existing discussion about what
    It would be nice if there was a way to disable missing_docs for public init functions with no parameters, such as excludes_trivial_init. This would let us keep missing_docs for the other situation.

  2. Provide several examples of what would and wouldn't trigger violations.
    Example where it should not trigger if excludes_trivial_init is set.

public init() {}
public init() {}
public init() {
    self.property1 = 123
}

/// Initializes with a name.
public init(name: String) {
    self.name = name
}

Example where it should still trigger even if excludes_trivial_init is set.

public init(name: String) {
    self.name = name
}
  1. Should the rule be configurable, if so what parameters should be configurable?
    Yes, a configuration option, such as excludes_trivial_init, would be important.

  2. Should the rule be opt-in or enabled by default? Why?
    Opt-in to avoid causing problems for existing code.

@SimplyDanny SimplyDanny added the enhancement Ideas for improvements of existing features and rules. label Aug 17, 2022
marcelofabri added a commit that referenced this issue Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants