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

flag attribute if anything is on the same line #39

Merged

Conversation

@grantwinney
Copy link
Contributor

grantwinney commented Oct 10, 2019

This is at least a start at fixing #36.

I added 4 unit tests to show it works on a class, method, property, or enum.

@@ -38,6 +38,7 @@ private static void AnalyzeSymbol(SymbolAnalysisContext context)
if (namedTypeSymbol.GetAttributes().Any())
{
IDictionary<int, AttributeData> lineDict = new Dictionary<int, AttributeData>();
lineDict.Add(namedTypeSymbol.Locations[0].GetLineSpan().StartLinePosition.Line, null);

This comment has been minimized.

Copy link
@Keboo

Keboo Oct 10, 2019

Member
Suggested change
lineDict.Add(namedTypeSymbol.Locations[0].GetLineSpan().StartLinePosition.Line, null);
lineDict[namedTypeSymbol.Locations[0].GetLineSpan().StartLinePosition.Line] = null;

Though pretty unlikely, I believe this throws a duplicate key exception if you have two properties declared on the same line with an attribute above them.

This comment has been minimized.

Copy link
@grantwinney

grantwinney Oct 10, 2019

Author Contributor

Thanks @Keboo good catch. I just changed that bit of code because I felt like I was misusing the dictionary from its intended purpose.

@grantwinney grantwinney marked this pull request as ready for review Oct 10, 2019
@Keboo
Keboo approved these changes Oct 10, 2019
Copy link
Member

Keboo left a comment

LGTM. Thank you for the contribution.

@Keboo Keboo merged commit 6a7a351 into IntelliTect:master Oct 10, 2019
2 checks passed
2 checks passed
IntelliTect.CodingStandards Build #20191010.2 succeeded
Details
WIP Ready for review
Details
@Keboo Keboo added this to the 0.1.3 milestone Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.