Removed dead code and added new travis tool

This commit is contained in:
Eduard Urbach 2018-11-08 20:30:36 +09:00
parent 9da70decfe
commit fb881eed81
3 changed files with 14 additions and 28 deletions

View File

@ -28,18 +28,20 @@ before_script:
- go get golang.org/x/lint/golint # Linter
- go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter
- go get github.com/fzipp/gocyclo # Cyclomatic complexity
- go get github.com/3rf/codecoroner # Dead code analysis
- npm install -g typescript # TypeScript
- git clone --depth=1 https://github.com/animenotifier/database ~/.aero/db/arn # Database
# script always run to completion (set +e). All of these code checks are must haves
# in a modern Go project.
script:
- make deps # Get dependencies. Allow this to fail because components cannot be found.
- make all # Build
# - test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
- go test -v . # Run all the tests
# - go test -v -race ./... # Run all the tests with the race detector enabled
- go vet ./... # go vet is the official Go static analyzer
- megacheck ./... # "go vet on steroids" + linter
- gocyclo -over 19 $GO_FILES # forbid code with huge functions
- golint -set_exit_status $(go list ./...) # one last linter
- make deps # Get dependencies. Allow this to fail because components cannot be found.
- make all # Build
# - test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
- go test -v . # Run all the tests
# - go test -v -race ./... # Run all the tests with the race detector enabled
- go vet ./... # go vet is the official Go static analyzer
- megacheck ./... # "go vet on steroids" + linter
- gocyclo -over 19 $GO_FILES # forbid code with huge functions
- golint -set_exit_status $(go list ./...) # one last linter
- codecoroner -ignore components funcs ./... # dead code analysis

View File

@ -32,12 +32,7 @@ func Get(ctx *aero.Context) string {
}
_, isPostable := obj.(arn.Postable)
if !isPostable {
return false
}
return true
return isPostable
})
arn.SortEditLogEntriesLatestFirst(entries)

View File

@ -14,7 +14,6 @@ import (
var (
scriptsETag = aero.ETagString(js.Bundle())
stylesETag = aero.ETagString(css.Bundle())
streams = map[string][]*aero.EventStream{}
)
// Events streams server events to the client.
@ -31,6 +30,7 @@ func Events(ctx *aero.Context) string {
go func() {
defer fmt.Println(user.Nick, "disconnected, stop sending events")
defer user.RemoveEventStream(stream)
stream.Events <- &aero.Event{
Name: "etag",
@ -54,18 +54,7 @@ func Events(ctx *aero.Context) string {
},
}
for {
select {
case <-stream.Closed:
user.RemoveEventStream(stream)
return
// case <-time.After(10 * time.Second):
// stream.Events <- &aero.Event{
// Name: "ping",
// }
}
}
<-stream.Closed
}()
return ctx.EventStream(stream)