Skip to content
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

Fix most build warnings from the projects #4125

Merged
merged 5 commits into from
Sep 16, 2021

Conversation

Nirmal4G
Copy link
Contributor

@Nirmal4G Nirmal4G commented Jul 22, 2021

Partially Fixes #4240

Fix most warnings from the projects! Only warnings left are MVVM from source generators.

PR Type

What kind of change does this PR introduce?

  • Refactoring (no functional changes)
  • Build/CI changes

What is the current behavior?

Build produces so many warnings. It is a source of developer's frustration and shame! 😢

What is the new behavior?

Build now produces less impactful or no warnings at all. Happy CI, Happy Dev! 😎

PR Checklist

Please check if your PR fulfils the following requirements:

  • Tested code with current supported SDKs
  • Contains NO breaking changes

Other information

  • If you're editing this patch tree, please rebase on latest HEAD and then commit, without updating from the latest HEAD.
  • When merging, please update the commit title to PR title instead of the default Merge pull request #xxxx from repo/branch, and commit message to either PR message or messages of individual commits. The auto-merge bot does this by default.

@ghost
Copy link

ghost commented Jul 22, 2021

Thanks Nirmal4G for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker, azchohfi and Rosuavio July 22, 2021 19:47
UITests/UITests.App/App.AppService.xaml.cs Outdated Show resolved Hide resolved
UITests/UITests.App/TestInterop.cs Outdated Show resolved Hide resolved
UITests/UITests.App/App.AppService.xaml.cs Outdated Show resolved Hide resolved
UITests/UITests.App/TestInterop.cs Outdated Show resolved Hide resolved
@ghost
Copy link

ghost commented Aug 2, 2021

This PR has been marked as "needs attention 👋" and awaiting a response from the team.

@Nirmal4G
Copy link
Contributor Author

@michael-hawker In response to #4173 (comment)

I'll update the EditorConfig to include rules for this..

Can we take this chance to formally set a style for the whole org? Can we also create a template repo with basic tools config, editor, build and CI settings?

@michael-hawker michael-hawker added this to the 7.1 milestone Aug 31, 2021
@michael-hawker
Copy link
Member

@Nirmal4G a template repo is something I've been wondering if we need too. Probably good to create an issue to discuss on the Wiki repo for tracking across the org so we can have a conversation with all stake-holders.

In the meantime, is there any other things to do with this PR or can we mark it as ready for review? It's fairly small at the moment, so would be easy if it's not any bigger to merge soon for our 7.1 release as part of finalization for bugs.

Otherwise we can move to the next milestone for any larger efforts. Thanks!

@Nirmal4G
Copy link
Contributor Author

Nirmal4G commented Sep 1, 2021

StyleCop warnings in generated sources

@Sergio0694 Is there anyway to suppress StyleCop warnings in generated sources?

See warnings SA1101, SA1633, SA1649 from MVVM generated sources.

I'll try to fix them. Most of them are name mismatch between filename and type (SA1649), missing comment header (SA1633) and prefix locals with this (SA1101).
Can you direct me to where the sources are being configured and generated?

.NET Native IL link & trim warnings

@michael-hawker Do we use Windows.UI.Xaml.Controls.Primitives.GeneratorPosition API anywhere in our codebase?

The warning ILT0005 is generated but I can't seem to find where we use this API or which dependency uses it?

@Sergio0694
Copy link
Member

"Is there anyway to suppress StyleCop warnings in generated sources?"

@Nirmal4G Not sure, I mean, every generated source has a #pragma warning disable directive at the top, so I would expect StyleCop to follow that and ignore warnings. If it doesn't, maybe we're missing some setting somewhere?

Anyway I wouldn't necessarily spend too much time on this given that all the .NET packages are going to a separate repo soon enough, and we'll likely end up both changing a bunch of things when we do, including style rules and configs anyway 🙂

@michael-hawker
Copy link
Member

.NET Native IL link & trim warnings

@michael-hawker Do we use Windows.UI.Xaml.Controls.Primitives.GeneratorPosition API anywhere in our codebase?

The warning ILT0005 is generated but I can't seem to find where we use this API or which dependency uses it?

Not sure, I think we used to use the ItemContainerGenerator with the old TabView, but don't see any current references to that helper class anywhere for any of our ItemsControls... 🤷‍♂️

@Nirmal4G Nirmal4G force-pushed the hotfix/warnings branch 2 times, most recently from 19df7a3 to 7b08511 Compare September 8, 2021 19:15
@michael-hawker
Copy link
Member

@Nirmal4G was there anything else to do with this one, can we move it out of draft? Just want to know if we should merge soon as it's pretty straight-forward at the moment or move to our next milestone as we're trying to close out the release?

Code CS1591: Missing XML comment for publicly visible type or member.
Code ILT0010: Could not find an assembly referenced by other assembly

The following warnings surfaced due to the missing assembly.
Since, the assembly is not found, any referenced code got hit with these warnings

Code ILT0005: The type from an assembly was not included in compilation, but was referenced in a method.
Code ILT0003: The method will always throw an exception due to the missing method in an assembly.
Code SA1208: Using directive should appear before other directives.
Code SA1210: Using directives should be ordered alphabetically by the namespaces.
Code SA1505: An opening brace should not be followed by a blank line.
Add comments describing the nature of the warning.
Code CS1591: Non-nullable field must contain a non-null value when exiting constructor.
@Nirmal4G Nirmal4G force-pushed the hotfix/warnings branch 4 times, most recently from e8df919 to 19c62a3 Compare September 10, 2021 19:37
@Nirmal4G Nirmal4G marked this pull request as ready for review September 10, 2021 20:48
@Nirmal4G
Copy link
Contributor Author

@michael-hawker All done here. I'm still investigating ILT0005 and warnings in source generated files. Seems @Sergio0694 added #pragma warning disable to generated files but it doesn't seem to work for StyleCop rules. Anyway, merge this in along with the refactor PR if there's no feedback.

Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of the blank lines between using directives as we're not doing that anywhere else, but also don't want to nitpick and delay a PR that is mostly just tweaking the style of some unit tests, so it's fine. Looks good, thanks for removing those warnings! 🙂

@michael-hawker michael-hawker merged commit f0209a3 into CommunityToolkit:main Sep 16, 2021
@Nirmal4G
Copy link
Contributor Author

I didn't add new lines at first, when I did add them and compare the two, the one with the new lines looked best. So, I kept them. If we want, the next time we touch this file, we could clean it up. But IMHO it sure does look better now!

@Nirmal4G Nirmal4G deleted the hotfix/warnings branch September 17, 2021 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Build] clean-up build warnings from all projects
4 participants