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

C# Line Delengthening #3776

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ayoitslilith
Copy link
Member

Breaks up lines into more lines because they were all unsightly (and too long for readability!)
Not all lines are broken up. Some I was uncertain about - see here. Others, I made the decision to not break them up for readability's sake. These are <5 characters over the limit (but most often just one) , and the characters that are over the limit are typically of the ) or ; varieties. I can go back and list these, however, they will likely be listed with the ones I was uncertain regarding a fix.

Copy link
Member

@pepone pepone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, didn't check all tests.

@bernardnormier
Copy link
Member

Others, I made the decision to not break them up for readability's sake. These are <5 characters over the limit (but most often just one) , and the characters that are over the limit are typically of the ) or ; varieties.

Sometimes > 120 lines is ok, but the reasons you list are not good ones. The reason to go over 120 lines are:

  • long string literals where breaking them up decreases readability
  • long list of return values in a method signature, where we want to keep the return next to the method name

@ayoitslilith ayoitslilith force-pushed the csharp-line-delengthening branch from 18cfce1 to bd2cf24 Compare March 26, 2025 18:33
@ayoitslilith ayoitslilith marked this pull request as ready for review March 26, 2025 18:44
Comment on lines +368 to +371
protected sealed override void QueueTask(
System.Threading.Tasks.Task task) => execute(
() => TryExecuteTask(task),
null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a using for System.Threading.Tasks and then write

protected sealed override void QueueTask(Task task) =>
    execute(() => TryExecuteTask(task), null);

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's already auto-used.


public void add(
string name,
System.Reflection.MethodInfo method,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a using for System.Reflection would be clear to shorten these names, unless it causes a conflict.

@bernardnormier bernardnormier self-requested a review March 26, 2025 20:48
@@ -444,7 +448,8 @@ internal static void doListen(Socket socket, int backlog)
}
}

internal static int getProtocolSupport(IPAddress addr) => addr.AddressFamily == AddressFamily.InterNetwork ? EnableIPv4 : EnableIPv6;
internal static int getProtocolSupport(IPAddress addr) =>
addr.AddressFamily == AddressFamily.InterNetwork ? EnableIPv4 : EnableIPv6;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is good!

Comment on lines +368 to +371
protected sealed override void QueueTask(
System.Threading.Tasks.Task task) => execute(
() => TryExecuteTask(task),
null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's already auto-used.

Copy link
Member

@pepone pepone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

string name,
System.Reflection.MethodInfo method,
System.Reflection.PropertyInfo property) =>
_attributes.Add(name, new MemberPropertyResolverI(name, method, property));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to indent _attributes here.

Suggested change
_attributes.Add(name, new MemberPropertyResolverI(name, method, property));
_attributes.Add(name, new MemberPropertyResolverI(name, method, property));

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

Successfully merging this pull request may close these issues.

3 participants