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

Add serveral new analysis #15

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

donaldwuid
Copy link

DoNotUseCameraMainInUpdate
ShouldCacheDelegate
Remove DoNotUseForeachInUpdate
DoNotBoxWhenInvoke
DoNotUseEnumTypeParameter
StructShouldImplementIEquatable
StructShouldOverride
DoNotUseMaterialName

DoNotUseCameraMainInUpdate
ShouldCacheDelegate
Remove DoNotUseForeachInUpdate
DoNotBoxWhenInvoke
DoNotUseEnumTypeParameter
StructShouldImplementIEquatable
StructShouldOverride
DoNotUseMaterialName
@vad710
Copy link
Owner

vad710 commented Oct 8, 2017

Thanks for contributing @donaldwuid ! I will be merging some of your analyzers - some of the analyzers are dupes with other PRs. The I also noticed that you removed the DoNotUseForEachInUpdate which is no longer an issue with newer versions of unity - but it's still an issue with older versions of unity. I'd like to add in some sort of a version check to determine which analyzers to run on which versions - what are your thoughts on this?

@Kasperki
Copy link

Kasperki commented Oct 8, 2017

@vad710 I think version check is necessary: #12 is only relevant in >= Unity 5.3.

From CLI, we know the project path, so we could then try to read ./ProjectSettings/ProjectVersion.txt ?
or let user define it as parameter?

fix normal method invocation to be delegate;
method with Conditional is allow to have boxing
fix member accessed  normal method invocation to be delegate;
shrink unsealed method span to method name only, in case that there are some methods are meant to be inherited, and too much green lines will drive developer crazy!
@donaldwuid
Copy link
Author

hello, I fix several bugs and do some improvement

@donaldwuid
Copy link
Author

If we can know the CLI version precisely, we can use it.
But if we can NOT, or it's too hard for us to make it, I suggest that our analyzer should be Conservative and just comment out the for-each analyzer.

@vad710
Copy link
Owner

vad710 commented Oct 16, 2017

@donaldwuid I think that with the new config file that @Kasperki wrote, you can specify which analyzers you want to run - I think we should keep the ForEach analyzer for now and those that don't want to use it can omit it via the config (it can even by default).

In the meantime, could you please update the PR so that there's no conflicts and has no duplicate Analyzers?

Each time you add/remove/modify your script file path, unity will re-generate csproj files, and your UnityEngineAnalyzer settings will miss.

Add AutoAddUnityEngineAnalyzer, each time unity refreshes, AutoAddUnityEngineAnalyzer will check and try to add UnityEngineAnalyzer to your csproj files
@vad710
Copy link
Owner

vad710 commented Oct 17, 2017

The branch still has conflicts even after latest commit. I'll review the changes once the conflicts have been resolved.

@donaldwuid
Copy link
Author

Sorry about the delay. I'm using mac personally, and I can only access PC & VisualStudio during workdays.
These conflicts will be done on tomorrow Monday.

By the way, since this PR, in my branch, I've commit several bug fixes, and add one Unity editor script to add our UnityEngineAnalysis.dll to csproj automatically.

@vad710
Copy link
Owner

vad710 commented Oct 22, 2017

I've began porting over a lot of the code to dotnet standard and will eventually create a mono or dotnet core version of the CLI so that folks who use Mac/Linux can take advantage of the analyzers as well. You can see what we have here: https://github.com/vad710/UnityEngineAnalyzer/tree/dotnet-standard

@donaldwuid
Copy link
Author

please hold on, this is a merge without testing

merged & tested
@donaldwuid
Copy link
Author

merged & test

@vad710
Copy link
Owner

vad710 commented Oct 23, 2017

Hi @donaldwuid - it's not clear to me what the AutoAdd is for - are you enabling the Anaylzer in Visual Studio dynamically?

public const string StructShouldOverrideGetHashCode = "AOT0006";
public const string DoNotBoxWhenInvoke = "AOT0007";
public const string DoNoUseEnumTypeParameter = "AOT0008";
public const string ShouldCacheDelegate = "AOT0009";
Copy link
Owner

Choose a reason for hiding this comment

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

I am assuming that this is a performance / GC problem not an AOT problem. Is the the correct category?

@@ -9,6 +9,9 @@

namespace UnityEngineAnalyzer.ForEachInUpdate
{
/*
Copy link
Owner

Choose a reason for hiding this comment

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

With the new version functionality, no need to comment this analyzer

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.

3 participants