{"id":15166048,"url":"https://github.com/jenkinsci/git-forensics-plugin","last_synced_at":"2025-04-09T14:14:03.124Z","repository":{"id":37548460,"uuid":"186910980","full_name":"jenkinsci/git-forensics-plugin","owner":"jenkinsci","description":"Jenkins plug-in that mines and analyzes data from a Git repository","archived":false,"fork":false,"pushed_at":"2025-04-01T17:51:58.000Z","size":3615,"stargazers_count":40,"open_issues_count":3,"forks_count":28,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T12:13:19.346Z","etag":null,"topics":["code-forensics","forensics","git","jenkins"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/git-forensics/","language":"Java","has_issues":false,"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/jenkinsci.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-15T22:25:52.000Z","updated_at":"2025-03-29T14:00:04.000Z","dependencies_parsed_at":"2022-09-20T17:03:18.543Z","dependency_job_id":"75df4a09-60c1-4d2d-a85e-c845a5404bfe","html_url":"https://github.com/jenkinsci/git-forensics-plugin","commit_stats":{"total_commits":1258,"total_committers":13,"mean_commits":96.76923076923077,"dds":"0.44356120826709067","last_synced_commit":"0e77abe31e3e05f1bb23179f2647c9fbb30a52a3"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-forensics-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-forensics-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-forensics-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-forensics-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/git-forensics-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"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":["code-forensics","forensics","git","jenkins"],"created_at":"2024-09-27T04:22:41.639Z","updated_at":"2025-04-09T14:14:03.105Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Forensics Jenkins Plugin\n\n[![Join the chat at https://gitter.im/jenkinsci/warnings-plugin](https://badges.gitter.im/jenkinsci/warnings-plugin.svg)](https://gitter.im/jenkinsci/warnings-plugin?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Jenkins](https://ci.jenkins.io/job/Plugins/job/git-forensics-plugin/job/main/badge/icon?subject=Jenkins%20CI)](https://ci.jenkins.io/job/Plugins/job/git-forensics-plugin/job/main/)\n[![GitHub Actions](https://github.com/jenkinsci/git-forensics-plugin/workflows/GitHub%20CI/badge.svg)](https://github.com/jenkinsci/git-forensics-plugin/actions)\n[![codecov](https://codecov.io/gh/jenkinsci/git-forensics-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/jenkinsci/git-forensics-plugin)\n[![CodeQL](https://github.com/jenkinsci/git-forensics-plugin/workflows/CodeQL/badge.svg)](https://github.com/jenkinsci/git-forensics-plugin/actions/workflows/codeql.yml)\n\nThis Git Forensics Jenkins plugin mines and analyzes data from a Git repository. It implements all extension points of\n[Jenkins' Forensics API Plugin](https://github.com/jenkinsci/forensics-api-plugin) and provides the following services:\n\n- **Blames**: Provides an API for `git blame` to show in which Git revisions the lines of a file \n  have been modified by what authors. This information can be used to discover the original commit \n  that is the origin for a piece of problematic code. \n- **File statistics**: Incrementally collects global commit statistics for all repository files in the style of\n  [Code as a Crime Scene](https://www.adamtornhill.com/articles/crimescene/codeascrimescene.htm)\n  \\[Adam Tornhill, November 2013\\]. This includes:\n  - commits count\n  - different authors count\n  - creation time\n  - last modification time\n  - lines of code (from the commit details)\n  - code churn (changed lines since created)\n- **Commit tracking**: Tracks all new commits that are part of a build. \n- **Commit statistics**: Collects commit statistics for all new commits in a build or in a series of builds (e.g. for\n  all commits of a pull request). This includes:\n  - commits count\n  - changed files count\n  - added and deleted lines\n- **Reference build**: Discovers a reference build for a given build that can be used to compute relative results that\n  show what will be changed if the branch of the current build will be merged with the target branch.\n- **Repository Browser**: Provides a [RepositoryBrowser](https://javadoc.jenkins.io/hudson/scm/RepositoryBrowser.html)\n  for commits. Since the original Jenkins interface has no API to generate links to simple\n  commits, this decorator adds such a functionality. Note that this API does not only obtain such links, it also\n  renders these links as HTML `a` tags.\n\n## File statistics\n\nThe Git Forensics plugin will collect commit statistics for all repository files in the style of\n[Code as a Crime Scene](https://www.adamtornhill.com/articles/crimescene/codeascrimescene.htm)\n[Adam Tornhill, November 2013] if you enable the post build step *Mine SCM repository*. If you are using a pipeline,\nthen you can start the repository mining using the `mineRepository` step. This step has an `scm` parameter value that \ncan be used to filter the SCM(s) to use. Please\nnote that the scanning of the repository might take some time if your Git repository is quite large. Mining of the\nrepository is done incrementally, i.e., for new builds only additional commits will be analyzed making the overall \nruntime much faster. \n\nYou can use this feature by enabling the pipeline step `mineRepository`.\nAfter a build you will find a summary of the repository mining on the main build page:\n\n![Build Summary](doc/images/summary.png)\n\nIn this summary you will see how many files have been processed in total (with total LOC and code churn statistics) and \nhow many new commits have been recorded in the current build. You will additionally see the added and deleted lines \nin these new commits. \n\nFrom the summary you can navigate to a separate plugin view, that shows the details for all of your repository \nfiles. In this view you see aggregation charts that show how many files have a small or large number of authors or \ncommits, respectively. Additionally, you can see the individual statistics for all repository files in a table:  \n- commits count\n- different authors count\n- creation time\n- last modification time\n- lines of code (from the commit details)\n- code churn (changed lines since created)\n\nUse the filtering or sorting capabilities of the table to highlight the most important files in your project. \n\n![Repository Details](doc/images/forensics-details.png)\n\nFor all files an additional detail view is available, that shows the added and deleted lines by each commit. In this\nview you can see a chart on the top showing the added (green) and deleted lines (red) for each commit. A table\nat the bottom lists the individual commits that changed the selected file. From this table you can directly navigate \nto the Git commit details of your repository (if configured correctly).\n\n![File Details](doc/images/file-details.png)\n\n![GitHub Details 1](doc/images/github-title.png)\n![GitHub Details 2](doc/images/github-details.png)\n\nOn the job level, the mining step also provides a trend chart for your Git commits. Your can choose from\none of the four different trend charts, see next section.\n\n### Total number of files\n\nThe total number of files trend chart simply counts the number of files in your repository \nover the time.\n\n![Total number of files trend chart](doc/images/forensics-files.png)\n\n### Total lines of code and churn\n\nThe total lines of code and churn trend chart counts two different line statistics:\n\n- **Lines of code**: the total number of source code lines in your repository is computed by subtracting the\n  deleted from the added lines in the repository over the time. The result represents the actual\n  volume of code in your project.\n- **Churn**: the source code churn in your repository is computed by summing up the absolute values of deleted and \nadded lines in the repository over the time. The result is a measure of activity and overhead in your source code base.\nThe smaller the gap between **Churn** and **Lines of code** the less code has been changed or thrown away during \nthe project's lifetime.\n\n![Total lines of code and churn trend chart](doc/images/forensics-churn.png)\n\n### Deleted and added lines\n\nThe deleted and added lines trend chart visualizes the delta between added or deleted lines in each build.\nUsing this chart your project easily can spot peaks where more or less code has been changed.    \n\n![Deleted and added lines trend chart](doc/images/forensics-deleted-added.png)\n\n### Author, commit, and modified files count\n\nFinally, the author, commit, and modified files count trend visualizes some additional  \ninformation that might be helpful to keep your project in shape.\n\n![Author, commit, and modified files count trend chart](doc/images/forensics-statistics.png)\n\n## Commit tracking\n\nThe Git Forensics plugin automatically tracks all new commits that are part of a build that uses a Git SCM. Using this \ninformation other plugins can search for builds that contain a specific commit. You can see the results of this\ncommit listener on the build status page:\n\n![Commits Summary](doc/images/commits-summary.png)\n\nThere you will see the number of new commits and a link to open the repository browser with the details of the latest commit. \n\n## Commit statistics\n\nFor pull requests (or more generally: for jobs that have a reference build defined) the Git Forensics plugin collects \na statistical summary for all containing commits. \nThis includes the commits count, the changed files count, and the added and deleted lines in those commits. \nThis information will be available as a summary for each build: \n\n![Commits Statistics](doc/images/commits-statistics.png)\n\nThis information is also available for builds that do not have a reference build defined (see next section).\nIn this case the statistics since the previous successful build will be shown.\n\nYou can use this feature by enabling the pipeline step `gitDiffStat`.\nOn the job level, this step also provides a trend chart for your Git commits. Your can choose from\none of the following two trend charts, see next section.\n\n### Deleted and added lines\n\nThe deleted and added lines trend chart visualizes the delta between added or deleted lines in each build.\n\n![Deleted and added lines trend chart](doc/images/statistics-added-deleted.png)\n\n### Author, commit, and modified files count\n\nAdditionally, the author, commit, and modified files count trend visualizes in which way the files of a build \nhave been changed.\n\n![Author, commit, and modified files count trend chart](doc/images/statistics-trend.png)\n\n## Reference build \n\nSeveral plugins that report build statistics (test results, code coverage, metrics, static\nanalysis warnings) typically show their reports in two different ways: either as absolute report\n(e.g., total number of tests or warnings, overall code coverage) or as relative delta report (e.g., additional tests,\nincreased or decreased coverage, new or fixed warnings). In order to compute a relative delta report a plugin needs\nto carefully select the other build to compare the current results to (a so called *reference build*).\nFor simple Jenkins jobs that build the main branch of an SCM the reference build will be selected from one of the\nprevious builds of the same job. For more complex branch source projects (i.e., projects that build several branches\nand pull requests in a connected job hierarchy) it makes more sense to select a reference build from a job\nthat builds the actual target branch (i.e., the branch the current changes will be merged into). Here one typically is\ninterested what changed in a branch or pull request with respect to the main branch (or any other\ntarget branch): e.g., how will the code coverage change if the team merges the changes. Selecting the correct reference\nbuild is not that easy, since the main branch of a project will evolve more frequently than a specific feature or bugfix\nbranch. \n\nUp to now Jenkins plugins compute these reference builds on their own, which leads to different results or \nduplicate code. The Git Forensics plugin tries to generalize these requirements and provides a new API for Jenkins plugins\nto obtain such a reference build. This functionality is available after enabling the post build step \n*Discover Git Reference build* in your Freestyle project or by running the step `discoverGitReferenceBuild` in your \npipelines. \n\n![Configure reference build](doc/images/configure-reference.png)\n\nDiscovering the reference build can be configured with several properties. The most important option is the \n`referenceJob`: The reference job determines the target branch of the project where all changes will be merged into. \nThen other plugins can use the best fitting build of this job as baseline for relative build reports that show \nthe effects of a given change. In [multi branch pipelines](https://www.jenkins.io/doc/book/pipeline/multibranch/#creating-a-multibranch-pipeline) \nthis name will be automatically retrieved from the pipeline configuration. If your pipeline uses more that one SCM you\ncan select the correct SCM with the `scm` parameter.\n\nYou can see the results of this computation (and the significant processing decisions) on the build details page: \n\n![Summary reference build](doc/images/reference.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fgit-forensics-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fgit-forensics-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fgit-forensics-plugin/lists"}