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

Rule request: One class/protocol/struct/enum declaration per file #2802

Closed
LucasVanDongen opened this issue Jul 8, 2019 · 2 comments · Fixed by #5377
Closed

Rule request: One class/protocol/struct/enum declaration per file #2802

LucasVanDongen opened this issue Jul 8, 2019 · 2 comments · Fixed by #5377
Labels
rule-request Requests for a new rules.

Comments

@LucasVanDongen
Copy link

New rule request

  1. I often kind of leave a mess of structs and classes in one file until I find a suitable solution. But afterwards I find myself cleaning them up and giving them their own files because the protocol needs to go into my test project but the implementation doesn't, file sizes grow too large etcetera
  2. Having more than one class declaration in one file would trigger the warning.
  3. Perhaps there could be some extra rules to include or exclude protocol, struct or enum definitions in this count. Also it might be fine to have one of each in the file but not more than one of each kind.
  4. I can only judge from my own experience if I say it should probably be default. I don't see too many projects that are well-structured but still have multiple class definitions in one fie.
@LucasVanDongen LucasVanDongen changed the title Rule request: One class per file Rule request: One class/protocol/struct/enum declaration per file Jul 8, 2019
@PaulTaykalo PaulTaykalo added the rule-request Requests for a new rules. label Nov 8, 2019
@mzeeshanid
Copy link
Contributor

Here is the detailed article.

@LucasVanDongen
Copy link
Author

Thank you for your initiative @mzeeshanid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@PaulTaykalo @mzeeshanid @LucasVanDongen and others