-
Notifications
You must be signed in to change notification settings - Fork 299
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
Moving all default settings to .settings
file
#3718
Conversation
Just to be clear: this PR is moving all default settings values to the .settings file, correct? |
@retailcoder Yes 😀. I will edit the title. |
.settings
file.settings
file
# Conflicts: # RubberduckTests/RubberduckTests.csproj
AppVeyor is claiming a build error here, involving |
Yeah, I didn't take a closer look that an inspection was added. The default severity is now inside the |
I just noticed that I also moved the |
@rkapka but an inspection's |
return TodoExplorerVisibleOnStartup; | ||
} | ||
//Oh. Hello. I have no clue who you are... | ||
return false; | ||
} |
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.
👍
_defaultSettings = new DefaultSettings<CodeInspectionSettings>().Default; | ||
|
||
var nonDefaultInspections = foundInspections | ||
.Where(inspection => !_defaultSettings.CodeInspections.Select(x => x.Name).Contains(inspection.Name)); |
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 think that's iterating the inspection settings twice. .Any()
could help here I think:
var nonDefaultInspections = foundInspections
.Where(inspection => !_defaultSettings.CodeInspections.Any(x => x.Name == inspection.Name));
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.
Any
also iterates, so I will extract the names to a HashSet to avoid 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 does, but Select
is first projecting all elements into an IEnumerable<string>
, which Contains
then iterates. Any
skips the projection part; HashSet seems overkill.
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.
This part got removed.
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
var hashCode = Name?.GetHashCode() ?? 0; | ||
hashCode = (hashCode * 397) ^ (int)Severity; |
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.
Holy crap, nice catch!! 😲
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 amount of cleanup is impressive, some serious issues are fixed too, very good PR! I have a concern about the InspectionType
though - see comments. I think this PR is the pefect opportunity to clear this up. Thanks!
While InspectionTypes should not be a user-configurable setting, I think it's not a generally bad decision to make such settings configurable through our app settings. This should also remove the tests on all the inspections that check for a certain AFAIK we do not overwrite the Inspection's InspectionType with values read from settings, so in itself it's not used and should be removed... |
@Vogel612 the Ideally the config file would drive what the |
@retailcoder How about making |
@rkapka that can work... We just don't want the inspection types to end up in the serialized xml config file. |
This will need to incorporate the new settings for #3717 |
# Conflicts: # RubberduckTests/Inspections/ObjectVariableNotSetInspectionTests.cs
…o `.settings` file
That would be all except leaving the inspection type setting out of the user-specific settings file. Excluding the property from serialization will prevent the For now the inspection type is visible in the user file, but it is ignored by the configuration provider. Any comments/ideas? |
Also fixes #2240 |
I think that's more than good enough... the configuration file is intended to be accessed from the settings dialog.. I guess we can consider it by-design. |
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.
thanks for this 👍
Closes #3555