Merged
Conversation
hanzei
commented
Apr 16, 2020
Comment on lines
-58
to
-70
| func (h *Handler) handleErrorWithCode(w http.ResponseWriter, code int, errTitle string, err error) { | ||
| w.Header().Set("Content-Type", "application/json") | ||
| w.WriteHeader(code) | ||
| b, _ := json.Marshal(struct { | ||
| Error string `json:"error"` | ||
| Details string `json:"details"` | ||
| }{ | ||
| Error: errTitle, | ||
| Details: err.Error(), | ||
| }) | ||
| _, _ = w.Write(b) | ||
| } | ||
|
|
Comment on lines
200
to
+206
| func (p *Plugin) MessageWillBeUpdated(c *plugin.Context, post *model.Post, _ *model.Post) (*model.Post, string) { | ||
| conf := p.getConfig() | ||
| if conf.EnableOnUpdate { | ||
| return p.ProcessPost(c, post) | ||
| } else { | ||
| if !conf.EnableOnUpdate { | ||
| return post, "" | ||
| } | ||
|
|
||
| return p.ProcessPost(c, post) |
Contributor
Author
There was a problem hiding this comment.
Invested the logic here to make it more readable
Codecov Report
@@ Coverage Diff @@
## master #108 +/- ##
==========================================
+ Coverage 41.98% 42.62% +0.64%
==========================================
Files 6 6
Lines 574 563 -11
==========================================
- Hits 241 240 -1
+ Misses 313 303 -10
Partials 20 20
Continue to review full report at Codecov.
|
levb
approved these changes
Apr 16, 2020
Contributor
Author
|
@DHaussermann Please do a smoke test on the changes |
DHaussermann
approved these changes
Apr 23, 2020
This was referenced Apr 23, 2020
This was referenced Jun 11, 2020
This was referenced Aug 11, 2020
This was referenced Sep 15, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR copies most of the golangci-lint configuration from mattermost/mattermost-plugin-starter-template#90 into this repo. This helps with a consistent code style and should improve code quality over time.
Most changes are straightforward and just style wise. I did comment on the more tricky ones.
This is an example PR on how to integrate GolangCI-Lint. It should be used as an example for other plugins also adopting the tool.