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

Keep "test types" info in one location #28759

Closed
wants to merge 1 commit into from

Conversation

maclover7
Copy link
Contributor

Summary

This commit aims to centralize the "test types" constant used by
CodeStatistics. Previously, if one wanted to add a test type, you
would have to update two different constants. Now, you only have to
update one, and the changes will be properly propogated.

Other Information

Sidenote: CodeStatistics is a nodoc'ed class, so external users should
not be using it.

Inspired by #28744.

This commit aims to centralize the "test types" constant used by
`CodeStatistics`. Previously, if one wanted to add a test type, you
would have to update two different constants. Now, you only have to
update one, and the changes will be properly propogated.

Sidenote: `CodeStatistics` is a nodoc'ed class, so external users should
not be using it.

Inspired by rails#28744.
@@ -1,7 +1,18 @@
# While global constants are bad, many 3rd party tools depend on this one (e.g
# rspec-rails & cucumber-rails). So a deprecation warning is needed if we want
# to remove it.
Copy link
Member

Choose a reason for hiding this comment

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

☝🏻 I imagine this applies to TEST_TYPES too.

Not to mention the disruption that pulling out half its values could create... or the awfulness of introducing another global constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically TEST_TYPES is nested under CodeStatistics which is a nodoc class... so we explicitly say that this is internal. We're also just trading one constant for another, with the new one being more useful :)

@@ -10,20 +21,13 @@ STATS_DIRECTORIES = [
%w(Channels app/channels),
%w(JavaScripts app/assets/javascripts),
%w(Libraries lib/),
%w(APIs app/apis),
Copy link
Member

Choose a reason for hiding this comment

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

Where did this go?

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's still there, I think the diff is just pointing out that I removed the comma :)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, okay. Don't do that. ;)

@rails-bot
Copy link

rails-bot bot commented Dec 18, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@rails-bot rails-bot bot added the stale label Dec 18, 2019
@rails-bot rails-bot bot closed this Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants