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

Code Style: Allow a limit on method lengths #8934

Closed
kuhlenh opened this issue Feb 19, 2016 · 3 comments
Closed

Code Style: Allow a limit on method lengths #8934

kuhlenh opened this issue Feb 19, 2016 · 3 comments

Comments

@kuhlenh
Copy link

kuhlenh commented Feb 19, 2016

Several customers mentioned that they have limits on how large a method can be (this is to help developers think about "properly" decomposing methods).

Can we add a style setting to enforce a max length for a method?

@DavidArno
Copy link

👍

@DustinCampbell DustinCampbell added this to the Unknown milestone Feb 23, 2016
@bkoelman
Copy link
Contributor

How is method size to be measured? Could be lines of code. But then reformat may cause new warnings if existing size is close to the threshold.

My analyzer counts statements, see https://github.com/bkoelman/CSharpGuidelinesAnalyzer/blob/master/src/CSharpGuidelinesAnalyzer/CSharpGuidelinesAnalyzer/Rules/Maintainability/AvoidMembersWithMoreThanSevenStatementsAnalyzer.cs.

@CyrusNajmabadi
Copy link
Member

I don't think we would do this. However, a user could always write their own analyzer trivially that could encode what ever complexity checks they or their org felt was relevant.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants