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

Umbrella: Leftovers for local functions #92

Closed
16 tasks done
bkoelman opened this issue Sep 16, 2017 · 2 comments
Closed
16 tasks done

Umbrella: Leftovers for local functions #92

bkoelman opened this issue Sep 16, 2017 · 2 comments

Comments

@bkoelman
Copy link
Contributor

bkoelman commented Sep 16, 2017

Similar to methods, local functions should probably be constrained in their maximum number of parameters (AV1561) and maximum number of statements (AV1500). Tracked by #140.

Likewise, mentions in other rules may need to be expanded to include local functions. In most cases, it should be sufficient to replace "methods" or "members" with: "methods/members and local functions".

Additionally, we may want to provide guidance on when to (not) use local functions:

Discussed in #96 (comment):

public IEnumerable<T> Enumerate<T>(IEnumerable<T> items)
{
    if (items == null)
    {
        throw new ArgumentException(nameof(items));
    }

    return InnerEnumerate(items);

    IEnumerable<T> InnerEnumerate(IEnumerable<T> array)
    {
        foreach (var item in array)
        {
            yield return item;
        }
    }
}
@dennisdoomen
Copy link
Owner

Isn't this already done?

@bkoelman
Copy link
Contributor Author

bkoelman commented May 3, 2018

We may have occasionally added local functions as part of other work. This issue tracks all potential locations.

I recall you're not such a big fan of them, so I thinks it's best for me to create individual PRs for the places they may make sense. Then you can accept/reject as you see fit.

@bkoelman bkoelman changed the title AV1500/AV1561: Consider to include local functions Umbrella: Leftovers for local functions May 7, 2018
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

No branches or pull requests

2 participants