0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-27 06:44:22 +01:00
gitea/docs/content/doc/contributing/guidelines-refactoring.en-us.md
John Olheiser bb25f85ce8
Refactor docs (#23752)
This was intended to be a small followup for
https://github.com/go-gitea/gitea/pull/23712, but...here we are.

1. Our docs currently use `slug` as the entire URL, which makes
refactoring tricky (see https://github.com/go-gitea/gitea/pull/23712).
Instead, this PR attempts to make future refactoring easier by using
slugs as an extension of the section. (Hugo terminology)
- What the above boils down to is this PR attempts to use directory
organization as URL management. e.g. `usage/comparison.en-us.md` ->
`en-us/usage/comparison/`, `usage/packages/overview.en-us.md` ->
`en-us/usage/packages/overview/`
- Technically we could even remove `slug`, as Hugo defaults to using
filename, however at least with this PR it means `slug` only needs to be
the name for the **current file** rather than an entire URL
2. This PR adds appropriate aliases (redirects) for pages, so anything
on the internet that links to our docs should hopefully not break.
3. A minor nit I've had for a while, renaming `seek-help` to `support`.
It's a minor thing, but `seek-help` has a strange connotation to it.
4. The commits are split such that you can review the first which is the
"actual" change, and the second is added redirects so that the first
doesn't break links elsewhere.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-28 11:33:41 +08:00

2.3 KiB

date title slug weight toc draft aliases menu
2023-02-14T00:00:00+00:00 Guidelines for Refactoring guidelines-refactoring 20 false false
/en-us/guidelines-refactoring
sidebar
parent name weight identifier
contributing Guidelines for Refactoring 20 guidelines-refactoring

Guidelines for Refactoring

Table of Contents

{{< toc >}}

Background

Since the first line of code was written at Feb 12, 2014, Gitea has grown to be a large project. As a result, the codebase has become larger and larger. The larger the codebase is, the more difficult it is to maintain. A lot of outdated mechanisms exist, a lot of frameworks are mixed together, some legacy code might cause bugs and block new features. To make the codebase more maintainable and make Gitea better, developers should keep in mind to use modern mechanisms to refactor the old code.

This document is a collection of guidelines for refactoring the codebase.

Refactoring Suggestions

  • Design more about the future, but not only resolve the current problem.
  • Reduce ambiguity, reduce conflicts, improve maintainability.
  • Describe the refactoring, for example:
    • Why the refactoring is needed.
    • How the legacy problems would be solved.
    • What's the Pros/Cons of the refactoring.
  • Only do necessary changes, keep the old logic as much as possible.
  • Introduce some intermediate steps to make the refactoring easier to review, a complete refactoring plan could be done in several PRs.
  • If there is any divergence, the TOC(Technical Oversight Committee) should be involved to help to make decisions.
  • Add necessary tests to make sure the refactoring is correct.
  • Non-bug refactoring is preferred to be done at the beginning of a milestone, it would be easier to find problems before the release.

Reviewing & Merging Suggestions

  • A refactoring PR shouldn't be kept open for a long time (usually 7 days), it should be reviewed as soon as possible.
  • A refactoring PR should be merged as soon as possible, it should not be blocked by other PRs.
  • If there is no objection from TOC, a refactoring PR could be merged after 7 days with one core member's approval (not the author).
  • Tolerate some dirty/hacky intermediate steps if the final result is good.
  • Tolerate some regression bugs if the refactoring is necessary, fix bugs as soon as possible.