Fix editorConfig for VB, Suppress IDE001 and IDE002, clean up VB Code and XML Document formatting issues#11653
Conversation
# IDE0001: severity = silent # IDE0002: severity = silent
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11653 +/- ##
===================================================
+ Coverage 74.57429% 74.71460% +0.14030%
===================================================
Files 3041 3043 +2
Lines 629823 630427 +604
Branches 46846 46847 +1
===================================================
+ Hits 469686 471021 +1335
+ Misses 156783 156041 -742
- Partials 3354 3365 +11
Flags with carried forward coverage won't be shown. Click here to find out more. |
Ignore ExceptionUtils and Utils they are being completely replaced and VbUtils is temporary it will be replaced by ExUtils
| 'Lazy-initialized and cached log object. | ||
| Private _log As Logging.Log | ||
| ' The executing application (the EntryAssembly) | ||
| Private _info As AssemblyInfo |
There was a problem hiding this comment.
Could these be moved to the beginning of the class?
There was a problem hiding this comment.
@lonitra I had planned a separate PR to move all privates to beginning of files (right now depending on the file they are all over the place and not even together) and sort them, but give the desire to have no code changes I thorough it would not be accepted in this PR. I use CodeMaid to do the sorting, some comment changes in this PR and to prepare for the Sort.
Please advise on how you want to handle the sorting, here or in a follow-on PR?
There was a problem hiding this comment.
Handling in a follow up PR sounds reasonable
| Else | ||
| 'The name is not in the format we're expecting so return an empty string | ||
| Title = "" | ||
| title = "" |
There was a problem hiding this comment.
| title = "" | |
| title = string.Empty |
There was a problem hiding this comment.
@lonitra I go back and forth on this, since .Net 2.0 they generate identical code in VB. I can do whatever you want.
Please advise and I will make them all the same?
There was a problem hiding this comment.
In c# we typically prefer string.Empty over "" imho we should prefer string.Empty here as well.
There was a problem hiding this comment.
OK I will do them all. No need to comment on each one, updating now.
| ' Taken from appConfig | ||
| Private Const DEFAULT_FILE_LOG_TRACE_LISTENER_NAME As String = "FileLog" |
There was a problem hiding this comment.
Let's move these and the above to the beginning of the class as well
There was a problem hiding this comment.
@lonitra based on this comment and others I will sort all the files using CodeMaid.
…icationServices/CantStartSingleInstanceException.vb Co-authored-by: Loni Tra <lonitra@microsoft.com>
…icationServices/ConsoleApplicationBase.vb Co-authored-by: Loni Tra <lonitra@microsoft.com>
…icationServices/User.vb Co-authored-by: Loni Tra <lonitra@microsoft.com>
…ers/NativeTypes.vb Co-authored-by: Loni Tra <lonitra@microsoft.com>
…icationServices/ConsoleApplicationBase.vb Co-authored-by: Loni Tra <lonitra@microsoft.com>
|
@lonitra by changing "" to String.Empty a lot of additional files have changed that I have already cleaned up in a follow-on PR Do you want me to clean up those, now? |
Is the follow up PR code clean up only? If not, let's go ahead and take care of that in this PR to reduce overhead in the other. |
…c/Devices/NetworkTests.cs Co-authored-by: Loni Tra <lonitra@microsoft.com>
…c/Devices/NetworkTests.cs Co-authored-by: Loni Tra <lonitra@microsoft.com>
lonitra
left a comment
There was a problem hiding this comment.
LGTM 🥳 Please update the PR title to better reflect the changes here
|
@lonitra Do I update title on GitHub or with Visual Studio, still confused about process. |
|
Just on github. There should be an 'Edit' button next to the title of your PR at the top which will allow you to make changes to the PR title. |
…emove in future PR
KlausLoeffelmann
left a comment
There was a problem hiding this comment.
This looks good to me in general, and I would not have any issues to take this.
I only looked here and there, but couldn't do a full review.
Doing this literately seems to be working this way, I actually like this!
@lonitra - if you feel OK with this, I am OK merging this!
| ''' <param name="connectionTimeout">Time allotted before giving up on a connection</param> | ||
| ''' <param name="onUserCancel">Indicates what to do if user cancels dialog (either throw or do nothing)</param> | ||
| Public Sub UploadFile(sourceFileName As String, | ||
| address As Uri, |
There was a problem hiding this comment.
Do we want to keep this kind of formatting or align it with C#?
(We can do that in a separate PR.)
There was a problem hiding this comment.
We should align with C#, but let's do that in a separate PR as this is getting large.
There was a problem hiding this comment.
Could someone explain how formatting differs? C# formatting, I thought is largely controlled by VS and .editorConfig, VB is manual but what are the differences that need to be addressed?
There was a problem hiding this comment.
When signatures are long and need to be broken up, our C# style guidelines is to break each argument of the signature on its own line with one indent in. Unfortunately we haven't gotten to specifying vb style guidelines as a team, but for the most part we'd want to align with C#. So, for this particular method we'd want to it to look like:
Public Sub UploadFile(
sourceFileName As String,
address As Uri,
networkCredentials As ICredentials,
showUI As Boolean,
connectionTimeout As Integer,
onUserCancel As UICancelOption)|
@KlausLoeffelmann I have a full set of tests that has close to 100% coverage that will be added after this is merged. All tests ran before the changes and also pass after changes. |
First Fix for #11215 VB Code Cleanup
Proposed changes
Customer Impact
They will not need to remove ByVal when creating new Forms from Templates
Regression?
Risk
Test methodology
No code changes ByVal is VB Default and is not needed in source
This simple PR will be followed by individual tests, that will test all changes in Future VB Changes
Microsoft Reviewers: Open in CodeFlow