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

Extract legacy formatter code #1432

Closed
xaviershay opened this issue Mar 22, 2014 · 25 comments
Closed

Extract legacy formatter code #1432

xaviershay opened this issue Mar 22, 2014 · 25 comments
Assignees
Milestone

Comments

@xaviershay
Copy link
Member

@JonRowe

I don't understand what has to happen here but if there is a way I can assist let me know.

@myronmarston
Copy link
Member

During my code audit of rspec-core I noticed some things that I think could be improved as part of the final touchups to formatters for RSpec 3. Figured I'd throw them up here for dicsussion:

  • BaseFormatter has a bunch of logic to identify the slow examples or groups for profiling. It would be better to move that into some kind of object formatters can delegate to. Would it fit on one of the notification objects?
  • Likewise, I think the logic to find/read the failed line can/should be moved a notification or something else that can be delegated to.
  • In general, it would be great to get BaseFormatter to a point where there's no significant advantage to subclassing it (and maybe we can do away with it entirely...). The more custom formatters can do through delegating to the notification objects the better, IMO.
  • Likewise, Helpers is just a bag of methods -- for any of them that are only useful for one notification it would be good to move them onto that notification object.

I definitely don't want to bike shed on the formatter stuff and delay the RC release but figured it's at least worth mentioning. I imagine some of this may already be on your radar, @JonRowe.

@myronmarston
Copy link
Member

BTW, here are some prior discussions of the legacy formatter support gem:

#1304 (comment)
#1309 (comment)

@yelled3
Copy link

yelled3 commented Mar 24, 2014

@myronmarston I'll be happy to assist

@JonRowe JonRowe self-assigned this Mar 24, 2014
@JonRowe
Copy link
Member

JonRowe commented Mar 24, 2014

@yelled3 no need, this is my pet project ;)

@JonRowe
Copy link
Member

JonRowe commented Mar 24, 2014

BaseFormatter has a bunch of logic to identify the slow examples or groups for profiling. It would be better to move that into some kind of object formatters can delegate to. Would it fit on one of the notification objects?

Hmm, I've actually been thinking about a profiling formatter, I wonder if theres scope to make it independent like deprecations.

Likewise, I think the logic to find/read the failed line can/should be moved a notification or something else that can be delegated to.

I was thinking it could probably be extracted into the notification.

In general, it would be great to get BaseFormatter to a point where there's no significant advantage to subclassing it (and maybe we can do away with it entirely...). The more custom formatters can do through delegating to the notification objects the better, IMO.

This has been one of my goals too

Likewise, Helpers is just a bag of methods -- for any of them that are only useful for one notification it would be good to move them onto that notification object.

Yep

@myronmarston
Copy link
Member

BaseFormatter has a bunch of logic to identify the slow examples or groups for profiling. It would be better to move that into some kind of object formatters can delegate to. Would it fit on one of the notification objects?

Hmm, I've actually been thinking about a profiling formatter, I wonder if theres scope to make it independent like deprecations.

This has previously been discussed in #726, FWIW. I'm definitely open to the idea, although I had some (minor) concerns I expressed there about it. What do you see as the advantages to making it a separate formatter?

@JonRowe
Copy link
Member

JonRowe commented Apr 1, 2014

@myronmarston can you set up a repo for the extracted gem?

@myronmarston
Copy link
Member

Sure. What should it be called? rspec-legacy_formatter_support? (required as rspec/legacy_formatter_support)?

@JonRowe
Copy link
Member

JonRowe commented Apr 1, 2014

Personally I like rspec-legacy-formatters and then require 'rspec/legacy/formatters' which has symmetry with core.

@myronmarston
Copy link
Member

Hmm, I think legacy as a directory is kinda weird, personally. I'm fine with rspec-legacy_formatters (rspec/legacy_formatters) if you like...

@JonRowe
Copy link
Member

JonRowe commented Apr 1, 2014

I think of it as a namespace, the fact it requires a folder is immaterial (to me), and as a namespace I think it makes sense. (we may one day have legacy matchers, or such), but I'd be ok with rspec-legacy_formatters

@myronmarston
Copy link
Member

Anyone else have an opinion? My preference is very slight...

/cc @xaviershay @samphippen @soulcutter @alindeman @cupakromer

@soulcutter
Copy link
Member

I can see it both ways, but I probably have a minor preference for rspec-legacy_formatters simply because it's less-nested and ruby isn't the nicest with deep namespace nesting (which some may say is an advantage).

@JonRowe
Copy link
Member

JonRowe commented Apr 1, 2014

rspec-legacy-formatters has the advantage of being consistent with -'s, which humans find easier ;)

@soulcutter
Copy link
Member

rspec-collection_matchers exists, so it's not as though we're breaking ground mixing - and _ here.

The amount of thought that has gone into this is probably too much :)

@fables-tales
Copy link
Member

the _ is for joining words, the - is for separating them. rspec-legacy_formatters makes most sense to me as the legacy formatters are more tightly bound together than the RSpec is.

@myronmarston
Copy link
Member

Cool, I'll name it that then.

@myronmarston
Copy link
Member

@JonRowe
Copy link
Member

JonRowe commented Apr 1, 2014

the _ is for joining words, the - is for separating them. rspec-legacy_formatters makes most sense to me as the legacy formatters are more tightly bound together than the RSpec is.

With gem naming they represent the underlying structure, not the words. - is used to denote namespaces and thus folders, and _ is used to represent camelcased constants.

@xaviershay
Copy link
Member Author

paint it green

@JonRowe
Copy link
Member

JonRowe commented Apr 11, 2014

@myronmarston
Copy link
Member

@JonRowe, which of the additional items discussed above do you plan to do?

@JonRowe
Copy link
Member

JonRowe commented Apr 24, 2014

I'm going to focus on this next week

@myronmarston
Copy link
Member

Which of those items do you plan to do? Also, would it help you get those done faster if I took over the rspec-legacy_formatters work?

@myronmarston
Copy link
Member

Closing this one now that the remaining items have separate issues opened for them.

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

No branches or pull requests

6 participants