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

Map metric config options directly onto the metric #167

Open
bf4 opened this issue Nov 6, 2013 · 8 comments
Open

Map metric config options directly onto the metric #167

bf4 opened this issue Nov 6, 2013 · 8 comments

Comments

@bf4
Copy link
Member

bf4 commented Nov 6, 2013

e.g. if reek takes a --config flag, map a reek :config option's value onto the --config flag.

Similarly, remove options that don't map directly onto the metric, or have a separate way to specify them.

This should be true whether the metric is run as a library or externally.

@danmayer
Copy link

can you explain a bit more... does this mean for libs like churn...

metric_fu churn config would be something like {:ignore_files => "files, to, ignore", : start_date => "6 months ago"}

that would turn into churn cmd churn --ignore_files "files, to, ignore" --start_date ""6 months ago"

while something we use programmatically we would just past the config options straight through to the tools class options?

@bf4
Copy link
Member Author

bf4 commented Nov 11, 2013

@danmayer yes, that's ultimately the goal, to pass the options through to the library (some gems aren't easily used as libraries and some I/we just haven't sought out yet to check if it works just as well.

In any case, unless a gem library has a documented internal api, I think we should rely on the 'documented' api for how to pass options from metric fu.

@danmayer
Copy link

OK yeah makes sense... Want me to send a PR your way moving from using churn on cmd line to using the ChurnCalculator class directly.

Should be something like

 #get the options from metric_fu opposed to this params hash
 options = {:minimum_churn_count => params['minimum_churn_count'].value,
  :ignore_files => params['ignore_files'].value,
  :start_date => params['start_date'].value,
  :data_directory => params['data_directory'].value,
  :history => params['past_history'].value,
  :report => params['report'].value,
  :name => params['name'].value
}
#passing false gives you a hash opposed to string (not pretty I know)
result = Churn::ChurnCalculator.new(options).report(false)
result.to_json #or yaml or whatever is best for metric_fu

If you think that makes sense I could likely get to that late this week or next weekend

@bf4
Copy link
Member Author

bf4 commented Nov 11, 2013

@danmayer that would be great. @such I don't think this will interfere with what you're doing, but fyi to be aware.

@danmayer
Copy link

Sorry due to some crazy outages at work this week I am braindead and can't work on this this weekend. I can try again next week. Sorry about that, but this is still on my radar.

@bf4
Copy link
Member Author

bf4 commented Nov 17, 2013

@danmayer sure

@danmayer
Copy link

danmayer commented Dec 3, 2013

I think this PR should cover the direct mapping for churn

https://github.com/metricfu/metric_fu/pull/182/files

@bf4
Copy link
Member Author

bf4 commented Dec 3, 2013

I'm really looking hard at @davetron5000's GLI, intro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants