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

Language statistics bar for repositories #8037

Merged
merged 4 commits into from
Feb 11, 2020

Conversation

lafriks
Copy link
Member

@lafriks lafriks commented Aug 29, 2019

Replaces #4824 after accidentally breaking branch :)

Fixes #2165

Implements language statistic calculation using https://github.com/src-d/enry library.

TODO:

  • Function to calculate language stats for git repository
  • Save language stats to database
  • Display language stats bar (cleanup depends on Implement getting HTML color code for languages src-d/enry#233)
  • Add support for linguist-vendored in .gitattributes file (this could be added later in other PR)
  • Async update language stats to database when repository changes
  • Initial language stats calculation for existing repositories

Screenshots:
image

image

image

@lafriks lafriks added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/changelog Adds the changelog for a new Gitea version labels Aug 29, 2019
@lafriks lafriks added this to the 1.10.0 milestone Aug 29, 2019
@kolaente
Copy link
Member

Could the async update be solved via some kind of cron which looks every couple minutes if a repo has been updated in since the last sync and then updates?
That way you could also get the initial sync "for free". It would also cover the case where a user imports a repo afterwards.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 29, 2019
@lafriks
Copy link
Member Author

lafriks commented Aug 29, 2019

I'm working on a lib for embedded/persistent async job queue currently that could be used here and also for other async tasks

@lunny
Copy link
Member

lunny commented Sep 15, 2019

Please resolve the conflicts

@lafriks lafriks modified the milestones: 1.10.0, 1.11.0 Sep 16, 2019
@lunny
Copy link
Member

lunny commented Nov 16, 2019

Please resolve the conflicts.

@lafriks
Copy link
Member Author

lafriks commented Nov 16, 2019

I still need to finish work on async queue first

@lunny lunny modified the milestones: 1.11.0, 1.12.0 Dec 13, 2019
@codecov-io
Copy link

codecov-io commented Feb 1, 2020

Codecov Report

Merging #8037 into master will increase coverage by 0.03%.
The diff coverage is 57.86%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8037      +/-   ##
==========================================
+ Coverage   43.42%   43.46%   +0.03%     
==========================================
  Files         576      582       +6     
  Lines       79640    79955     +315     
==========================================
+ Hits        34587    34753     +166     
- Misses      40778    40885     +107     
- Partials     4275     4317      +42
Impacted Files Coverage Δ
models/migrations/migrations.go 4.16% <ø> (ø) ⬆️
routers/org/home.go 65.68% <ø> (-0.34%) ⬇️
routers/user/profile.go 51.42% <ø> (-0.24%) ⬇️
routers/init.go 63.04% <0%> (-2.13%) ⬇️
modules/notification/indexer/indexer.go 50.66% <0%> (-4.41%) ⬇️
models/migrations/v127.go 0% <0%> (ø)
models/models.go 61.93% <100%> (+0.21%) ⬆️
modules/indexer/code/bleve.go 66.07% <100%> (ø) ⬆️
models/repo.go 51.36% <100%> (+0.03%) ⬆️
modules/indexer/code/queue.go 55.12% <100%> (ø) ⬆️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 730f026...b3e60ec. Read the comment docs.

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2020

Hi @lafriks what about the modules/queue/Queue?

@lafriks lafriks force-pushed the feat/language_stats branch 2 times, most recently from 9fff39f to 4a5e64c Compare February 3, 2020 09:44
@lafriks
Copy link
Member Author

lafriks commented Feb 3, 2020

@zeripath I needed something more persistent so I implemented it same as code indexer queue

@lafriks
Copy link
Member Author

lafriks commented Feb 3, 2020

It is now complete and ready for review

@lafriks lafriks force-pushed the feat/language_stats branch 2 times, most recently from 14a571c to 7e64c40 Compare February 3, 2020 11:19
@lunny
Copy link
Member

lunny commented Feb 3, 2020

CI failed.

@lafriks
Copy link
Member Author

lafriks commented Feb 3, 2020

@lunny fixed

@lafriks lafriks force-pushed the feat/language_stats branch 3 times, most recently from 9165446 to c0a036f Compare February 4, 2020 22:25
web_src/js/index.js Outdated Show resolved Hide resolved
Impement saving code language statistics to database

Implement rendering langauge stats

Add primary laguage to show in repository list

Implement repository stats indexer queue

Add indexer test

Refactor to use queue module
@lafriks
Copy link
Member Author

lafriks commented Feb 7, 2020

@lunny can you comment on this more?

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 10, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 10, 2020
@lafriks
Copy link
Member Author

lafriks commented Feb 11, 2020

Let's do it :)

@lafriks lafriks merged commit ad2642a into go-gitea:master Feb 11, 2020
@lafriks lafriks deleted the feat/language_stats branch February 11, 2020 09:34
@alexander-zierhut
Copy link

image

Is it possible to hide some languages? Maybe have some settings for it, although I woudl hide SVG by default :)

@6543
Copy link
Member

6543 commented May 22, 2020

@ALZlper pleace open a new Issue, you can reference this pull but dont komment in a merged pull

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
@delvh delvh removed the type/changelog Adds the changelog for a new Gitea version label Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Languages Statusbar