-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 analyzer for weighing-machine #109
Add analyzer for weighing-machine #109
Conversation
This is the start, but would be nice to hear feedback if I am doing this right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! I've left some small comments.
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineSyntaxFactory.cs
Outdated
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Syntax/PropertyDeclarationSyntaxExtensions.cs
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineSolution.cs
Outdated
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineSolution.cs
Outdated
Show resolved
Hide resolved
Oh, now we need to use VS2022 |
Sure. I'm using Rider BTW. |
Comments: exercism/website-copy#2134 |
@Grenkin1988 Great work! Before I'll start reviewing, there's one thing missing: tests. With an analyzer, it is really important to have a big set of tests, as we don't want to give the wrong suggestions. See https://github.com/exercism/csharp-analyzer/tree/main/test/Exercism.Analyzers.CSharp.IntegrationTests/Solutions/Gigasecond for an example of what a test suite for an analyzer looks like. |
Yes, thanks, that was the next step |
Lovely! |
@ErikSchierboom Hi, For some reason I cannot run tests locally, lots of error of missing files. |
@Grenkin1988 I'll work on a fix in a separate PR. N.B. I added f8772de to this PR |
@Grenkin1988 If you rebase on this branch, you should not have the error. |
…gration' into weighing-machine-analyzer
…n1988/csharp-analyzer into weighing-machine-analyzer
@ErikSchierboom merged everything. Looks it is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I've left some minor comments, but it looks impressive!
I noticed that there was no "approved" test case. Could you add one? That way we know that there is a solution that has no comments. Ideally, this should be the exemplar solution, so maybe you could add that as a test case?
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineComments.cs
Outdated
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineComments.cs
Outdated
Show resolved
Hide resolved
src/Exercism.Analyzers.CSharp/Analyzers/WeighingMachine/WeighingMachineComments.cs
Outdated
Show resolved
Hide resolved
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely. Just some minor comments!
...Exercism.Analyzers.CSharp.IntegrationTests/Exercism.Analyzers.CSharp.IntegrationTests.csproj
Outdated
Show resolved
Hide resolved
public int Precision | ||
{ | ||
get { return _precision; } | ||
private set | ||
{ | ||
_precision = value; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd want people to do:
public int Precision | |
{ | |
get { return _precision; } | |
private set | |
{ | |
_precision = value; | |
} | |
} | |
public int Precision { get; private set; } |
It might be good to add a rule for that in the analyzer too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule already exist, looks like test wasn't running before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a test case that verifies that a comment is made when the student uses:
public int Precision
{
get { return _precision; }
private set
{
_precision = value;
}
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It checks that autoproperty is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Content Include="@(SolutionFiles)"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is removed, Cs files are not in VS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha. Rider behaves differently then. Okay cool.
@Grenkin1988 Is exercism/website-copy#2134 up to date with the latest renames? |
I will check, but it should be |
Okay. I'll do a check on the text. |
I've reviewed the website-copy PR and left some textual comments. Great work on getting this PR merged! If you found this fun, there are tons more analyzers to implement :) |
Fixes: #107