Kyle D
8220e50b56
Substitute variables in path names of template repos too ( #25294 )
...
### Summary
Extend the template variable substitution to replace file paths. This
can be helpful for setting up log files & directories that should match
the repository name.
### PR Changes
- Move files matching glob pattern when setting up repos from template
- For security, added ~escaping~ sanitization for cross-platform support
and to prevent directory traversal (thanks @silverwind for the
reference)
- Added unit testing for escaping function
- Fixed the integration tests for repo template generation by passing
the repo_template_id
- Updated the integration testfiles to add some variable substitution &
assert the outputs
I had to fix the existing repo template integration test and extend it
to add a check for variable substitutions.
Example:
![image](https://github.com/go-gitea/gitea/assets/12700993/621feb09-0ef3-460e-afa8-da74cd84fa4e )
1 year ago
flynnnnnnnnnn
e81ccc406b
Implement FSFE REUSE for golang files ( #21840 )
...
Change all license headers to comply with REUSE specification.
Fix #16132
Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2 years ago
Kyle D
c8ded77680
Kd/ci playwright go test ( #20123 )
...
* Add initial playwright config
* Simplify Makefile
* Simplify Makefile
* Use correct config files
* Update playwright settings
* Fix package-lock file
* Don't use test logger for e2e tests
* fix frontend lint
* Allow passing TEST_LOGGER variable
* Init postgres database
* use standard gitea env variables
* Update playwright
* update drone
* Move empty env var to commands
* Cleanup
* Move integrations to subfolder
* tests integrations to tests integraton
* Run e2e tests with go test
* Fix linting
* install CI deps
* Add files to ESlint
* Fix drone typo
* Don't log to console in CI
* Use go test http server
* Add build step before tests
* Move shared init function to common package
* fix drone
* Clean up tests
* Fix linting
* Better mocking for page + version string
* Cleanup test generation
* Remove dependency on gitea binary
* Fix linting
* add initial support for running specific tests
* Add ACCEPT_VISUAL variable
* don't require git-lfs
* Add initial documentation
* Review feedback
* Add logged in session test
* Attempt fixing drone race
* Cleanup and bump version
* Bump deps
* Review feedback
* simplify installation
* Fix ci
* Update install docs
2 years ago
Lunny Xiao
86c85c19b6
Refactor AssertExistsAndLoadBean to use generics ( #20797 )
...
* Refactor AssertExistsAndLoadBean to use generics
* Fix tests
Co-authored-by: zeripath <art27@cantab.net>
2 years ago
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
KN4CK3R
3f280f89e7
Update HTTP status codes to modern codes ( #18063 )
...
* 2xx/3xx/4xx/5xx -> http.Status...
* http.StatusFound -> http.StatusTemporaryRedirect
* http.StatusMovedPermanently -> http.StatusPermanentRedirect
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
Gusted
c98dd7a3e0
Remove unnecessary variable assignments ( #17695 )
...
* Remove unnecessary variable assignments
As title
* enable ineffassign
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years ago
wxiaoguang
81926d61db
Decouple unit test, remove intermediate `unittestbridge` package ( #17662 )
...
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
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
zeripath
055f6d2296
Fix "data race" in testlogger ( #9159 )
...
* Fix data race in testlogger
* Update git_helper_for_declarative_test.go
5 years ago
John Olheiser
74a6add4d9
Template Repositories ( #8768 )
...
* Start work on templates
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Continue work
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix IsTemplate vs IsGenerated
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix tabs vs spaces
* Tabs vs Spaces
* Add templates to API & start adding tests
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix integration tests
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Remove unused User
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move template tests to existing repos
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Minor re-check updates and cleanup
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* make fmt
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Test cleanup
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix optionalbool
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* make fmt
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Test fixes and icon change
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add new user and repo for tests
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix tests (finally)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update meta repo with env variables
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move generation to create page
Combine with repo create template
Modify API search to prioritize owner for repo
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix tests and coverage
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix swagger and JS lint
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix API searching for own private repos
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Change wording
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix repo search test. User had a private repo that didn't show up
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Another search test fix
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Clarify git content
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Feedback updates
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add topics WIP
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Finish adding topics
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update locale
Signed-off-by: jolheiser <john.olheiser@gmail.com>
5 years ago