-
Notifications
You must be signed in to change notification settings - Fork 754
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
Fixes stylecop warnings in resource manager project. #4065
Fixes stylecop warnings in resource manager project. #4065
Conversation
- Added stylecop reference in project - Added stylecop analyzer to project - Fixes about 1000 stylecop warnings in the resource manager project.
Did you add the StyleCop.Analyzers reference manually? I was expecting to see it in a |
This is great, thanks for the hard work in fixing this. If there are 0 build warnings in this project, can you turn on 'Treat Build Warnings as Errors' in the csproj? If there are still build warnings due to deprecation notices, please cite them here in the PR and I can try and provide some guidance |
There are still 2 or 3 warnings, I will post them shortly here |
@ahoefling So the 2 warnings I get are:
I find that strange because I removed the existing Newtonsoft.Json reference and re-added it from the main packages folder.
And well this one, I need @bdukes I added the existing stylecop.json file to the project and then I went to references and added an analyzer reference to the main packages folder stylcop folder and then 2 dlls, one is the analyzer and the other dll is the codefix helpers. Is that correct? |
Another thing I was thinking while working in there is that there are a lot of public methods on something I believe should never be used by 3rd parties, I believe this is a module and not a public api thing, should I try and go change everything possible from There are also a couple of methods that have 0 references to them, I was thinking to remove them... Thoughts ? |
Oh and yeah, related to that... Interface members have no access modifiers, so the implementation defines the access modifiers on the methods as needed. So what happens if a 3rd party tries to dependency inject that but then it ends up the members are protected ? Should we make the actual whole interface |
@valadas are there interfaces in this project that you're concerned about? You don't need to worry about someone implementing interface members with the "wrong" access modifier. When you're using a reference with the interface type (e.g. Feel free to remove methods with no references. As we mentioned in the TAG meeting, since this isn't published on NuGet, we're not concerned about it exposing public members, and we're free to adjust visibility to For now, instead of The |
By design the interface specification in .NET defines public members that other classes that inherit the interface are required to implement. The interface members define a public contract and should always be public. You can use explicit interface implementations to restrict the interface members at the class level. However, that technique only hides the members, if you cast it to the interface you will instantly gain access to it because interface members are public. This is not an anti-pattern it is working as designed. It is a core pillar of object oriented programming to depend on abstractions which is exactly what an interface is accomplishing for us. When you change your interface implementation in the future, the code that depends on the interface does not need to change. Thanks @bdukes for providing a good explanation to this question as well 💪
The current abstractions of
This is most likely due to NuGet being corrupted for the project. Try the following steps to resolve this problem.
This technique will clean up any broken references and allow the Visual Studio tooling to install the package reference correctly |
|
@valadas I don't think I saw the csproj updated to treat warnings as build errors. Would you like me to submit a PR for this? I am really happy that we removed all build warnings, but without a build tool in place to prevent it from happening we will likely get back to having build warnings again |
@ahoefling Yeah, I would be happy with that sure. |
Summary