Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAnotherID committed Oct 19, 2024
2 parents d3aac73 + 3619e98 commit 0aee149
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 19 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Review Dog

on:
pull_request_target:
paths:
- '**.go'
- 'go.mod'
- '.github/workflows/reviewdog.yml'

jobs:
review-dog:
permissions:
checks: write
contents: read
pull-requests: write
name: Review Dog
runs-on: ubuntu-latest
steps:
- name: Code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- run: go get
- run: go generate ./...
- name: Set Up GolangCI-Lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run golangci-lint & reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
golangci-lint run | reviewdog -reporter=github-pr-review -f=golangci-lint
20 changes: 6 additions & 14 deletions .github/workflows/test_and_lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Test & Lint

on:
push:
paths:
Expand All @@ -10,10 +12,9 @@ on:
- 'go.mod'
- '.github/workflows/test_and_lint.yml'

name: Test & Lint

jobs:
test-and-lint:
name: Test & Lint
runs-on: ubuntu-latest
steps:
- name: Code
Expand All @@ -31,17 +32,8 @@ jobs:

- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v6
if: github.event.name == 'pull_request'
with:
version: 'v1.60'
args: '--timeout 9999s'
only-new-issues: true
skip-cache: true

- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v6
if: github.event.name != 'pull_request'
if: github.event_name != 'pull_request'
with:
version: 'v1.60'
version: 'v1.61.0'
args: '--timeout 9999s'
skip-cache: true
skip-cache: true
10 changes: 10 additions & 0 deletions .reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# reviewdog.yml
runner:
golint-by-project-conf:
cmd: golint $(go list ./... | grep -v /vendor/)
format: golint
level: warning
govet-by-project-conf:
cmd: go vet
format: govet
level: error
2 changes: 1 addition & 1 deletion dice/censor/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (t *trie) Match(text string) (sensitiveWords map[string]Level) {

sensitiveWords = map[string]Level{}
chars := []rune(text)
for i := range len(chars) {
for i := range chars {
cur := t.root.findChild(chars[i])
if cur == nil {
continue
Expand Down
2 changes: 1 addition & 1 deletion dice/dice_jsvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func sameScriptInfos(a []*JsScriptInfo, b []*JsScriptInfo) bool {
if len(a) != len(b) {
return false
}
for i := range len(a) {
for i := range a {
if !sameScriptInfo(a[i], b[i]) {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion dice/platform_adapter_gocq.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func (pa *PlatformAdapterGocq) Serve() int {

if len(m2) == len(items) {
ok := true
for i := range len(m2) {
for i := range m2 {
if m2[i] != items[i] {
ok = false
break
Expand Down
2 changes: 1 addition & 1 deletion dice/platform_adapter_walleq.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func (pa *PlatformAdapterWalleQ) Serve() int {

if len(m2) == len(items) {
ok := true
for i := range len(m2) {
for i := range m2 {
if m2[i] != items[i] {
ok = false
break
Expand Down
2 changes: 1 addition & 1 deletion dice/rollvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ func (e *RollExpression) Evaluate(_ *Dice, ctx *MsgContext) (*VMStack, string, e
}

text := "{"
for i := range len(nums) {
for i := range nums {
if int64(i) == diceKQ {
text += "| "
}
Expand Down

0 comments on commit 0aee149

Please sign in to comment.