Skip to content

Commit

Permalink
chore: clean up useless or non-compliant content
Browse files Browse the repository at this point in the history
chore: update dependency version

add PR template
  • Loading branch information
ozline committed Dec 1, 2024
1 parent c39db76 commit 28b3955
Show file tree
Hide file tree
Showing 25 changed files with 282 additions and 373 deletions.
47 changes: 47 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- 感谢您提交一个 Pull Request!
-->
#### 自查 PR 结构
<!--
自查通过后在方框中打一个 x 就可以勾选,如果需要访问关于commit 签名的信息,可以访问
https://docs.github.com/zh/authentication/managing-commit-signature-verification/signing-commits
一个可能的标题示例: `[BREAKING CHANGE] feat(core): add new feature`
-->
- [ ] PR 标题符合这个格式: \<type\>(optional scope): \<description\>
- [ ] 此 PR 标题的描述以用户为导向,足够清晰,其他人可以理解。
- [ ] 我已经对所有 commit 提供了签名(GPG 密钥签名、SSH 密钥签名)

- [ ] 这个 PR 属于强制变更/破坏性更改
> 如果是,请在 PR 标题中添加 `BREAKING CHANGE` 前缀,并在 PR 描述中详细说明。
#### 这个 PR 的类型是什么?
<!--
添加以下类型的一种:
build: 影响构建系统或外部依赖项的更改 (常用 scope: gulp, broccoli, npm)
ci: 更改我们的 CI 配置文件和脚本 (常用 scope: Travis, Circle, BrowserStack, SauceLabs)
docs: 只包含文档的更改
feat: 一个新的特性
optimize: 对已有代码的优化
fix: 修正 bug
perf: 对代码的性能提升
refactor: 重构,或代码更改既没有修复错误也没有添加功能
style: 不影响代码含义的更改 (空白行/空格, 格式优化, 缺失的分号, etc.)
test: 添加缺失的测试或更正现有的测试
chore: 构建过程或辅助工具和库(如文档生成)的变更
-->

#### 这个 PR 做了什么 / 我们为什么需要这个 PR?
<!--
对于每次的Code Review,我们都需要一个清晰的 PR 描述,以便 Reviewer 能够理解 PR 的目的。
这是对 Reviewer 一个很好的引导,减轻 Review 的难度和压力,同时便于 PR 更快的通过
-->

#### (可选)这个 PR 解决了哪个/些 issue?
<!--
PR 合并时会自动关闭链接问题
用法: `Fixes #<issue number>`, 或者 `Fixes (粘贴 issue 链接)`.
-->

#### 对 Reviewer 预留的一些提醒
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
name: License
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check license header
run: |
make license && git add pkg cmd &&
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run govulncheck

on:
push:
branches:
- develop
paths:
- "**"
- "!**.md"
pull_request:
paths:
- "**"
- "!**.md"

jobs:
vulncheck-check:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Fetch Repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
cache: false

- name: Install Govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run Govulncheck
run: govulncheck ./...

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,14 @@ vet:
lint:
golangci-lint run --config=./.golangci.yml --tests --allow-parallel-runners --sort-results --show-stats --print-resources-usage

# 检查依赖漏洞
.PHONY: vulncheck
vulncheck:
govulncheck ./...

# 一键修正规范并执行代码检查
.PHONY: verify
verify: vet fmt import lint
verify: vet fmt import lint vulncheck

# 补齐 license
.PHONY: license
Expand Down
4 changes: 0 additions & 4 deletions api/middleware/get_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package middleware

import (
"context"
"fmt"
"strings"

"github.com/cloudwego/hertz/pkg/app"
Expand All @@ -41,9 +40,6 @@ func GetHeaderParams() app.HandlerFunc {
return
}
cookies := strings.Split(temp, ",")
// 将id和cookies放入context中
fmt.Println(id)
fmt.Println(cookies)
ctx = api.NewContext(ctx, &model.LoginData{
Id: id,
Cookies: cookies,
Expand Down
38 changes: 7 additions & 31 deletions api/router/api/middleware.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/router/custom_router.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/rpc/academic.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
)

func InitAcademicRPC() {
client, err := client.InitAcademicRPC()
c, err := client.InitAcademicRPC()

Check warning on line 31 in api/rpc/academic.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/academic.go#L31

Added line #L31 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.academic InitAcademicRPC failed, err %v", err)
}
academicClient = *client
academicClient = *c

Check warning on line 35 in api/rpc/academic.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/academic.go#L35

Added line #L35 was not covered by tests
}

func GetScoresRPC(ctx context.Context, req *academic.GetScoresRequest) (scores []*model.Score, err error) {
Expand Down
4 changes: 2 additions & 2 deletions api/rpc/classroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
)

func InitClassroomRPC() {
client, err := client.InitClassroomRPC()
c, err := client.InitClassroomRPC()

Check warning on line 31 in api/rpc/classroom.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/classroom.go#L31

Added line #L31 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.classroom InitClassroomRPC failed, err %v", err)
}
classroomClient = *client
classroomClient = *c

Check warning on line 35 in api/rpc/classroom.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/classroom.go#L35

Added line #L35 was not covered by tests
}

func GetEmptyRoomRPC(ctx context.Context, req *classroom.EmptyRoomRequest) (emptyRooms []*model.Classroom, err error) {
Expand Down
4 changes: 2 additions & 2 deletions api/rpc/course.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
)

func InitCourseRPC() {
client, err := client.InitCourseRPC()
c, err := client.InitCourseRPC()

Check warning on line 31 in api/rpc/course.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/course.go#L31

Added line #L31 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.course InitCourseRPC failed, err %v", err)
}
courseClient = *client
courseClient = *c

Check warning on line 35 in api/rpc/course.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/course.go#L35

Added line #L35 was not covered by tests
}

func GetCourseListRPC(ctx context.Context, req *course.CourseListRequest) (courses []*model.Course, err error) {
Expand Down
12 changes: 6 additions & 6 deletions api/rpc/launch_screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ import (
)

func InitLaunchScreenRPC() {
client, err := client.InitLaunchScreenRPC()
c, err := client.InitLaunchScreenRPC()

Check warning on line 31 in api/rpc/launch_screen.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/launch_screen.go#L31

Added line #L31 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.launch_screen InitLaunchScreenRPC failed, err %v", err)
}
launchScreenClient = *client
launchScreenClient = *c

Check warning on line 35 in api/rpc/launch_screen.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/launch_screen.go#L35

Added line #L35 was not covered by tests
}

func InitLaunchScreenStreamRPC() {
client, err := client.InitLaunchScreenStreamRPC()
c, err := client.InitLaunchScreenStreamRPC()

Check warning on line 39 in api/rpc/launch_screen.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/launch_screen.go#L39

Added line #L39 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.launch_screen InitLaunchScreenStreamRPC failed, err %v", err)
}
launchScreenStreamClient = *client
launchScreenStreamClient = *c

Check warning on line 43 in api/rpc/launch_screen.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/launch_screen.go#L43

Added line #L43 was not covered by tests
}

func CreateImageRPC(ctx context.Context, req *launch_screen.CreateImageRequest, file [][]byte) (image *model.Picture, err error) {
Expand All @@ -63,7 +63,7 @@ func CreateImageRPC(ctx context.Context, req *launch_screen.CreateImageRequest,
return nil, errno.InternalServiceError.WithMessage(err.Error())
}
}
// Tell the server there'll be no more message from client
// 终止传输
resp, err := stream.CloseAndRecv()
if err != nil {
logger.Errorf("CreateImageRPC: RPC called failed: %v", err.Error())
Expand Down Expand Up @@ -117,7 +117,7 @@ func ChangeImageRPC(ctx context.Context, req *launch_screen.ChangeImageRequest,
return nil, errno.InternalServiceError.WithMessage(err.Error())
}
}
// Tell the server there'll be no more message from client
// 终止传输
resp, err := stream.CloseAndRecv()
if err != nil {
logger.Errorf("ChangeImageRPC: RPC called failed: %v", err.Error())
Expand Down
4 changes: 2 additions & 2 deletions api/rpc/paper.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
)

func InitPaperRPC() {
client, err := client.InitPaperRPC()
c, err := client.InitPaperRPC()

Check warning on line 31 in api/rpc/paper.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/paper.go#L31

Added line #L31 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.Paper InitPaperRPC failed, err %v", err)
}
paperClient = *client
paperClient = *c

Check warning on line 35 in api/rpc/paper.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/paper.go#L35

Added line #L35 was not covered by tests
}

func GetDownloadUrlRPC(ctx context.Context, req *paper.GetDownloadUrlRequest) (url string, err error) {
Expand Down
4 changes: 2 additions & 2 deletions api/rpc/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import (
)

func InitUserRPC() {
client, err := client.InitUserRPC()
c, err := client.InitUserRPC()

Check warning on line 30 in api/rpc/user.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/user.go#L30

Added line #L30 was not covered by tests
if err != nil {
logger.Fatalf("api.rpc.user InitUserRPC failed, err is %v", err)
}
userClient = *client
userClient = *c

Check warning on line 34 in api/rpc/user.go

View check run for this annotation

Codecov / codecov/patch

api/rpc/user.go#L34

Added line #L34 was not covered by tests
}

func GetLoginDataRPC(ctx context.Context, req *user.GetLoginDataRequest) (string, []string, error) {
Expand Down
Loading

0 comments on commit 28b3955

Please sign in to comment.