Showing 20 of 24 total issues
File p0d.go
has 884 lines of code (exceeds 500 allowed). Consider refactoring. Confirmed
package p0d
import (
"bytes"
"context"
Method P0d.initLog
has 144 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *P0d) initLog() {
PrintLogo()
PrintVersion()
fmt.Printf("\n")
if p.Config.File != "" {
Method Config.validate
has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring. Confirmed
func (cfg *Config) validate() *Config {
//we always want this.
cfg.Req.Method = strings.ToUpper(cfg.Req.Method)
if cfg.Req.Method == "" {
cfg.Req.Method = "GET"
- 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
P0d
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type P0d struct {
ID string
Time Time
Config Config
OS OS
Method P0d.doLogLive
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *P0d) doLogLive() {
logLiveLock.Lock()
elpsd := time.Now()
lw := p.liveWriters
Method ProgressBar.render
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Confirmed
func (p *ProgressBar) render(now time.Time, pod *P0d) string {
if pod.Time.Stop.IsZero() {
fsi := p.chunkPropIndexFor(now, pod)
- 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
Method Config.validate
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (cfg *Config) validate() *Config {
//we always want this.
cfg.Req.Method = strings.ToUpper(cfg.Req.Method)
if cfg.Req.Method == "" {
cfg.Req.Method = "GET"
Method P0d.Race
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Confirmed
func (p *P0d) Race() {
osStatsDone := make(chan struct{}, 2)
p.initOSStats(osStatsDone)
p.detectRemoteConnSettings()
p.initLog()
Method P0d.initLog
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (p *P0d) initLog() {
PrintLogo()
PrintVersion()
fmt.Printf("\n")
if p.Config.File != "" {
- 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
Method P0d.scaffoldHttpReq
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (p *P0d) scaffoldHttpReq() *http.Request {
var body io.Reader
//multipartwriter adds a boundary
var mpContentType string
- 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
Method P0d.doReqAtmpts
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Confirmed
func (p *P0d) doReqAtmpts(i int, ras chan<- ReqAtmpt, done <-chan struct{}) {
ReqAtmpt:
for {
select {
case <-done:
- 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 NewP0dWithValues
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func NewP0dWithValues(c int, d int, u string, h string, o string, s bool) *P0d {
Method Config.validateReqBody
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (cfg *Config) validateReqBody() {
if len(cfg.Req.Body) > 0 {
if len(cfg.Req.FormData) > 0 {
cfg.panic("when specifying request body, cannot have form data")
}
- 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
Avoid deeply nested control flow statements. Open
if p.chunkProps[i].hasErrors {
f.WriteString(Red(RAMP).String())
} else {
f.WriteString(Cyan(RAMP).String())
}
Avoid deeply nested control flow statements. Open
if p.chunkProps[i].hasErrors {
f.WriteString(Red(FULL).String())
} else {
f.WriteString(Cyan(FULL).String())
}
Avoid deeply nested control flow statements. Open
} else if p.isTimerPhase(Drained) {
connMsg += drained
}
Method P0d.Race
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (p *P0d) Race() {
osStatsDone := make(chan struct{}, 2)
p.initOSStats(osStatsDone)
p.detectRemoteConnSettings()
p.initLog()
- 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
Avoid deeply nested control flow statements. Open
} else if rr.TLS.Version == tls.VersionTLS11 {
p.ReqStats.Sample.TLSVersion = "TLS1.1"
} else if rr.TLS.Version == tls.VersionTLS12 {
p.ReqStats.Sample.TLSVersion = "TLS1.2"
} else if rr.TLS.Version == tls.VersionTLS13 {
Function NewP0d
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func NewP0d(cfg Config, ulimit int64, outputFile string, durationSecs int, interrupt chan os.Signal) *P0d {
Method P0d.initReqAtmpts
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
func (p *P0d) initReqAtmpts(done chan struct{}, ras chan ReqAtmpt) {
//don't block because execution continues on to live updates
go func() {
bd := false
- 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"