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

Moving pinning attributes and the pinned analyzer #921

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

alamarre
Copy link
Contributor

This could be broken up into a couple PRs. Either way we'll want bring in the analyzer before switching the attributes and removing the analyzers from the LMS. The recursive pinned analyzer in the LMS isn't where we'll want it to be, due to not incorporating changes that prevent it from erroring immediately so we can remove that from the LMS before bring in the new one.

I also refactored what's in the LMS repo to clean it up a bit and start from the symbol rather than the syntax node.

@alamarre alamarre requested review from mthjones, a team and cesar-d2l and removed request for a team September 29, 2023 14:14
tests/D2L.CodeStyle.Analyzers.Test/Pinning/PinnedTests.cs Outdated Show resolved Hide resolved

m_analyzers = analyzers.ToImmutableArray();

AdditionalText allowedList = new StringAdditionalText( "UnpinnedAllowedList.txt", $@"System.Collections.Generic.Dictionary`2" );
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this added for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other analyzers use it. I removed the other methods that aren't used, but left minor changes like this so that it was less work to do it as 3 PRs without missing anything, since some of the changes came from working on the must be pinned analyzer, but were for the recursive pinning.

src/D2L.CodeStyle.Analyzers/Pinning/PinnedAnalyzer.cs Outdated Show resolved Hide resolved
using Microsoft.CodeAnalysis;
using NUnit.Framework;

namespace D2L.CodeStyle.Analyzers.Tests.Pinning {
Copy link
Member

Choose a reason for hiding this comment

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

Could these be done as spec tests instead? See the "spec" folder in this project (spec = specification 🤷 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there documentation on them?

Copy link
Contributor

Choose a reason for hiding this comment

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

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've moved the analyzer to it's own branch and implemented spec tests in there. You can preview them if you want. main...alamarre/add-pinned-analyzer

@alamarre alamarre force-pushed the alamarre/add-pinning-attributes branch from 9b77639 to ee04d8a Compare October 11, 2023 15:15
@alamarre
Copy link
Contributor Author

This could be broken up into a couple PRs.

Doing so after discussion of changing must be recursively pinned to must be deserializable.

cesar-d2l
cesar-d2l previously approved these changes Oct 11, 2023
@alamarre alamarre marked this pull request as ready for review October 13, 2023 14:45
@omsmith
Copy link
Contributor

omsmith commented Oct 13, 2023

Just for reference - curious why we're moving these here from the LMS? I'm assuming its so they can be used in D2L.Core or something?

@alamarre
Copy link
Contributor Author

Just for reference - curious why we're moving these here from the LMS? I'm assuming its so they can be used in D2L.Core or something?

That is the primary driver. It could be handled in another way, but it also does enforce that the analyzers run on all the LMS libraries in a way that's not easily / accidentally undone.

mthjones
mthjones previously approved these changes Oct 19, 2023
@alamarre alamarre dismissed stale reviews from mthjones and cesar-d2l via 19efbc2 October 24, 2023 13:36
@j3parker
Copy link
Member

Has this PR been descoped? It looks like the analyzer is no longer included

@alamarre
Copy link
Contributor Author

alamarre commented Oct 24, 2023

Has this PR been descoped? It looks like the analyzer is no longer included

Yes, as per my comment on the 11th due in part to the renaming of the one attribute.

Copy link
Contributor

@omsmith omsmith left a comment

Choose a reason for hiding this comment

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

Don't really have any context for the plan here, but adding some attributes to Annotations without corresponding analyzers won't hurt anything, so cool.

I'll bump the version after you merge.

@alamarre alamarre merged commit c4578d2 into main Oct 30, 2023
1 check passed
@alamarre alamarre deleted the alamarre/add-pinning-attributes branch October 30, 2023 14:08
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.

6 participants