{"id":13878360,"url":"https://github.com/danmayer/churn","last_synced_at":"2025-05-15T12:05:19.769Z","repository":{"id":762316,"uuid":"434077","full_name":"danmayer/churn","owner":"danmayer","description":"Providing additional churn metrics over the original metric_fu churn","archived":false,"fork":false,"pushed_at":"2024-03-17T23:42:20.000Z","size":375,"stargazers_count":409,"open_issues_count":15,"forks_count":33,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-14T22:18:07.088Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/danmayer/churn","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danmayer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2009-12-13T18:55:02.000Z","updated_at":"2025-02-19T10:42:42.000Z","dependencies_parsed_at":"2024-04-11T20:49:29.257Z","dependency_job_id":"a43f6bc3-3610-44b3-b758-0a175adaa8f0","html_url":"https://github.com/danmayer/churn","commit_stats":{"total_commits":240,"total_committers":27,"mean_commits":8.88888888888889,"dds":0.6833333333333333,"last_synced_commit":"33205b50cacb2e5b33f85f04d0475ca8eeaee8fd"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmayer%2Fchurn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmayer%2Fchurn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmayer%2Fchurn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmayer%2Fchurn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danmayer","download_url":"https://codeload.github.com/danmayer/churn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337613,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T08:01:47.289Z","updated_at":"2025-05-15T12:05:14.748Z","avatar_url":"https://github.com/danmayer.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/danmayer/churn.svg?branch=master)](http://travis-ci.org/danmayer/churn)\n\nCI: [![Build Status](https://github.com/danmayer/churn/workflows/CI/badge.svg)](https://github.com/danmayer/churn/actions)\n\n# Churn\n\nA Project to give the churn file, class, and method for a project for a given checkin. Over time the tool adds up the history of churns to give the number of times a file, class, or method is changing during the life of a project.\nChurn for files is immediate, but classes and methods requires building up a history using churn between revisions. The history is stored in ./tmp\n\nCurrently has full Git, Mercurial (hg), Bazaar (bzr) support, and partial SVN support (supports only file level churn currently)\n\nFile changes can be calculated on any single commit to look at method changes you need to be running churn over time. Using a git post-commit hook, configuring your CI to run churn. See the --past_history (-p) option to do a one time run building up past class and method level churn.\n\n## TODO\n\nWant to help out, there are easy tasks ready for some attention. The list of items is hosted on [github issues](https://github.com/danmayer/churn/issues)\n\n## Churn Usage\n\nInstall with `gem install churn` or for bundler add to your Gemfile\n\n```\ngroup :development do\n  gem 'churn'\nend\n```\n\n### Rake\n\n- Add `require 'churn'` to Rakefile\n- Then run `rake churn` or `bundle exec rake churn`\n- Use environment variables to control churn defaults\n\n```ruby\nENV['CHURN_MINIMUM_CHURN_COUNT']\nENV['CHURN_START_DATE']\nENV['CHURN_IGNORES']\n```\n\n### CLI\n\n- On the command line run `churn` or `bundle exec churn`\n- Need help? Run `churn -h` to get additional information\n- Run the executable, passing in options to override defaults\n\n```shell\nchurn -i \"churn.gemspec, Gemfile\"   # Ignore files\nchurn -y                            # Output yaml format opposed to text\nchurn -c 10                         # Set minimum churn count on a file to 10\nchurn -c 5 -y -i \"Gemfile\"          # Mix and match\nchurn -e rb                         # Specify a file extension. The dot will be prepended automatically (\"rb\" -\u003e \".rb\"). The argument will be evaluated as a RegEx (i.e. you could specify \"(js|jsx)\").\nchurn -f app                        # Specify a file prefix, e.g. app/models. The argument will be evaluated as a RegEx.\nchurn --start_date \"6 months ago\"   # Start looking at file changes from 6 months ago\nchurn -p \"4 months ago\"             # Churn the past history to build up data for the last 4 months\nchurn --past_history                # Churn the past history for default 3 months to build up data\n```\n\n## Example Output\n\n```\n**********************************************************************\n* Revision Changes\n**********************************************************************\nFiles:\n+-------------------------------+\n| file                          |\n+-------------------------------+\n| Rakefile                      |\n| lib/churn/churn_calculator.rb |\n+-------------------------------+\n\nClasses:\n+-------------------------------+-----------------+\n| file                          | klass           |\n+-------------------------------+-----------------+\n| lib/churn/churn_calculator.rb | ChurnCalculator |\n+-------------------------------+-----------------+\n\nMethods:\n+-------------------------------+-----------------+-------------------------------+\n| file                          | klass           | method                        |\n+-------------------------------+-----------------+-------------------------------+\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters       |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#display_array |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s          |\n+-------------------------------+-----------------+-------------------------------+\n\n**********************************************************************\n* Project Churn\n**********************************************************************\nFiles:\n+------------------------------------+---------------+\n| file_path                          | times_changed |\n+------------------------------------+---------------+\n| lib/churn/churn_calculator.rb      | 14            |\n| README.rdoc                        | 7             |\n| lib/tasks/churn_tasks.rb           | 6             |\n| Rakefile                           | 6             |\n| lib/churn/git_analyzer.rb          | 4             |\n| VERSION                            | 4             |\n| test/test_helper.rb                | 4             |\n| test/unit/churn_calculator_test.rb | 3             |\n| test/churn_test.rb                 | 3             |\n+------------------------------------+---------------+\n\nClasses:\n+-------------------------------+-----------------+---------------+\n| file                          | klass           | times_changed |\n+-------------------------------+-----------------+---------------+\n| lib/churn/churn_calculator.rb | ChurnCalculator | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | 1             |\n+-------------------------------+-----------------+---------------+\n\nMethods:\n+-------------------------------+-----------------+-----------------------------------------+---------------+\n| file                          | klass           | method                                  | times_changed |\n+-------------------------------+-----------------+-----------------------------------------+---------------+\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s                    | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#display_array           | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#calculate_revision_data | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters                 | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#initialize              | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters                 | 1             |\n| lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s                    | 1             |\n+-------------------------------+-----------------+-----------------------------------------+---------------+\n```\n\n## CLI Options\n\n```\n    [~/projects/churn] churn -h\n    NAME\n      churn\n\n    SYNOPSIS\n      churn [options]+\n\n    PARAMETERS\n      --minimum_churn_count=minimum_churn_count, -c (0 ~\u003e\n      int(minimum_churn_count=3))\n      --yaml, -y\n      --extension, -e (0 ~\u003e string(file_extension=))\n      --prefix, -f (0 ~\u003e string(file_prefix=))\n      --ignore_files=[ignore_files], -i (0 ~\u003e string(ignore_files=))\n      --start_date=[start_date], -s (0 ~\u003e string(start_date=))\n      --data_directory=[data_directory], -d (0 ~\u003e string(data_directory=))\n      --past_history=[past_history], -p (0 ~\u003e string(past_history=))\n      --help, -h\n```\n\n## Library Options\n\nAll the CLI options are parsed and just passed into the library. If you want to run the library directly from other code. The best way to see current options is where the [churn executable](https://github.com/danmayer/churn/blob/master/bin/churn) passes the parsed options into the `ChurnCalculator` class\n\n```ruby\n###\n# Available options\n###\noptions = {:minimum_churn_count =\u003e params['minimum_churn_count'].value,\n  :ignore_files =\u003e params['ignore_files'].value,\n  :file_extension =\u003e params['file_extension'].value,\n  :file_prefix =\u003e params['file_prefix'].value,\n  :start_date =\u003e params['start_date'].value,\n  :data_directory =\u003e params['data_directory'].value,\n  :history =\u003e params['past_history'].value,\n  :report =\u003e params['report'].value,\n  :name =\u003e params['name'].value\n}\nresult = Churn::ChurnCalculator.new(options).report(false)\n```\n\n## Notes on Patches/Pull Requests\n\n- Fork the project.\n- Make your feature addition or bug fix.\n- Add tests for it. This is important so I don't break it in a\n  future version unintentionally.\n- Commit, do not mess with rakefile, version, or history.\n  (if you want to have your own version, that is fine but\n  bump version in a commit by itself I can ignore when I pull)\n- Send me a pull request. Bonus points for topic branches.\n\n## Authors\n\n- danmayer\n- ajwalters\n- cldwalker\n- absurdhero\n- bf4\n\n## Code of Conduct\n\nPlease see our [Code of Conduct](https://github.com/danmayer/churn/blob/master/CODE_OF_CONDUCT.md)\n\n## Copyright\n\nCopyright (c) 2019 Dan Mayer. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanmayer%2Fchurn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanmayer%2Fchurn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanmayer%2Fchurn/lists"}