assayo/README.md
2026-03-25 15:22:51 +03:00

244 lines
11 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> __[English](https://github.com/bakhirev/assayo)__ | [Español](https://github.com/bakhirev/assayo/blob/main/documents/ES.md) | [Français](https://github.com/bakhirev/assayo/blob/main/documents/FR.md) | [Português](https://github.com/bakhirev/assayo/blob/main/documents/PT.md) | [Deutsch](https://github.com/bakhirev/assayo/blob/main/documents/DE.md) | [中文](https://github.com/bakhirev/assayo/blob/main/documents/ZH.md) | [日本語](https://github.com/bakhirev/assayo/blob/main/documents/JA.md) | [한국어](https://github.com/bakhirev/assayo/blob/main/documents/KO.md) | [العربية](https://github.com/bakhirev/assayo/blob/main/documents/AR.md) | [हिन्दी](https://github.com/bakhirev/assayo/blob/main/documents/HI.md) | [Русский](https://github.com/bakhirev/assayo/blob/main/documents/RU.md)
# [Assayo](https://bakhirev.github.io/?ref=github&lang=en)
Creates an HTML-report with analysis of commit statistics:
- the work pace and number of overtime hours;
- zones of responsibility, number of features and bugs;
- colleagues working style;
- the rate of employee turnover and the makeup of the team;
- location of developers;
- release schedule and vacation calendar;
- cost of features and project as a whole;
- places for refactoring, deleted files, etc.
**Links:** [demo](https://bakhirev.github.io/demo/?ref=github&dump=./test.txt), [online version](https://bakhirev.github.io/demo/?ref=github), [docker](https://hub.docker.com/r/bakhirev/assayo), [reddit](https://www.reddit.com/r/ITManagers/comments/1e5k291/the_visualization_and_analysis_of_git_commit/), [habr](https://habr.com/ru/articles/852782/)
**Video:** [english](https://www.youtube.com/watch?v=uMbhrrd25t4), [español](https://www.youtube.com/watch?v=skmctb_2rZ0), [русский](https://www.youtube.com/watch?v=jwCp_-bhrCQ)
<a href="https://bakhirev.github.io/demo/?ref=github&dump=./test.txt" target="_blank"><img src="https://bakhirev.github.io/assets/images/index.gif" width="100%" /></a>
<a name="link-0"></a>
### Table of contents
- [COMMIT STATISTICS REPORT](#link-1)
- [How to create and view the report?](#link-2)
- [Using public server](#link-3)
- [Use the library NodeJS](#link-4)
- [Use the library PHP](#link-5)
- [Use the library Python](#link-6)
- [Use the library Ruby](#link-7)
- [Use the library Go](#link-8)
- [Use source code](#link-9)
- [Use github actions](#link-10)
- [Use private server](#link-11)
- [How to concat authors?](#link-12)
- [How to export data from git to txt file?](#link-13)
- [For online viewing](#link-14)
- [For offline viewing](#link-15)
- [If you use PowerShell in Windows](#link-16)
- [How to view a report on a group of microservices?](#link-17)
- [THE BEST PRACTICES IN THE PROJECT](#link-18)
- [How to sign commits?](#link-19)
- [How to add checking for commit message?](#link-20)
- [Use file commit-msg](#link-21)
- [Use package pre-commit](#link-22)
- [ABOUT THIS APP](#link-23)
- [How to brand the interface?](#link-24)
- [How to rebuild the HTML report from source code?](#link-25)
- [How to add or edit a translation?](#link-26)
- [Architecture](#link-27)
- [General architecture of microservices](#link-29)
- [Feedback, comments](#link-30)
<a name="link-1"></a>
## COMMIT STATISTICS REPORT
<a name="link-2"></a>
### 📈 How to create and view the report?
<a name="link-3"></a>
#### Using public server
- go to the [website](https://bakhirev.github.io/)
- follow the instructions
<a name="link-4"></a>
#### Use the library NodeJS
- run `npx assayo`
- open `./assayo/index.html`
<a name="link-5"></a>
#### Use the library PHP
- run `composer require bakhirev/assayo`
- run `vendor/bin/assayo`
- open `./assayo/index.html`
<a name="link-6"></a>
#### Use the library Python
- run `pipx install assayo`
- run `assayo`
- open `./assayo/index.html`
<a name="link-7"></a>
#### Use the library Ruby
- run `gem install assayo`
- run `assayo`
- open `./assayo/index.html`
<a name="link-8"></a>
#### Use the library Go
- run `go get github.com/bakhirev/assayo`
- run `go install github.com/bakhirev/assayo`
- run `assayo`
- open `./assayo/index.html`
<a name="link-9"></a>
#### Use source code
- download this repository
- drop the `log.txt` file to the `/build`
- open `/build/index.html`
- or drop the `/build` folder to your repository (where the `log.txt` is located). You can change the name. For example, from `/build` to `/report`.
In this case, it is important that the `log.txt` file is generated by the command for offline viewing.
<a name="link-10"></a>
#### Use github actions
Add [script](https://github.com/bakhirev/assayo/blob/main/documents/ActionExample.yml) in folder `.github/workflows/` or use this [action](https://github.com/marketplace/actions/assayo) from the marketplace. A ready, fresh report will be saved in the artifacts.
<a name="link-11"></a>
#### Use private server
- download the [docker image](https://hub.docker.com/r/bakhirev/assayo);
- run it on your local network;
- use the web interface to view the reports, set the URL of the data in the URL parameter `dump`:
```
http://assayo_url/?dump=//you_url/some/log.txt
assayo_url - URL of the assayo container, it listens on port 80;
you_url - URL of your container with git logs;
```
By default, the image will run at `http://127.0.0.1:80/`. If it doesn't work, check if port `80` is free.
<a name="link-12"></a>
### ‍🎭 How to concat authors?
In the root directory of your project, you need to create a `.mailmap` file.
Example of the contents of the file:
```
Alex B <alex@mail.uk>
Alex B <alex@mail.uk> <alex@gov.tk>
Alex B <alex@mail.uk> <bakhirev@ya.kz>
Alex B <alex@mail.uk> <man64@yahoo.com>
```
Read more about the format of this file you can [here](https://git-scm.com/docs/gitmailmap).
<a name="link-13"></a>
### 📤 How to export data from git to txt file?
<a name="link-14"></a>
#### For online viewing
In the root directory of your project run:
<a name="link-15"></a>
#### For offline viewing
Git will create a file `log.txt`. This file contains data for show a report. The difference between the online and offline format is the presence of a wrapper for strings. The offline format will be pulled up like a `js` file if you just opened `/build/index.html`
<a name="link-16"></a>
#### If you use PowerShell in Windows
By default, the output encoding may not match UTF-8 and the resulting log file will be unreadable. Before saving the log, you can change the encoding with the command.
```
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
```
Or open a saved file and manually change the encoding to UTF-8.
<a name="link-17"></a>
### 🗃️ How to view a report on a group of microservices?
- Generate for each microservice file `log.txt` (`log-1.txt`, `log-2.txt`, `log-3.txt`, etc.) You can do this manually, or use the [Assayo Crawler](https://github.com/bakhirev/assayo-crawler) module for automatic log collection;
- See “How to view an online report?”. At the last step, drag all the files at once into the browser window.
- See “How to see a report offline?”. At the second step, drag all microservice files (`log-1.txt`, `log-2.txt`, `log-3.txt`, etc.) to the report folder (`/build`).
<a name="link-18"></a>
## THE BEST PRACTICES IN THE PROJECT
<a name="link-19"></a>
### 📝 How to sign commits?
Follow the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/). Example:
```
JIRA-1234 feat(profile): Added avatar for user
```
- task number in the task tracker `(JIRA-1234)`
- type of work `(feat, fix, style, refactor, test, doc, etc.)`
- feature `(profile - new page on site or new function, use one (two) short word or an abbreviation)`
- what problem were solved `(Added avatar for user)`
<a name="link-20"></a>
### 👮 How to add checking for commit message?
<a name="link-21"></a>
#### Use file commit-msg
1. Create file `commit-msg` in folder `.git/hooks/`
2. Add this text in file:
```
#!/usr/bin/env bash
if ! grep -iqE "(JIRA-[0-9]{1,5})(s)(feat|fix|docs|style|refactor|test|chore)((([a-z0-9_-]{1,})){0,})(:s)([a-z]{1,})" "$1"; then
echo "Need commit message like: JIRA-12 fix(profile): some text. Read Semantic Commit Messages" >&2
exit 1
fi
```
<a name="link-22"></a>
#### Use package [pre-commit](https://www.npmjs.com/package/pre-commit)
1. Add in file `package.json` property `commit-msg`:
```
...
"commit-msg": {
"regex": "(JIRA-[0-9]{1,5})(\s)(feat|fix|docs|style|refactor|test|chore)((\([a-z0-9_-]{1,}\)){0,})(:\s)([a-z]{1,})",
"error-message": "Need commit message like: JIRA-12 fix(profile): some text Read Semantic Commit Messages"
},
...
```
2. Run command `npm install pre-commit`
<a name="link-23"></a>
## ABOUT THIS APP
<a name="link-24"></a>
### 🎨 How to brand the interface?
You can create your own interface theme. Options:
- **Title**. You can set default document title in the URL parameter `title`. Example: `?title=You Company`
- **Visual theme**. To do this, you need to prepare a CSS file with new styles and specify its URL in the `theme` parameter. Example: `?theme=//company.com/some.css`. You can use class names as selectors. Most of them do not change in new versions.
- **Language**. You can set language in the URL parameter `lang`. Example: `?lang=es`
**Example:** [demo](https://bakhirev.github.io/demo/themes/)
<a name="link-25"></a>
### 🛠️ How to rebuild the HTML report from source code?
- download this repository `git clone https://github.com/bakhirev/assayo.git`
- run `npm install`
- run `npm run build:local`
- the new HTML build will be in the `/build` folder
<a name="link-26"></a>
### 🈯 How to add or edit a translation?
You can add a new translation or correct an existing one in the `ts/translations/` folder.
[Instruction](https://github.com/firstcontributions/first-contributions)
<a name="link-27"></a>
### 📐 Architecture
<a name="link-29"></a>
#### General architecture of microservices
<img src="https://raw.githubusercontent.com/bakhirev/assayo-crawler/12af4410fc93384cafb108a4429e43f9a874dbaa/schema.svg" width="70%" />
1. [Reports showcase UI](https://github.com/bakhirev/assayo-showcase) displays a list of available reports. Each report consists of a title, description, and a list of repositories.
2. [Crawler service](https://github.com/bakhirev/assayo-crawler) collects repository logs for the report.
3. [Log visualization UI](https://github.com/bakhirev/assayo) **(you here)** displays report. Needs a log file for work.
<a name="link-30"></a>
### 📧 Feedback, comments
- 📱 [https://t.me/bakhirev](https://t.me/bakhirev) (priority method of communication)
- 📧 [alexey-bakhirev@yandex.ru](mailto:alexey-bakhirev@yandex.ru)
- 🌐 [https://bakhirev.github.io/](https://bakhirev.github.io/?ref=github&lang=en)