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

Be able to run metrics on a single file #208

Open
bf4 opened this issue Mar 19, 2014 · 3 comments
Open

Be able to run metrics on a single file #208

bf4 opened this issue Mar 19, 2014 · 3 comments

Comments

@bf4
Copy link
Member

bf4 commented Mar 19, 2014

Given a directory full of ruby files

When a single file is specified

Then MetricFu will run all configured metrics on that file

And output a report for that one file, graphs optional

Bonuses

  • create a new AnalyzedFile object that takes in a filename and
    contains the results of all metrics run against it. (This is distinct from, but similar to, the notion of a MetricFile that represents a marshaled metric_fu report.
  • use an MD5Tracker to only run metrics on changed files.

Suggested interface

analyzed_file = MetricFu::AnalyzedFile.new(filename)
analyzed_file.analyze! # runs metrics on the filename
analyzed_file.analysis # a hash of results from the above, compatible with the data in the report

This would likely require refactoring of the Generator and Hotspot classes

@MGotink
Copy link

MGotink commented Mar 27, 2014

What did you have in mind for running MetricFu against a single file? Some metrics don't support that. Run against the whole directory and filter out the results for that file?

@bf4
Copy link
Member Author

bf4 commented Mar 27, 2014

I think that's a valid interpretation

@bf4
Copy link
Member Author

bf4 commented Apr 27, 2014

This feature would allow, e.g. running metric_fu over code in a pre-commit hook

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

2 participants