-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Sort and Merge Classes in WebCmdlets\Common #5662
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
Conversation
| return GetEncodingOrDefault(charSet); | ||
| } | ||
|
|
||
| internal static Encoding GetEncodingOrDefault(string characterSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markekraus We could consider to change the default to Utf8 in later PR.
| using System.Collections.Generic; | ||
| using System.Text.RegularExpressions; | ||
| using System.Linq; | ||
| using Microsoft.Win32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we don't. Should I remove it in this PR or in another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better in next - the PR is very large :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added it to the task list in #5610
| --********************************************************************/ | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is not sorted but I agree to merge "as is" - if we'll have follow formatting PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iSazonov I'm confused. This file is sorted. What is out of order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 67.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah. that one can probably be fixed with automatic property { get; private set }, which is on the checklist already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markekraus Pow("Please", 10) make the follow PRs as small as possible - split work by file/type formattings. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
@TravisEz13 I actually haven't enabled stylecop. I tried but couldn't get it to work. I believe it would apply to the entire utility assembly which would make it very hard to track down just the web cmdlet code issues. This was all somewhat beyond me. So I resorted to sorting the code manually and using the stylecop rules as guidance. We can't use them all as, for example, our contributor guidelines say to group the private backing fields with public properties. that will make it hard to see what private field and private-before-public sorting issues are actually issues. I can break it up, yes. I tried breaking up a large change into the multiple commits in a single PR before, but @iSazonov didn't like that. I don't care how the work is broken up, but I could use some guidance, clarity, and consistency. I can be told one thing in a PR/issue, follow that to the letter in a new PR, and then have reviewers telling me to redo it a different way. This pattern has repeated several times and results in a lot of wasted time for all involved. So, should I break this out into separate PRs? Or should I do multiple commits in a single PR or should I group a few commits in a few PRs? Should I move the files first? start with the partial class merges? |
|
@markekraus Can you point me to the previous PR with the objection from @iSazonov ? |
|
I think we should try to take an incremental approach. One of the reasons to enable codefactor.io on your branch (maybe we should enable it after 6.0.0 is released) is to show that the PR was an overall improvement (did not introduce more issues than in removed,) not to say that you have to fix every issue. I reviewed this link (https://smartbear.com/learn/code-review/best-practices-for-peer-code-review/) further and I agree with the line limit and the reason behind it. I spend an hour reviewing this PR and completed a few hundred lines. Is there a reason that we cannot do a simple merge of the partial classes without any sorting (perhaps you could sort the using statements?) This seems like a good starting point. |
|
Right now the pieces of the partial classes are in the same file. What constitutes a simple merge in this case? do I just move that code so it's in the same class brackets at the end of the class? One reason why I was merging and sorting at the same time is that the classes are so out of alignment it's hard to even chose a logical place to move the partial code into. I can move the code directly in the end of the larger class, but then that code is all unsorted and that's sort of how it is now, only its in its own partial class block. If i try to move it with similar element types, I might have 2 to 3 places to chose from. If i try to move it to where it should be it will be out of place because the code around it is not where it should be. |
|
Another approach would be to focus on a limited number of classes to keep under the line limit. I see one file that is over the line limit by itself. I'd say try this approach with the smaller files and we can proceed from there. @daxian-dbw @adityapatwardhan We should update the guidelines, but there should not be a requirement that a certain change is completed in a single PR unless splitting the change would have a negative effect on the project. |
|
Ok. I'm going to close this PR so I can keep the branch for reference. I turned on codefactor.io, but I'm not real happy with the full read/write access it requires. I will work on smaller chunks per PR. |
PR Summary
Reference #5610
usingstatementsInvokeRestMethodCommand.PR Checklist
Note: Please mark anything not applicable to this PR
NA.[feature]if the change is significant or affectes feature testsWIP:to the beginning of the title and remove the prefix when the PR is ready.