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
783a021889
Never use /api/v1 from Gitea UI Pages ( #19318 )
...
Reusing `/api/v1` from Gitea UI Pages have pros and cons.
Pros:
1) Less code copy
Cons:
1) API/v1 have to support shared session with page requests.
2) You need to consider for each other when you want to change something about api/v1 or page.
This PR moves all dependencies to API/v1 from UI Pages.
Partially replace #16052
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
6543
c4d70a0325
Rename ctx.Form() to ctx.FormString() and move code into own file ( #16571 )
...
Followup from #16562 prepare for #16567
* Rename ctx.Form() to ctx.FormString()
* Reimplement FormX func to need less code and cpu cycles
* Move code into own file
3 years ago
Lunny Xiao
33e0b38287
Rename context.Query to context.Form ( #16562 )
3 years ago
6543
75205b5669
Fix some API bugs ( #16184 )
...
* Repository object only count releases as releases (fix #16144 )
* EditOrg respect RepoAdminChangeTeamAccess option (fix #16013 )
3 years ago
6543
0d1444751f
[API] Add pagination to ListBranches ( #14524 )
...
* make PaginateUserSlice generic -> PaginateSlice
* Add pagination to ListBranches
* add skip, limit to Repository.GetBranches()
* Move routers/api/v1/utils/utils PaginateSlice -> modules/util/paginate.go
* repo_module.GetBranches paginate
* fix & rename & more logging
* better description
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: a1012112796 <1012112796@qq.com>
4 years ago
6543
9e456b5a56
HotFix: Hide private partisipation in Orgs ( #13994 )
...
* HotFix: Hide private partisipation in Orgs
* refactor & add node to fuc GetOrganizations
4 years ago
6543
3f3447a1ea
API: Fix GetQueryBeforeSince ( #13559 )
4 years ago
6543
4160bd6ef1
Remove Unused Functions ( #10516 )
...
* remove ReplaceLeft
* remove GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName
* remove CheckUnitUser chainload to models.CheckUnitUser
* remove MakeAssigneeList
* remove DownloadDiff & DownloadPatch -> DownloadDiffOrPatch
* remove GetRandomBytesAsBase64
* remove PushUpdateDeleteTags
* remove GetUserByKeyID
(you still can resolve user by "k, err := GetPublicKeyByID; userID := k.OwnerID")
* remove BasicAuthEncode from struct package -> same function in modules/base/tools !
* remove UserID from api.utils
* remove unused func from structs package
5 years ago
SpaWn2KiLl
1f01f53c53
API add/generalize pagination ( #9452 )
...
* paginate results
* fixed deadlock
* prevented breaking change
* updated swagger
* go fmt
* fixed find topic
* go mod tidy
* go mod vendor with go1.13.5
* fixed repo find topics
* fixed unit test
* added Limit method to Engine struct; use engine variable when provided; fixed gitignore
* use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors
* set Page value on Home route
* improved memory allocations
* fixed response headers
* removed logfiles
* fixed import order
* import order
* improved swagger
* added function to get models.ListOptions from context
* removed pagesize diff on unit test
* fixed imports
* removed unnecessary struct field
* fixed go fmt
* scoped PR
* code improvements
* code improvements
* go mod tidy
* fixed import order
* fixed commit statuses session
* fixed files headers
* fixed headers; added pagination for notifications
* go mod tidy
* go fmt
* removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list
* Apply suggestions from code review
Co-Authored-By: 6543 <6543@obermui.de>
Co-Authored-By: zeripath <art27@cantab.net>
* fixed build error
* CI.restart()
* fixed merge conflicts resolve
* fixed conflicts resolve
* improved FindTrackedTimesOptions.ToOptions() method
* added backwards compatibility on ListReleases request; fixed issue tracked time ToSession
* fixed build error; fixed swagger template
* fixed swagger template
* fixed ListReleases backwards compatibility
* added page to user search route
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
5 years ago
6543
14a9687444
times Add filters ( #9373 )
...
(extend #9200 )
* add query param for GET functions (created Bevore & after)
* add test
* generalize func GetQueryBeforeSince
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
5 years ago
Ethan Koenig
93a1de4842
Fix repo API bug ( #2133 )
...
Don't require token when not necessary
7 years ago