贡献者指南
欢迎使用 Casdoor! This document serves as a guide on how to contribute to Casdoor.
如果您发现任何不正确或缺失的信息,请留下您的评论或建议。
参与其中
有许多方式可以为Casdoor做贡献。 以下列出了一些贡献方式:
- 使用Casdoor并报告问题。 When using Casdoor, report any issues—whether they're bugs or proposals—on GitHub Discussions or on Discord before filing an issue on GitHub.
在报告问题时,请使用英语详细描述您的问题。
帮助编写文档。 Starting your contribution with documentation is a good choice.
帮助解决问题。 We have a table containing easy tasks suitable for beginners under Casdoor Easy Tasks, with different levels of challenges labeled with different tags.
贡献
如果你准备创建一个PR,这里是贡献者的工作流程:
将其分叉到你自己的仓库。
将你的分支克隆到本地仓库。
创建一个新的分支并在其上工作。
保持你的分支同步。
提交你的更改。 确保你的提交信息简洁明了。
将你的提交推送到你的分叉仓库。
创建从您的分支到我们的master分支的合并请求。
合并请求
在你开始之前
Casdoor以GitHub作为其开发平台,拉取请求是主要的贡献来源。
在开启拉取请求之前,你需要了解一些事情:
您首次创建拉取请求时,需要签署CLA。
解释为什么你要提交这个拉取请求,以及它将对仓库产生什么影响。
Only one commit is allowed per pull request. If the PR does more than one thing, please split it into multiple PRs.
如果有任何新添加的文件,请在新文件的顶部包含Casdoor许可证。
// 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标题必须为小写。
修复:一个类型的提交
fix修复了你的代码库中的一个错误。fix: prevent racing of requests特性:一个类型的提交 `
feat向代码库引入了一个新的功能。`feat: allow provided config object to extend other configs文档:一个类型的提交
docs添加或改进文档。docs: correct spelling of CHANGELOG
有关更多详细信息,请参阅Conventional Commits页面。
将PRs与Issues关联
您可以将拉取请求链接到问题,以显示正在进行的修复,并在合并拉取请求时自动关闭问题。
使用关键词将拉取请求链接到问题
您可以通过在拉取请求说明或提交消息中使用支持的关键词将拉取请求链接到议题。 拉取请求必须在默认分支上。
- close
- fix
- resolve
例如,在同一个仓库中的一个问题:
Fix: #902
有关更多详细信息,请参阅将 Pull Request 链接到问题。
修改PRs
您的PR可能需要修改。 当代码需要更改时,请修改同一PR;不要关闭PR并开启一个新的。 这是一个例子:
在你的本地修改代码。
修改你的提交。
git commit --amend
- 推送代码到远程仓库
git push --force
然后,你就成功地修改了PR!
相关代码
一些原则:
- 可读性:重要的代码应该有良好的文档记录。 代码风格应与现有的一致。
命名规则
例如,变量名使用signupUrl,UI使用Signup URL。
如何更新i18n数据?
请注意,我们使用 Crowdin 作为翻译平台,使用 i18next 作为翻译工具。 当你在web/目录中使用i18next添加字符串时,你可以运行i18n/generate_test.go来自动生成web/src/locales/**/data.json。
运行 i18n/generate_test.go:
cd i18n && go test
默认情况下,所有语言都以英文填写。 在你的PR被合并后,我们鼓励你帮助翻译新添加的 字符串在web/src/locales/zh/data.json 通过 Crowdin。
如果你对某种语言不熟悉,请不要翻译它;保持文件原样。
许可证书
通过向Casdoor做出贡献,您同意您的贡献将根据Apache许可证进行许可。