Wim
cb50375e2b
Add more linters to improve code readability ( #19989 )
...
Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability
- nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
- unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions
- wastedassign - https://github.com/sanposhiho/wastedassign - wastedassign finds wasted assignment statements.
- notlintlint - Reports ill-formed or insufficient nolint directives
- stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent
- excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003 ) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005 )
2 years ago
Lunny Xiao
1a9821f57a
Move issues related files into models/issues ( #19931 )
...
* Move access and repo permission to models/perm/access
* fix test
* fix git test
* Move functions sequence
* Some improvements per @KN4CK3R and @delvh
* Move issues related code to models/issues
* Move some issues related sub package
* Merge
* Fix test
* Fix test
* Fix test
* Fix test
* Rename some files
2 years ago
zeripath
ffb7ab31f2
Estimate Action Count in Statistics ( #19775 )
2 years ago
Lunny Xiao
fd7d83ace6
Move almost all functions' parameter db.Engine to context.Context ( #19748 )
...
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
3 years ago
Lunny Xiao
cbd45471b1
Move access and repo permission to models/perm/access ( #19350 )
...
* Move access and repo permission to models/perm/access
* Remove unnecessary code
3 years ago
6543
e2a3f3d259
Federation: return useful statistic information for nodeinfo ( #19561 )
...
Add statistic information for total user count, active user count, issue count and comment count for `/nodeinfo`
3 years ago
Lunny Xiao
1dfa26e00e
Move milestone to models/issues/ ( #19278 )
...
* Move milestone to models/issues/
* Fix lint
* Fix test
* Fix lint
* Fix lint
3 years ago
Lunny Xiao
bd97736b9c
Move project files into models/project sub package ( #17704 )
...
* Move project files into models/project sub package
* Fix test
* Fix test
* Fix test
* Fix build
* Fix test
* Fix template bug
* Fix bug
* Fix lint
* Fix test
* Fix import
* Improve codes
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
Lunny Xiao
b06b9a056c
Move organization related structs into sub package ( #18518 )
...
* Move organization related structs into sub package
* Fix test
* Fix lint
* Move more functions into sub packages
* Fix bug
* Fix test
* Update models/organization/team_repo.go
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Apply suggestions from code review
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix fmt
* Follow suggestion from @Gusted
* Fix test
* Fix test
* Fix bug
* Use ctx but db.DefaultContext on routers
* Fix bug
* Fix bug
* fix bug
* Update models/organization/team_user.go
* Fix bug
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years ago
Lunny Xiao
de8e3948a5
Refactor auth package ( #17962 )
3 years ago
Lunny Xiao
5723240490
Some repository refactors ( #17950 )
...
* some repository refactors
* remove unnecessary code
* Fix test
* Remove unnecessary banner
3 years ago
Lunny Xiao
3ca5dc7e32
Move keys to models/asymkey ( #17917 )
...
* Move keys to models/keys
* Rename models/keys -> models/asymkey
* change the missed package name
* Fix package alias
* Fix test
* Fix docs
* Fix test
* Fix test
* merge
3 years ago
Lunny Xiao
719bddcd76
Move repository model into models/repo ( #17933 )
...
* Some refactors related repository model
* Move more methods out of repository
* Move repository into models/repo
* Fix test
* Fix test
* some improvements
* Remove unnecessary function
3 years ago
Lunny Xiao
a666829a37
Move user related model into models/user ( #17781 )
...
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
3 years ago
Lunny Xiao
fc3d082609
Move attachment into models/repo/ ( #17650 )
...
* Move attachment into models/repo/
* Fix test
* Fix bug
3 years ago
Lunny Xiao
95d3266bee
Move user follow and openid into models/user/ ( #17613 )
...
* Move UserRedirect into models/user/
* Fix lint & test
* Fix lint
* Fix lint
* remove nolint comment
* Fix lint
* Move user follow and openid into models/user
* Ignore the lint
* Ignore the lint
* Fix test
* ignore stutters lint on UserOpenID
3 years ago
Lunny Xiao
33fca2b537
Move webhook into models/webhook/ ( #17579 )
3 years ago
Romain
987152ba40
Add metrics to get issues by repository ( #17225 )
3 years ago
Romain
fc5ee1edf9
Add metrics to get issues by label ( #17201 )
...
* Add metrics to get issues by label
* Add comment on IssueByLabelCount
* Code review - Unify "AS" in SQL (#17201 )
* Code review - Remove useless join (#17201 )
* Code review - Disable issue_by_label by default in settings (#17201 )
* use e
* restore empty line
* update docs
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
Romain
c64e2a319f
Add projects and project boards in exposed metrics ( #17202 )
...
* Add projects and project boards in exposed metrics
* Refactor db.GetEngine
Co-authored-by: delvh <dev.lh@web.de>
3 years ago
Lunny Xiao
5842a55b31
Move login related structs and functions to models/login ( #17093 )
...
* Move login related structs and functions to models/login
* Fix test
* Fix lint
* Fix lint
* Fix lint of windows
* Fix lint
* Fix test
* Fix test
* Only load necessary fixtures when preparing unit tests envs
* Fix lint
* Fix test
* Fix test
* Fix error log
* Fix error log
* Fix error log
* remove unnecessary change
* fix error log
* merge main branch
3 years ago
zeripath
9302eba971
DBContext is just a Context ( #17100 )
...
* DBContext is just a Context
This PR removes some of the specialness from the DBContext and makes it context
This allows us to simplify the GetEngine code to wrap around any context in future
and means that we can change our loadRepo(e Engine) functions to simply take contexts.
Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix unit tests
Signed-off-by: Andrew Thornton <art27@cantab.net>
* another place that needs to set the initial context
Signed-off-by: Andrew Thornton <art27@cantab.net>
* avoid race
Signed-off-by: Andrew Thornton <art27@cantab.net>
* change attachment error
Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
Lunny Xiao
a4bfef265d
Move db related basic functions to models/db ( #17075 )
...
* Move db related basic functions to models/db
* Fix lint
* Fix lint
* Fix test
* Fix lint
* Fix lint
* revert unnecessary change
* Fix test
* Fix wrong replace string
* Use *Context
* Correct committer spelling and fix wrong replaced words
Co-authored-by: zeripath <art27@cantab.net>
3 years ago