Skip to content

Commit

Permalink
pre-commit: add more rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jul 10, 2024
1 parent 04586c7 commit a89341e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ jobs:
- name: Install libolm
run: sudo apt-get install libolm-dev libolm3

- name: Install goimports
- name: Install dependencies
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
export PATH="$HOME/go/bin:$PATH"
- name: Install pre-commit
run: pip install pre-commit

- name: Lint
run: pre-commit run -a
- name: Run pre-commit
uses: pre-commit/[email protected]
14 changes: 13 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude_types: [markdown]
Expand All @@ -12,4 +12,16 @@ repos:
rev: v1.0.0-rc.1
hooks:
- id: go-imports-repo
args:
- "-local"
- "go.mau.fi/mautrix-signal"
- "-w"
- id: go-vet-repo-mod
- id: go-staticcheck-repo-mod
- id: go-mod-tidy

- repo: https://github.com/beeper/pre-commit-go
rev: v0.3.1
hooks:
- id: zerolog-ban-msgf
- id: zerolog-use-stringer
12 changes: 9 additions & 3 deletions pkg/connector/handleslack.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *SlackClient) HandleSlackEvent(rawEvt any) {
s.UserLogin.Bridge.QueueRemoteEvent(s.UserLogin, wrapped)
}
case *slack.EmojiChangedEvent:
//go ut.handleEmojiChange(ctx, evt)
go s.handleEmojiChange(ctx, evt)
case *slack.FileSharedEvent, *slack.FilePublicEvent, *slack.FilePrivateEvent,
*slack.FileCreatedEvent, *slack.FileChangeEvent, *slack.FileDeletedEvent,
*slack.DesktopNotificationEvent, *slack.ReconnectUrlEvent, *slack.LatencyReport:
Expand Down Expand Up @@ -452,6 +452,12 @@ func (s *SlackMessage) GetTargetMessage() networkid.MessageID {
}

func (s *SlackMessage) GetChatInfoChange(ctx context.Context) (*bridgev2.ChatInfoChange, error) {
// TODO implement
return &bridgev2.ChatInfoChange{}, nil
fullChatInfo, err := s.Client.fetchChatInfo(ctx, s.Data.Channel, false)
if err != nil {
return nil, fmt.Errorf("failed to get chat info: %w", err)
}
// TODO implement deltas instead of full resync
return &bridgev2.ChatInfoChange{
ChatInfo: fullChatInfo,
}, nil
}
4 changes: 2 additions & 2 deletions pkg/msgconv/msgconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func (mc *MessageConverter) GetMentionedUserInfo(ctx context.Context, userID str
if err != nil {
zerolog.Ctx(ctx).Err(err).Msg("Failed to get mentioned ghost")
} else if ghost != nil {
if ghost.Name == "" {
/*if ghost.Name == "" {
// TODO update ghost info
}
}*/
name = ghost.Name
mxid = ghost.Intent.GetMXID()
}
Expand Down

0 comments on commit a89341e

Please sign in to comment.