-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add a Language Statistics Bar to repo/view #2135
Conversation
With the usage of a port of github's linguist functionality to Go, which I have made as a separate library and is hosted here: https://github.com/generaltso/linguist And a quick design I made, I have hacked a language statistics bar into gogs I wasn't sure where to put everything so it's sitting directly on the view router and the CSS is inlined into a new template file Based on the structure of this project I would fully expect this feature to belong in its own sub-package Also, even though determining language stats on-the-fly is pretty fast, caching the results in the database for large codebases would probably be a much better strategy, especially if the top language were to be displayed in the "Explore" view like GitHub has I also had difficulty trying to figure out how to do: if len(something) == 1 ? '' : 's' with go templates for plurals (1 Commit vs 2 Commits), and I kinda gave up there...
I should probably also include an example of what it looks like: http://var.abl.cl/language-bar-example.htm (home server, connection may be spotty...) |
👍 👍 👍 👍 👍 👍 👍 👍 👍 |
While generally I am okay with the idea of showing language statistics, I don't think there's a reason to put that on very first page of the repo. It occupies really precious space, it uses extra CPU cycles to gather & render these stats, that may be irrelevant anyway to many projects. I suggest such thing maybe should live in some separate tab, maybe called Statistics or Graphs like on GitHub. There're also couple of things wrong with your PR:
Didn't mention the that the templates are not following indention rules of the project. |
The idea is awesome, but I need more time dig into your linguist lib and some other points @nanoant already made. |
If we are really going to add this feature, should consider put github.com/generaltso/linguist under Gogs's organization account. The way this package works certainly has many downsides such as require user to install Go... |
Hello again, I should preface this with some disclaimers: I am not really familiar with the code structure of this project, or its I just wanted to get the ball rolling with just simple a proof of concept
Yes, I agree. Ideally, it would be an optional, toggle on-off feature where
Even better :)
I can change this, I just wanted to create a self-contained widget with a And I can change the whitespace to be consistent with everything else
Yes, please do have a look: https://github.com/generaltso/linguist I've consolidated and reworked quite a few things now, and it's working
I made breaking changes however so actually this pull request will not work If you want to integrate this feature in your own way and just use the library or whatever! Let me know what I can do to help make it happen :D
Yes I was very disappointed by having to do this but I ran into problems with Previously I had this: dayvonjersen/linguist@33fd2ec#diff-599c352338d4002d410b66e78d0f1f7dL89 And this: dayvonjersen/linguist@33fd2ec#diff-0f2d1bb050d649324fb99a481841ab4bL14 But the data stream could not be decoded after the classifier reached a certain If you know of any good way to embed large, serialized data into go programs ~ tso |
@generaltso thanks for following up! The way I prefer would be put linguist package under Gogs organization, so we can either:
Before you decide, note that in both cases, the code of package will possibly be modified a lot in order to better fit into Gogs main repository. |
@generaltso That's why you should use existing Semantic UI class rather than introducing custom CSS to keep the L&F consistent and keep the code (including templates) abstract & as small as possible. Have a look at Semantic UI's Menu which is basically all you need there. NOTE: This menu class is used in many places across Gogs, so just look for |
This is basically my second suggestion :D If you're Ok with this way, the project should works nicer with Gogs, and I'll start doing so. |
@unknwon make it so @nanoant ok well you can throw it out and start over again it was just a quick mockup EDIT: also the 3d box effect. I did this all for the 3d box effect D: The design of gogs has greatly improved with the recent switch to Semantic UI so I don't ~tso |
- Limit amount of data sent to linguist.LanguageByContents to 512 bytes (performance concern, though it is still slow...) - Limit amount of results to 8, sum remainder and display as "Other" (the widget looks cluttered with a lot of results) - Better error handling.
Hello again, I've continued work on my go linguist library over the past week. That project has advanced significantly since I first made this PR, and I've updated this branch to reflect any API changes I've made since I would stress again that this is just a proof-of-concept, offered as a I hope you find these updated changes more useful than the last in some ...and this PR was still open so now I'm leaving this message ok bye <3 |
Yes this is a good thing to do. Many other works are ahead of this. So need wait for more time. |
I really like the idea of adding this. |
+1 |
EDIT: ackk, I didn't select develop branch first sorry >_<
EDIT 2: didn't post my thoughtfully worded explanation,
only commit message second time. need to sleep.
Hi,
Long-time user, first-time contributor here. Really love this project
it's so cool to have my own personal clone of github to privately host
stuff.
I don't know what possessed me over the past two days or so,
but I really, really wanted to have github's language statistics bar
in gogs.
So much so that I thought I saw it mentioned here: #1447
Even though it's not an important feature, per-se, it's one of
the things I love looking at the most on github for some
reason I cannot explain.
The changes made here are probably not ideal, hopefully they can
be adapted to better fit the project.
The really substantial part is accomplished by this library I hacked on:
https://github.com/generaltso/linguist
And its command-line companion that I haven't finished yet:
https://github.com/generaltso/l
Please see commit message for more/slightly different words
<3
~tso