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

Added analyzer project and a few initial analyzers #1905

Merged
merged 26 commits into from
Dec 4, 2022

Conversation

Measurity
Copy link
Collaborator

@Measurity Measurity commented Nov 26, 2022

  • Add code fix that replaces conditional access UnityEngine.Object?.someMember with UnityEngine.Object.AliveOrNull()?.someMember
  • Add analyzer for English localization (unknown localization key)
  • Add analyzer for lifetime bypass errors on UnityEngine.Object
  • Add analyzer to prefer interpolated string (where possible)
  • Added null contract on Validate.NotNull API (makes IDEs understand passed in value can't be null afterwards).

Note

  • This PR includes the fixes as given by the unity object lifetime analyzer.
  • This PR excludes fixes for warnings given by StringUsageAnalyzer because it would cause too many changes.

@Measurity Measurity force-pushed the analyzers branch 3 times, most recently from 535cd34 to fc9374c Compare November 26, 2022 22:16
@Measurity Measurity marked this pull request as ready for review November 27, 2022 13:05
@Measurity Measurity changed the title Added analyzer project and first analyzer that checks for conditional access on unity engine object types Added analyzer project and a few initial analyzers Nov 28, 2022
@Measurity Measurity force-pushed the analyzers branch 4 times, most recently from 9c4e5a5 to 2f1b24a Compare December 1, 2022 20:12
Measurity and others added 21 commits December 3, 2022 14:26
Analyzers MUST target netstandard2.0, do not update unless Microsoft (MSDN) says it's possible.
… API

Co-authored-by: Jannify <23176718+jannify@users.noreply.github.com>
…ider

CodeFixProvider types should override it by convention.
This analyzer detects if localization key exists in the en.json (English localization). If it does not, then a warning is emitted.
Added simple ITypeSymbol.IsType() that will properly resolve inheritance tree.
Visual Studio cannot find external libraries compiled with analyzers. See issue:
dotnet/roslyn#41785 (comment)
For now we regex parse the English localization JSON file.
@Measurity Measurity merged commit 899dde6 into SubnauticaNitrox:master Dec 4, 2022
@Measurity Measurity deleted the analyzers branch December 4, 2022 13: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.

None yet

2 participants