-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
General cleanup, mostly focused on attributes/* #172
Conversation
Many/most began with a guard against the data type; this just lessens some of the rightward drift to make them slightly more approachable and and reduce the CodeClimate complexity score a bit.
Mostly extractions to local variables or minor unnesting.
The code in `limit.rb` is a bit insane and over-abstract now, but I'm trying to keep the same classes in place for now so that I don't simultaneously have to rewrite a ton of Schema::Draft1, ::Draft2 etc.
Wow... Great work, it was on my list of things to do something like this (although I was going to limit it to just the properties and properties v4 attribute). Unfortunately it is a bit hard to code review. I've had a (very) quick read through and I didn't see anything unnerving. I would be a lot more confident about merging this if I had an idea of what code coverage we have for attributes. Have you tried running simplecov over this branch and checked how well covered the attributes are? (If not I would suggest using it as a guide to add a few more tests in any coverage "black-holes") This is definitely the right direction to be going in though, IMO |
Coverage is pretty decent around attributes. I've pushed two separate branches to my fork for before/after coverage metrics (on the 2.1 run in this case, but it's roughly the same for 1.9, 2.0, jruby, rbx): master-coverage and climate-coverage. There are uncovered paths, but nothing new that I can identify except some of my |
Well ignoring, that I'd be happy to see this merged, pending more people taking a look= |
I waded through, except for f23f39b - I simply don't have the mental capability left to finish this thoroughly now ;-). |
👍 |
General cleanup, mostly focused on attributes/*
Driven mostly by running
flog
,flay
andreek
locally; CodeClimate comparison is available here.Showing 39 changed files with 528 additions and 605 deletions.
, but that's largely due to removing a level or two of indents from theFooAttribute
classes.Primary changes:
FooAttribute
classes started withif data.is_a?(Foo)
; converted these toreturn unless data.is_a?(Foo)
. See bc04d2f.current_schema.schema
).minLength
,maxItems
,maximum
, etc etc all derive from aLimitAttribute
class, and live in the same file (175e7dc). I don't really like growing the class hierarchy, andLimitAttribute
itself is now too abstract for my taste, but each of those classes were previously copypasta with mostly one or two keywords changed.NoMethodError: undefined method 'keys' for [["c", "c"]]:Array
error there.If this is too big/insane to review reasonably, lemme know. I could pull the unnesting commit out of this and do it in a separate PR instead, which might make this more grokkable.