Commit graph

6 commits

Author SHA1 Message Date
Kamil Trzciński
650f40865e Forbid the use of #reload and prefer #reset
The `#reload` makes to load all objects into memory,
and the main purpose of `#reload` is to drop the association cache.

The `#reset` seems to solve exactly that case.
2019-04-15 13:05:14 +02:00
Igor Drozdov
732f892db3 Return cached languages if they've been detected before 2019-03-20 20:33:49 +03:00
Yorick Peterse
2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
gfyoung
2ad1688be9 Enable frozen string in vestigial app files
Partially addresses #47424.
2018-08-12 11:07:35 -07:00
Zeger-Jan van de Weg
6e03a0f75c
Update query simplification
Rails 5 didn't like the arel usage, see:
https://gitlab.com/gitlab-org/gitlab-ce/issues/49873#note_92040225

This change makes that right, but also makes the query nicer. I'm not
sure anymore why it didn't work before, however there were issues with
it that have been resolved.
2018-08-02 14:09:49 +02:00
Zeger-Jan van de Weg
79a5d76801
Add repository languages for projects
Our friends at GitHub show the programming languages for a long time,
and inspired by that this commit means to create about the same
functionality.

Language detection is done through Linguist, as before, where the
difference is that we cache the result in the database. Also, Gitaly can
incrementaly scan a repository. This is done through a shell out, which
creates overhead of about 3s each run. For now this won't be improved.

Scans are triggered by pushed to the default branch, usually `master`.
However, one exception to this rule the charts page. If we're requesting
this expensive data anyway, we just cache it in the database.

Edge cases where there is no repository, or its empty are caught in the
Repository model. This makes use of Redis caching, which is probably
already loaded.

The added model is called RepositoryLanguage, which will make it harder
if/when GitLab supports multiple repositories per project. However, for
now I think this shouldn't be a concern. Also, Language could be
confused with the i18n languages and felt like the current name was
suiteable too.

Design of the Project#Show page is done with help from @dimitrieh. This
change is not visible to the end user unless detections are done.
2018-08-01 18:58:29 +02:00