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

Refactor analyzer #82

Merged
merged 10 commits into from
Jan 19, 2024
Merged

Refactor analyzer #82

merged 10 commits into from
Jan 19, 2024

Conversation

sanderploegsma
Copy link
Contributor

@sanderploegsma sanderploegsma commented Jan 18, 2024

This ended up being a large refactor, to hopefully make the code base a little easier to understand. Here's a small overview of the largest changes.

Remove input/output handling in exercise analyzers

Previously the Exercise base class was in charge of parsing the input file and writing the JSON output. This has been broken up into several classes to make individual analyzers more easily testable. It also allows a design where multiple analyzers can be 'stacked'.

Add support for comment types

The interface documentation describes an optional type property for comments that was previously not supported. This can now be set using the CommentType enum.

Add support for collecting tags

Although the tags.json file was being written by the analyzer, it was always empty because the mechanism to add tags was not yet implemented.

Use the OO pattern for comments

Previously the analyzer comments were modeled using enums and constants. This makes it hard to keep track of which comments require parameters, and map them to the new CommentType. So instead, each comment is now modeled in a separate class. This class combines the comment key and type into one, and automatically bakes in the parameters.

Remove JSON from unit tests

The exercise analyzer unit tests now only have to check for the presence of the expected comment(s) instead of having to match the JSON output.

@sanderploegsma sanderploegsma added the x:size/large Large amount of work label Jan 18, 2024
@sanderploegsma sanderploegsma self-assigned this Jan 18, 2024
The `FailedParse` comment was removed because it doesn't make much sense to have the analyzer comment on a submission that does not even compile.

The `FileNotFound` comment was removed because the analyzer now analyzes all files in the source root, so there is no need to search for a specific file anymore.
@sanderploegsma sanderploegsma marked this pull request as ready for review January 19, 2024 11:11
@sanderploegsma sanderploegsma requested a review from a team as a code owner January 19, 2024 11:11
@sanderploegsma sanderploegsma changed the title Refactor JSON writing behavior Refactor analyzer Jan 19, 2024
@sanderploegsma sanderploegsma merged commit c7c64e1 into main Jan 19, 2024
2 checks passed
@sanderploegsma sanderploegsma deleted the refactor-json-writing branch January 19, 2024 12:01
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.

2 participants