{"id":22848343,"url":"https://github.com/feedzai/repo-analyzer","last_synced_at":"2025-07-17T18:32:15.493Z","repository":{"id":35134205,"uuid":"210696467","full_name":"feedzai/repo-analyzer","owner":"feedzai","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-04T22:03:15.000Z","size":1483,"stargazers_count":17,"open_issues_count":3,"forks_count":4,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-07-08T03:26:56.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/feedzai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-24T20:58:23.000Z","updated_at":"2025-06-28T21:41:50.000Z","dependencies_parsed_at":"2023-01-15T14:30:45.951Z","dependency_job_id":null,"html_url":"https://github.com/feedzai/repo-analyzer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/feedzai/repo-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedzai%2Frepo-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedzai%2Frepo-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedzai%2Frepo-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedzai%2Frepo-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feedzai","download_url":"https://codeload.github.com/feedzai/repo-analyzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feedzai%2Frepo-analyzer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265645406,"owners_count":23804184,"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-12-13T04:11:28.806Z","updated_at":"2025-07-17T18:32:15.470Z","avatar_url":"https://github.com/feedzai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Frontend Repo Analyzer\n\n[![Build Status](https://travis-ci.com/feedzai/repo-analyzer.svg?branch=master)](https://travis-ci.com/feedzai/repo-analyzer)\n\nThis small tool can analyze Git repositories and report metrics about them, these will then be sent to Elastic/Kibana or optionally to file or the console.\nThis tool was designed to be plugable, can work with an unlimited number of repositories and metrics.\n\n![Repo Analyzer](https://github.com/feedzai/repo-analyzer/blob/master/repo-analyzer.png?raw=true)\n\n## Table of Contents\n1. [Installation and usage ](#installation-and-usage)\n2. [Configuration](#configuration)\n3. [Add custom metrics](#add-custom-metrics)\n4. [Custom config file](#custom-config-file)\n5. [Reporters](#reporters)\n6. [Arguments](#arguments)\n7. [FAQ](#faq)\n8. [License](#license)\n\n\n## Installation and Usage\n\nPrerequisites: [Node.js](https://nodejs.org/en/) (+8.x), npm version +6.X.\n\nTo install run:\n\n`$ npm i @feedzai/repo-analyzer --save-dev`\n\nAfter installing the tool, we recommend that you add it to the npm scripts:\n\n`\"analyze\": \"repo-analyzer --username=john.doe --password=password\"`\n\nThe `username` and `password` parameters will be used to connect to Elasticsearch.\n\nMore detail on this configuration can be found in the next section.\n\nThe first time you run the tool it will create a `.repo-analyzer` file. We recommend the configuration to be on a separate repository and be linked to in `.repo-analyzer`. The default file will point to the [feedzai configuration](https://github.com/feedzai/repo-analyzer-feedzai-config). If you want to use it you need to run:\n\n`$ npm i @feedzai/feedzai-config --save-dev`\n\nFor details on what metrics are available here, plese consult the documentation in the [repo](https://github.com/feedzai/repo-analyzer-feedzai-config).\n\nWe recommend configuring the tool to run in CI at each commit.\n\nIt is also recommend to run the tool in the \"history\" mode to calculate historical data and have better dashboards (more details on that below).\n\n### Configure Elasticsearch/Kibana\n\nIn order to use the whole potencial provided by the tool, we recommend you to use elasticsearch and kibana. They will provide a pretty good way to store and visualize your data.\n\nYou can find the complete configuration guide [here](https://github.com/feedzai/repo-analyzer-feedzai-config/blob/master/elastic.md)\n\nOne important detail: the Feedzai configuration assumes that your Kibana instance is on your local machine.\n\n## History mode\n\nThe tool is capable of collecting data about the project‘s history based on the commit history. \nThis feature may be useful if you want to know how your project has varied over time, and what impact some dependency made in your bundesize for example.\n\nIn order to analyze the project’s history you just need to pass the “--history” flag into the tool:\n\n`$ npm run analyze -- --history`\n\nThis will calculate the metrics in each commit. For large repos it's possible to pass a parameter that will do an exponential sampling as time goes back:\n\n`$ npm run analyze -- --history --factor=1`\n\n## Creating a custom configuration\n\nIn some cases you might want to implement custom metrics or have a custom configuration.\n\nCurrently the tool gets its configuration from an npm package, similarly to eslint. \nThe only requirements for this configuration project is that it returns an array with the metrics you want to use and some extra configuration. See this [repo](https://github.com/feedzai/repo-analyzer-feedzai-config) for an example.\nIn order to use this custom configuration you must add the name of the package to the `.repo-analyzer` file and add your configuration as a dependency to your local project.\n\n### Creating new metrics\n\nWhen you create a new metric, you must implement the base metric and his main 3 methods ( info, verify, execute ). Both verify and execute are async.\n- **info()**: returns an object containing the metric name and group. This group can be modified in \u003cfile\u003e. Grouping metrics can be useful when you have a lot of metrics.\n- **verify()**: returns a boolean and specifies whether its possible to run this metric for a given repository or not. For example, when calculation the coverage, if the repo does not have jest, it's impossible to calculate the metric therefore **verify()** should return false.\n- **execute()**: returns and object with the result for the metric being calculated. In this method occurs the calculation for the metric.\n- **schema()**: returns the schema configuration sent to Kibana/Elastic. If you don't to send the metrics to Kibana it is not necessary to implement this method.\n    \nExamples [here](https://github.com/feedzai/repo-analyzer-feedzai-config/tree/master/metrics).\n\n ## Reporters\n\nBesides sending the data to Kibana it is also possible to output to a json file or to console.\n\nSee examples of how to do that [here](https://github.com/feedzai/repo-analyzer-feedzai-config/blob/master/index.js).\n\n## Arguments\n\n- **username=elastic**  Elastic's username required to send elasticsearch reports to protected instances.\n- **password=password** Elastic's password needed to send elasticsearch reports. Only valid when using the **username** flag.\n- **factor=1** Factor used to jump commits when calculating project's history. The bigger the factor the bigger the jumps.\n- **history** when used will calculate the history for the repos with \"calculate-history\": true in the config file.\n- **elastic** creates elasticsearch's indexes automatically based on the metrics loaded and its schema.\n- **commits=1,2,3** analyzes a group of commits, this flag is only valid when analyzing the history\n- **from=1** the commit to start analyze, only valid when used with **to** when running on history mode.\n- **to=10** the commit where it stop calculating, only valid when used with **from** and in history mode.\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeedzai%2Frepo-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeedzai%2Frepo-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeedzai%2Frepo-analyzer/lists"}