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

Replace calls to .Any() with .Count is not 0. #37

Merged
merged 2 commits into from
Feb 25, 2024
Merged

Conversation

AraHaan
Copy link
Contributor

@AraHaan AraHaan commented Feb 23, 2024

Checklist

  • I have read the Code of Conduct and the Contributing files before opening this issue.
  • I have verified the issue this pull request fixes or feature this pull request implements is to the current release.
  • I am using the latest stable release with the above code fix or the current main branch if code changes are present (prerelease code changes).
  • I have debugged and tested my changes before submitting this issue and that everything should just work.

Describe the issue this fixes / feature this adds

Fixes #36.

@AraHaan AraHaan added the enhancement New feature or request label Feb 23, 2024
@AraHaan AraHaan added this to the v1.2.0 milestone Feb 23, 2024
@AraHaan AraHaan mentioned this pull request Feb 23, 2024
@AraHaan AraHaan force-pushed the replace-any-with-count branch from de5eb2b to c1e9407 Compare February 23, 2024 17:18
@Elskom Elskom deleted a comment from mergify bot Feb 23, 2024
@Elskom Elskom deleted a comment from mergify bot Feb 23, 2024
@AraHaan AraHaan marked this pull request as draft February 23, 2024 17:37
@AraHaan AraHaan force-pushed the replace-any-with-count branch from c1e9407 to 23d615b Compare February 23, 2024 17:37
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

3 similar comments
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

src/IDisposableGenerator/DisposableCodeWriter.cs Fixed Show resolved Hide resolved
src/IDisposableGenerator/DisposableCodeWriter.cs Fixed Show resolved Hide resolved
src/IDisposableGenerator/DisposableCodeWriter.cs Fixed Show resolved Hide resolved
src/IDisposableGenerator/WorkItemCollection.cs Fixed Show resolved Hide resolved
Copy link
Collaborator

@Rekkonnect Rekkonnect left a comment

Choose a reason for hiding this comment

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

Minor nits

src/IDisposableGenerator/DisposableCodeWriter.cs Fixed Show resolved Hide resolved
src/IDisposableGenerator/DisposableCodeWriter.cs Fixed Show resolved Hide resolved
src/IDisposableGenerator/DisposableCodeWriter.cs Fixed Show resolved Hide resolved
@@ -15,8 +15,8 @@ public override string ToString()
var sb = new StringBuilder($"Namespace: Name: {this.Namespace}");
foreach (var classItems in this.Classes)
{
sb.AppendLine();
sb.Append($"Class Item {this.Classes.IndexOf(classItems)}: {classItems}");
_ = sb.AppendLine();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not too sure if applying this pattern is healthy

@@ -28,7 +25,7 @@ public void Process(INamedTypeSymbol testClass, CancellationToken ct)
var classItemsQuery =
from att in testClass.GetAttributes()
where att.AttributeClass!.Name.Equals(
"GenerateDisposeAttribute")
"GenerateDisposeAttribute", StringComparison.Ordinal)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use nameof(GenerateDisposeAttribute) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like that very much however the attribute code files does not get directly compiled to be a part of the generator assembly, instead it gets provided as basically an output from the generator itself. I guess a workaround is to reference the generator and having it run here and then use nameof(GenerateDisposeAttribute) though.

Copy link
Collaborator

@Rekkonnect Rekkonnect Feb 23, 2024

Choose a reason for hiding this comment

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

If it's included in the generated output files, it's fine. I don't find a reason to change how the API for the generator is accessible to the user.

@AraHaan AraHaan force-pushed the replace-any-with-count branch from 8a7a557 to 6c156db Compare February 23, 2024 19:36
@AraHaan AraHaan marked this pull request as ready for review February 25, 2024 11:46
@mergify mergify bot added the automerge Tells mergify that this pull request is ready for auto merge. label Feb 25, 2024
Copy link

mergify bot commented Feb 25, 2024

This pull request is about to be automerged.

Copy link

@mergify mergify bot left a comment

Choose a reason for hiding this comment

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

Automatically approving since automerge label was found.

@mergify mergify bot merged commit 472e00a into main Feb 25, 2024
12 checks passed
@mergify mergify bot deleted the replace-any-with-count branch February 25, 2024 11:47
@mergify mergify bot removed the automerge Tells mergify that this pull request is ready for auto merge. label Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace calls to .Any() with .Count is not 0.
2 participants