Showing 24 of 61 total issues
Function run
has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring. Open
func run(opt *RunOpt) (err error) {
// Prepare to be canceled.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run
has 193 lines of code (exceeds 50 allowed). Consider refactoring. Open
func run(opt *RunOpt) (err error) {
// Prepare to be canceled.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Function TestGoArgumentSet
has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring. Open
func TestGoArgumentSet(t *testing.T) {
var (
travis *Travis
res TestCaseSet
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TestPythonArgumentSet
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func TestPythonArgumentSet(t *testing.T) {
var (
travis *Travis
res TestCaseSet
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TestGoArgumentSet
has 140 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestGoArgumentSet(t *testing.T) {
var (
travis *Travis
res TestCaseSet
Function TestPythonArgumentSet
has 120 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestPythonArgumentSet(t *testing.T) {
var (
travis *Travis
res TestCaseSet
Function TestPythonOverwriteEvnSet
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func TestPythonOverwriteEvnSet(t *testing.T) {
var err error
// The following configuration is copied from matplotlib.
travis, err := NewTravis([]byte(`language: "python"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run
has 19 return statements (exceeds 4 allowed). Open
func run(opt *RunOpt) (err error) {
// Prepare to be canceled.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Function TestPythonOverwriteEvnSet
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestPythonOverwriteEvnSet(t *testing.T) {
var err error
// The following configuration is copied from matplotlib.
travis, err := NewTravis([]byte(`language: "python"
Method Travis.argumentSetPython
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (t *Travis) argumentSetPython(logger io.Writer) (res TestCaseSet, err error) {
res = make(TestCaseSet)
global := parseEnv(strings.Join(t.Env.Global, " "))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Archive
has 9 return statements (exceeds 4 allowed). Open
func Archive(ctx context.Context, dir string, filename string) (err error) {
writeFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return
Method Travis.argumentSetGo
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func (t *Travis) argumentSetGo() (res TestCaseSet, err error) {
res = make(TestCaseSet)
global := parseEnv(strings.Join(t.Env.Global, " "))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TestArchive
has 7 return statements (exceeds 4 allowed). Open
func TestArchive(t *testing.T) {
temp := os.TempDir()
target := path.Join(temp, "test.tar.gz")
t.Logf("Creating an archive file: %s", target)
Function Start
has 7 return statements (exceeds 4 allowed). Open
func Start(ctx context.Context, tag, name string, env []string, output io.Writer) (err error) {
// Create a docker client.
cli, err := client.NewEnvClient()
if err != nil {
Function Dockerfile
has 6 return statements (exceeds 4 allowed). Open
func Dockerfile(travis *Travis, opt *DockerfileOpt, archive string) (res []byte, err error) {
var data []byte
// Loading the base template.
Function archiveContext
has 6 return statements (exceeds 4 allowed). Open
func archiveContext(ctx context.Context, root string, writer io.Writer) (err error) {
// Create a buffered writer.
bufWriter := bufio.NewWriter(writer)
defer bufWriter.Flush()
Function NewDisplay
has 6 return statements (exceeds 4 allowed). Open
func NewDisplay(ctx context.Context, title string, maxSection int) (display *Display, nctx context.Context, err error) {
g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
return
Function RestoreAsset
has 6 return statements (exceeds 4 allowed). Open
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
Function Entrypoint
has 5 return statements (exceeds 4 allowed). Open
func Entrypoint(travis *Travis) (res []byte, err error) {
var (
data []byte
temp *template.Template
Method Display.Layout
has 5 return statements (exceeds 4 allowed). Open
func (d *Display) Layout(g *gocui.Gui) error {
if d.closed {
return fmt.Errorf("Display has been closed already")
}