Showing 59 of 92 total issues
Method parser.Init
has a Cognitive Complexity of 2639 (exceeds 20 allowed). Consider refactoring. Open
func (p *parser) Init(options ...func(*parser) error) error {
var (
max token32
position, tokenIndex uint32
buffer []rune
- 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 parser.Init
has 2833 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) Init(options ...func(*parser) error) error {
var (
max token32
position, tokenIndex uint32
buffer []rune
File grammar.peg.go
has 3337 lines of code (exceeds 500 allowed). Consider refactoring. Open
package parser
// Code generated by peg -inline -switch grammar.peg DO NOT EDIT
import (
File lambda.go
has 793 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Package lambda implements the API Gateway & AWS Lambda platform.
package lambda
import (
"bytes"
Method reporter.Start
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
func (r *reporter) Start() {
tick := time.NewTicker(150 * time.Millisecond)
defer tick.Stop()
render := term.Renderer()
- 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 reporter.Start
has 156 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *reporter) Start() {
tick := time.NewTicker(150 * time.Millisecond)
defer tick.Stop()
render := term.Renderer()
Platform
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
type Platform struct {
config *up.Config
handler string
zip *bytes.Buffer
events event.Events
Method parser.Init
has 46 return statements (exceeds 4 allowed). Open
func (p *parser) Init(options ...func(*parser) error) error {
var (
max token32
position, tokenIndex uint32
buffer []rune
File team.go
has 561 lines of code (exceeds 500 allowed). Consider refactoring. Open
package team
import (
"context"
"encoding/base64"
Function subscribe
has 83 lines of code (exceeds 50 allowed). Consider refactoring. Open
func subscribe(cmd *kingpin.Cmd) {
c := cmd.Command("subscribe", "Subscribe to the Pro plan.")
c.Action(func(_ *kingpin.ParseContext) error {
t, err := userconfig.Require()
Function login
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
func login(cmd *kingpin.Cmd) {
c := cmd.Command("login", "Sign in to your account.")
c.Example(`up team login`, "Sign in or create account with interactive prompt.")
c.Example(`up team login --team apex-software`, "Sign in to a team using your existing email.")
c.Example(`up team login --email tj@example.com --team apex-software`, "Sign in to a team with email.")
Function init
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
cmd := root.Command("upgrade", "Install the latest or specified version of Up.")
cmd.Example(`up upgrade`, "Upgrade to the latest version available.")
cmd.Example(`up upgrade -t 0.4.4`, "Upgrade to the specified version.")
target := cmd.Flag("target", "Target version for upgrade.").Short('t').String()
Method Stack.Plan
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *Stack) Plan(versions resources.Versions) error {
c := s.config
tmpl := s.template(versions)
name := c.Name
Method parser.Execute
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) Execute() {
buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0
for _, token := range p.Tokens() {
switch token.pegRule {
Function login
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func login(cmd *kingpin.Cmd) {
c := cmd.Command("login", "Sign in to your account.")
c.Example(`up team login`, "Sign in or create account with interactive prompt.")
c.Example(`up team login --team apex-software`, "Sign in to a team using your existing email.")
c.Example(`up team login --email tj@example.com --team apex-software`, "Sign in to a team with email.")
- 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 deploy
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func deploy(stage string, build bool) error {
retry:
c, p, err := root.Init()
// missing up.json non-interactive
Method Platform.updateFunction
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *Platform) updateFunction(c *lambda.Lambda, a *apigateway.APIGateway, up *s3manager.Uploader, region string, d up.Deploy) (version string, err error) {
b := aws.String(p.getS3BucketName(region))
k := aws.String(p.getS3Key(d.Stage))
// upload
Function subscribe
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func subscribe(cmd *kingpin.Cmd) {
c := cmd.Command("subscribe", "Subscribe to the Pro plan.")
c.Action(func(_ *kingpin.ParseContext) error {
t, err := userconfig.Require()
- 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 init
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
cmd := root.Command("build", "Build zip file.")
cmd.Example(`up build`, "Build archive and save to ./out.zip")
cmd.Example(`up build > /tmp/out.zip`, "Build archive and output to file via stdout.")
cmd.Example(`up build --size`, "Build archive and list files by size.")
Function init
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
cmd := root.Command("logs", "Show log output.")
cmd.Example(`up logs`, "Show logs from the past hour.")
cmd.Example(`up logs -S 30m`, "Show logs from the past 30 minutes.")
cmd.Example(`up logs -S 5h`, "Show logs from the past 5 hours.")