Skip to content

Conversation

@PatrickMcSweeny
Copy link
Contributor

@PatrickMcSweeny PatrickMcSweeny commented Jun 22, 2025

I previously mentioned creating this here.

After thinking about it and experimenting, I came to the conclusion that creating a temporary solution file that can be read by the analyzer was the best approach because it most accurately reflects how the analyzer is used in the real world.

@PatrickMcSweeny PatrickMcSweeny requested a review from a team as a code owner June 22, 2025 17:49
@github-actions github-actions bot closed this Jun 22, 2025
results_json = mock
results = mock(to_json: results_json)

File.expects(:read).with(SOLUTION_PATH / "two_fer.rb").returns(code)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is no longer useful because of the new method I added.

protected
attr_reader :exercise_slug

def analysis_results(code = "")
Copy link
Contributor Author

@PatrickMcSweeny PatrickMcSweeny Jun 22, 2025

Choose a reason for hiding this comment

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

I created a parent class with a method that is called by all of the existing tests. The new method creates a temporary file and then calls the actual AnalyzeSolution class to read and parse the file.

code_to_analyze = File.read(solution_path / FILENAMES[exercise_slug])

puts "Analysing #{exercise_slug}"
classified_exercise = exercise_slug.tr('-', '_').classify
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While running the tests, I uncovered a bug where the 'classify' method was stripping the 's' off the end of 'HighScores' because the method was created to singularize Rails ActiveRecord table names into model names. This caused the analyzer to fail.

@kotp kotp reopened this Jun 22, 2025
@exercism exercism deleted a comment from github-actions bot Jun 22, 2025
@PatrickMcSweeny PatrickMcSweeny force-pushed the analyzer-test branch 2 times, most recently from 2011cc7 to a7a6bd7 Compare June 22, 2025 22:43
@PatrickMcSweeny
Copy link
Contributor Author

@SleeplessByte Could you or someone else look at this?

@IsaacG
Copy link
Member

IsaacG commented Sep 23, 2025

Does this still need guardian approval? Is it ready for a review?

@PatrickMcSweeny
Copy link
Contributor Author

@IsaacG Yes, it is ready for review.

@IsaacG IsaacG requested a review from kotp September 23, 2025 21:13
@IsaacG
Copy link
Member

IsaacG commented Sep 23, 2025

@kotp Are you still working on/reviewing this PR? It would be good to have a review from @exercism/ruby

@kotp
Copy link
Member

kotp commented Sep 24, 2025

@kotp Are you still working on/reviewing this PR? It would be good to have a review from @exercism/ruby

Yes, but I do not have enough magic powder to activate approval here. So it does not really matter all that much that I approve, or just leave it and not approve. But I will definitely make noise if there is something I see that should not happen. ;)

@IsaacG
Copy link
Member

IsaacG commented Sep 24, 2025

Yes, but I do not have enough magic powder to activate approval here. So it does not really matter all that much that I approve, or just leave it and not approve. But I will definitely make noise if there is something I see that should not happen. ;)

Your approval sends a strong signal to guardians that may not be very comfortable with Ruby! It also holds very high value as you are a track maintainer. Your approval may not directly allow the PR to be merged but it matters greatly.

@kotp
Copy link
Member

kotp commented Sep 26, 2025

Yes, but I do not have enough magic powder to activate approval here. So it does not really matter all that much that I approve, or just leave it and not approve. But I will definitely make noise if there is something I see that should not happen. ;)

Your approval may not directly allow the PR to be merged but it matters greatly.

That is why I still take the time... :)

@kotp kotp merged commit d5d974f into exercism:main Sep 26, 2025
3 checks passed
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.

4 participants