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 analyzer for weighing-machine #109

Merged
merged 22 commits into from
Nov 30, 2021

Conversation

Grenkin1988
Copy link
Contributor

Fixes: #107

@Grenkin1988
Copy link
Contributor Author

Grenkin1988 commented Nov 13, 2021

This is the start, but would be nice to hear feedback if I am doing this right.
Do I need to add some additional analysis?

Copy link
Member

@ErikSchierboom ErikSchierboom left a 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.

@Grenkin1988
Copy link
Contributor Author

Grenkin1988 commented Nov 16, 2021

Oh, now we need to use VS2022

@ErikSchierboom
Copy link
Member

Oh, now we need to use VS2022

Sure. I'm using Rider BTW.

@Grenkin1988
Copy link
Contributor Author

Comments: exercism/website-copy#2134

@Grenkin1988 Grenkin1988 marked this pull request as ready for review November 17, 2021 19:26
@Grenkin1988 Grenkin1988 requested a review from a team as a code owner November 17, 2021 19:26
@ErikSchierboom
Copy link
Member

@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.

@Grenkin1988
Copy link
Contributor Author

@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

@ErikSchierboom
Copy link
Member

Lovely!

@Grenkin1988
Copy link
Contributor Author

@ErikSchierboom Hi, For some reason I cannot run tests locally, lots of error of missing files.
Could you please take a look at the "comments" PR, this way I can add tests and see them pass here at least.
Thanks

@ErikSchierboom
Copy link
Member

@Grenkin1988 I'll work on a fix in a separate PR.

N.B. I added f8772de to this PR

@ErikSchierboom
Copy link
Member

@Grenkin1988 If you rebase on this branch, you should not have the error.

@Grenkin1988
Copy link
Contributor Author

@ErikSchierboom merged everything. Looks it is ready for review

Copy link
Member

@ErikSchierboom ErikSchierboom left a 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?

@ErikSchierboom ErikSchierboom added the x:size/large Large amount of work label Nov 26, 2021
@Grenkin1988
Copy link
Contributor Author

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?

Done

Copy link
Member

@ErikSchierboom ErikSchierboom left a 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!

Comment on lines 13 to 20
public int Precision
{
get { return _precision; }
private set
{
_precision = value;
}
}
Copy link
Member

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:

Suggested change
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.

Copy link
Contributor Author

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

Copy link
Member

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;
        }
    }

?

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +17 to +19
<Content Include="@(SolutionFiles)">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Copy link
Member

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.

@ErikSchierboom ErikSchierboom merged commit 543efff into exercism:main Nov 30, 2021
@ErikSchierboom
Copy link
Member

@Grenkin1988 Is exercism/website-copy#2134 up to date with the latest renames?

@Grenkin1988
Copy link
Contributor Author

@Grenkin1988 Is exercism/website-copy#2134 up to date with the latest renames?

I will check, but it should be

@ErikSchierboom
Copy link
Member

Okay. I'll do a check on the text.

@ErikSchierboom
Copy link
Member

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add analyzer for weighing-machine
2 participants