跳到主内容

Contributor Guide

欢迎使用 Casdoor! This document serves as a guideline on how to contribute to Casdoor.

If you find any incorrect or missing information, please leave your comments or suggestions.

Get Involved

有许多方式可以为Casdoor做贡献。 以下列出了一些贡献方式:

  • Use Casdoor and report issues. When using Casdoor, report any issues - whether they're bugs or proposals - on GitHub Discussions or on Discord before filing an issue on GitHub.
信息

Please use English to describe the details of your problem when reporting an issue.

  • Help with documentation. Starting your contribution work with docs is a good choice.

  • Help solve issues. We have a table that contains easy tasks suitable for beginners under Casdoor Easy Tasks, with different levels of challenges labeled with different tags.

贡献

If you are ready to create a PR, here is the workflow for contributors:

  1. Fork to your own repository.

  2. Clone your fork to a local repository.

  3. Create a new branch and work on it.

  4. Keep your branch in sync.

  5. Commit your changes. Make sure your commit message is concise.

  6. Push your commits to your forked repository.

  7. 创建从您的分支到我们的master分支的合并请求。

合并请求

Before You Get Started

Casdoor uses GitHub as its development platform, and pull requests are the primary source of contributions.

Here are some things you need to know before opening a pull request:

  • You need to sign the CLA when you first create a pull request.

  • Explain why you are submitting the pull request and what it will do to the repo.

  • Only one commit is allowed. If the PR does more than one thing, please split it.

  • If there are any newly added files, please include the Casdoor license at the top of the new file(s).

// Copyright 2022 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

Semantic PRs

您的合并请求应遵循常规承诺的样本。 基本要求是有PR 标题或至少一个 提交消息。 例如,三个常用的PR标题如下:

注意事项

PR titles must be in lowercase.

  1. fix: a commit of the type fix patches a bug in your codebase.

    fix: prevent racing of requests
  2. feat: a commit of the type feat introduces a new feature to the codebase.

    feat: allow provided config object to extend other configs
  3. docs: a commit of the type docs adds or improves documentation.

    docs: correct spelling of CHANGELOG

For more details, please refer to the Conventional Commits page.

Linking PRs with Issues

You can link a pull request to an issue to show a fix is in progress and to automatically close the issue when the pull request is merged.

Linking a Pull Request to an Issue Using a Keyword

您可以通过在拉取请求说明或提交消息中使用支持的关键词将拉取请求链接到议题。 拉取请求必须在默认分支上。

  • close
  • fix
  • resolve

An issue in the same repository, for instance:

Fix: #902

For more details, please refer to Linking a Pull Request to an Issue.

Modifying PRs

Your PR may need revision. Please modify the same PR when the code needs changes; don't close the PR and open a new one. Here is an example:

  • Modify the code on your local.

  • Modify your commit.

git commit --amend
  • 推送代码到远程仓库
git push --force

Then, you will have successfully modified the PR!

相关代码

Some Principles:

  • Readability: important code should be well-documented. Code style should comply with the existing one.

Naming Convention

For instance, signupUrl for variable names, Signup URL for UI.

How to Update i18n Data?

Please note that we use Crowdin as a translating platform and i18next as a translating tool. When you add strings using i18next in the web/ directory, you can run the i18n/generate_test.go to auto-generate web/src/locales/**/data.json.

Run i18n/generate_test.go:

cd i18n && go test

默认情况下,所有语言都以英文填写。 After your PR has been merged, you are encouraged to help translate the newly added strings in web/src/locales/zh/data.json by Crowdin.

注意事项

If you are not familiar with a language, please do not translate it; keep the file as it is.

许可证书

By contributing to Casdoor, you agree that your contributions will be licensed under the Apache License.