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

[Cleanup] Replace comments with named arguments #10018

Open
ThomasGoulet73 opened this issue Oct 30, 2024 · 1 comment
Open

[Cleanup] Replace comments with named arguments #10018

ThomasGoulet73 opened this issue Oct 30, 2024 · 1 comment
Assignees

Comments

@ThomasGoulet73
Copy link
Contributor

In the codebase, there are a lot of comments specifying an argument value is for what argument when calling a method. These comments were probably written before "Named Arguments" were introduced in C# 7 (Documentation).

Here's an example of code that could use named arguments instead of comments:

result = LookupMember(name, false /*skipReadOnlyCheck*/);

Replacing them would make the code more readable and improve the maintainability. It would improve maintainability because renaming the argument in the called method without renaming the named arguments in the calls to said method would break the build instead of making the comments innacurate (Some comments in the code base are already innacurate).

Unfortunately, it's not easy to automate this change. Some comments are to explain the value instead of naming the argument and some comments are innacurate (E.g.: The argument was renamed), this means that it requires some manual work. I'm able to make it work with a couple of regexes and some manual edits.

@ThomasGoulet73 ThomasGoulet73 self-assigned this Oct 30, 2024
@ThomasGoulet73
Copy link
Contributor Author

I assigned this to myself since I plan on working on it. I already did it for a couple of projects locally but I wanted to open the issue for tracking and to have people's opinion.

ThomasGoulet73 added a commit to ThomasGoulet73/wpf that referenced this issue Nov 13, 2024
ThomasGoulet73 added a commit to ThomasGoulet73/wpf that referenced this issue Nov 13, 2024
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

2 participants