-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Enable more Roslynator rules #21192
Enable more Roslynator rules #21192
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,10 +109,8 @@ public void Mount(string name, string explicitName = null) | |
|
||
Mount(package, explicitName); | ||
} | ||
catch | ||
catch when (optional) | ||
{ | ||
if (!optional) | ||
throw; | ||
} | ||
} | ||
|
||
|
@@ -226,14 +224,11 @@ public bool TryGetPackageContaining(string path, out IReadOnlyPackage package, o | |
public bool TryOpen(string filename, out Stream s) | ||
{ | ||
var explicitSplit = filename.IndexOf('|'); | ||
if (explicitSplit > 0) | ||
if (explicitSplit > 0 && explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage)) | ||
{ | ||
if (explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage)) | ||
{ | ||
s = explicitPackage.GetStream(filename[(explicitSplit + 1)..]); | ||
if (s != null) | ||
return true; | ||
} | ||
s = explicitPackage.GetStream(filename[(explicitSplit + 1)..]); | ||
if (s != null) | ||
return true; | ||
} | ||
|
||
s = GetFromCache(filename); | ||
|
@@ -262,10 +257,10 @@ public bool TryOpen(string filename, out Stream s) | |
public bool Exists(string filename) | ||
{ | ||
var explicitSplit = filename.IndexOf('|'); | ||
if (explicitSplit > 0) | ||
if (explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage)) | ||
if (explicitPackage.Contains(filename[(explicitSplit + 1)..])) | ||
return true; | ||
if (explicitSplit > 0 && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice if we could be consistent about whether the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not aware of one offhand, but that's not to say there isn't one somewhere. I've generally wrapped after as I think that's the more common convention in the codebase, but even in this chageset I wrap before in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually find the |
||
explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage) && | ||
explicitPackage.Contains(filename[(explicitSplit + 1)..])) | ||
return true; | ||
|
||
return fileIndex.ContainsKey(filename); | ||
} | ||
|
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 this rule was implemented incorrectly. Private setters were made public.
I'm not sure how this rule exactly works as it affected so little code, but this could make it harder to work with magic. In trait infos we use auto-implemented properties for non-yaml fields
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 mb I misunderstood, but it did indeed remove the privateness from RadarWidget
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 rule wants to change
public string SoundUp { get; private set; }
topublic string SoundUp { get; }
. However, this breaks our use of reflection inFieldLoader
/ObjectCreator
as it setsSoundUp
from YAML.I manually changed it to a field, like other things that need to be loaded from YAML, as it was the most elegant workaround I could see. This seemed like a worthwhile tradeoff so we can still enable an otherwise useful rule.
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.
Looking at git blame yeah this is supposed to be used by reflection. I thought it was purposefully added to hide it from the reflection. 85b9cf0 7eb64ea
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.
actually should have made these readonly to match other yaml defined values