Skip to content

Commit 2657e71

Browse files
davidsvantessonzeripath
authored andcommitted
Basic Design guidelines (describing different parts of the code) (#8601)
* Design guidelines with description of different parts of code * Better readability with code parts in bold.
1 parent 85e4190 commit 2657e71

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Translation](#translation)
1212
- [Code review](#code-review)
1313
- [Styleguide](#styleguide)
14+
- [Design guideline](#design-guideline)
1415
- [Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco)
1516
- [Release Cycle](#release-cycle)
1617
- [Maintainers](#maintainers)
@@ -118,6 +119,8 @@ An exception are the tools to build the CSS and images.
118119
- To build Images: ImageMagick, inkscape and zopflipng binaries must be
119120
available in your `PATH` to run `make generate-images`.
120121

122+
For more details on how to generate files, build and test Gitea, see the [hacking instructions](https://docs.gitea.io/en-us/hacking-on-gitea/)
123+
121124
## Code review
122125

123126
Changes to Gitea must be reviewed before they are accepted—no matter who
@@ -157,6 +160,22 @@ import (
157160
)
158161
```
159162

163+
## Design guideline
164+
165+
To maintain understandable code and avoid circular dependencies it is important to have a good structure of the code. The gitea code is divided into the following parts:
166+
167+
- **integration:** Integrations tests
168+
- **models:** Contains the data structures used by xorm to construct database tables. It also contains supporting functions to query and update the database. Dependecies to other code in Gitea should be avoided although some modules might be needed (for example for logging).
169+
- **models/fixtures:** Sample model data used in integration tests.
170+
- **models/migrations:** Handling of database migrations between versions. PRs that changes a database structure shall also have a migration step.
171+
- **modules:** Different modules to handle specific functionality in Gitea.
172+
- **public:** Frontend files (javascript, images, css, etc.)
173+
- **routers:** Handling of server requests. As it uses other Gitea packages to serve the request, other packages (models, modules or services) shall not depend on routers
174+
- **services:** Support functions for common routing operations. Uses models and modules to handle the request.
175+
- **templates:** Golang templates for generating the html output.
176+
- **vendor:** External code that Gitea depends on.
177+
178+
160179
## Developer Certificate of Origin (DCO)
161180

162181
We consider the act of contributing to the code by submitting a Pull

0 commit comments

Comments
 (0)