Skip to content

Commit

Permalink
remove 'isatty' because isatty==false in CI server
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Dec 12, 2016
1 parent f60bac3 commit 690b877
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions cmd/reviewdog/main.go
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/haya14busa/errorformat/fmts"
"github.com/haya14busa/reviewdog"
"github.com/haya14busa/reviewdog/project"
isatty "github.com/mattn/go-isatty"
"github.com/mattn/go-shellwords"
)

Expand All @@ -45,8 +44,6 @@ type option struct {
name string // tool name which is used in comment
ci string
conf string

isatty bool // it's not specified by flag
}

// flags doc
Expand Down Expand Up @@ -89,8 +86,6 @@ func init() {
flag.StringVar(&opt.name, "name", "", nameDoc)
flag.StringVar(&opt.ci, "ci", "", ciDoc)
flag.StringVar(&opt.conf, "conf", "reviewdog.yml", confDoc)

opt.isatty = isatty.IsTerminal(os.Stdin.Fd())
}

func usage() {
Expand All @@ -116,7 +111,8 @@ func run(r io.Reader, w io.Writer, opt *option) error {
return runList(w)
}

isProject := opt.isatty && len(opt.efms) == 0 && opt.f == ""
// assume it's project based run when both -efm ane -f are not specified
isProject := len(opt.efms) == 0 && opt.f == ""

var cs reviewdog.CommentService
var ds reviewdog.DiffService
Expand Down
6 changes: 1 addition & 5 deletions cmd/reviewdog/main_test.go
Expand Up @@ -71,8 +71,7 @@ line3
func TestRun_project(t *testing.T) {
t.Run("diff command is empty", func(t *testing.T) {
opt := &option{
conf: "reviewdog.yml",
isatty: true,
conf: "reviewdog.yml",
}
stdout := new(bytes.Buffer)
if err := run(nil, stdout, opt); err == nil {
Expand All @@ -86,7 +85,6 @@ func TestRun_project(t *testing.T) {
opt := &option{
conf: "reviewdog.notfound.yml",
diffCmd: "echo ''",
isatty: true,
}
stdout := new(bytes.Buffer)
if err := run(nil, stdout, opt); err == nil {
Expand All @@ -107,7 +105,6 @@ func TestRun_project(t *testing.T) {
opt := &option{
conf: conffile.Name(),
diffCmd: "echo ''",
isatty: true,
}
stdout := new(bytes.Buffer)
if err := run(nil, stdout, opt); err == nil {
Expand All @@ -128,7 +125,6 @@ func TestRun_project(t *testing.T) {
opt := &option{
conf: conffile.Name(),
diffCmd: "echo ''",
isatty: true,
}
stdout := new(bytes.Buffer)
if err := run(nil, stdout, opt); err != nil {
Expand Down

0 comments on commit 690b877

Please sign in to comment.