cogolabs/fleet2kubes

View on GitHub

Showing 44 of 44 total issues

Method FlagSet.Parse has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

func (f *FlagSet) Parse(arguments []string) error {
    f.parsed = true
    f.args = arguments
    f.actual = map[string]string{}
    f.env = map[string]string{}
Severity: Minor
Found in pkg/unit/mflag.go - About 1 hr to fix

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 NewCronJob has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func NewCronJob(name, schedule, concurrencyPolicy, restartPolicy,
    image string, command []string, env map[string]string, resources Resources, annotations Annotations) *CronJob {
Severity: Minor
Found in pkg/kubes/cronjob.go - About 35 mins to fix

    Function NewDeployment has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func NewDeployment(name, image string, command []string, replicas, port int, env map[string]string,
        resources Resources) *Deployment {
    Severity: Minor
    Found in pkg/kubes/deployment.go - About 35 mins to fix

      Method FlagSet.parseOne has 5 return statements (exceeds 4 allowed).
      Open

      func (f *FlagSet) parseOne() (bool, string, error) {
          if len(f.args) == 0 {
              return false, "", nil
          }
          s := f.args[0]
      Severity: Major
      Found in pkg/unit/mflag.go - About 35 mins to fix

        Method Unit.ValidateAll has 5 return statements (exceeds 4 allowed).
        Open

        func (u *Unit) ValidateAll() error {
            if err := u.ValidateKeys(); err != nil {
                return err
            }
            if err := u.ValidateExecStartPre(); err != nil {
        Severity: Major
        Found in pkg/unit/validate.go - About 35 mins to fix

          exported type ServicePort should have comment or be unexported
          Open

          type ServicePort struct {
          Severity: Minor
          Found in pkg/kubes/service.go by golint

          exported type Unit should have comment or be unexported
          Open

          type Unit struct {
          Severity: Minor
          Found in pkg/unit/unit.go by golint

          2: cannot find package "github.com/cogolabs/fleet2kubes/pkg/kubes" in any of:
          Open

              "github.com/cogolabs/fleet2kubes/pkg/kubes"
          Severity: Minor
          Found in cmd/f2k/main.go by govet

          exported function NewUnitState should have comment or be unexported
          Open

          func NewUnitState(loadState, activeState, subState, mID string) *UnitState {
          Severity: Minor
          Found in pkg/fleet-unit/unit.go by golint

          exported method FlagSet.Env should have comment or be unexported
          Open

          func (f *FlagSet) Env() map[string]string {
          Severity: Minor
          Found in pkg/unit/mflag.go by golint

          exported function NewUnitFromOptions should have comment or be unexported
          Open

          func NewUnitFromOptions(opts []*unit.UnitOption) *UnitFile {
          Severity: Minor
          Found in pkg/fleet-unit/unit.go by golint

          exported method Hash.Short should have comment or be unexported
          Open

          func (h Hash) Short() string {
          Severity: Minor
          Found in pkg/fleet-unit/unit.go by golint

          exported method UnitFile.Bytes should have comment or be unexported
          Open

          func (u *UnitFile) Bytes() []byte {
          Severity: Minor
          Found in pkg/fleet-unit/unit.go by golint

          exported method Unit.ValidateKeys should have comment or be unexported
          Open

          func (u *Unit) ValidateKeys() error {
          Severity: Minor
          Found in pkg/unit/validate.go by golint

          exported method Unit.ValidateExecStart should have comment or be unexported
          Open

          func (u *Unit) ValidateExecStart() error {
          Severity: Minor
          Found in pkg/unit/validate.go by golint

          exported method Unit.ValidateExecStartPost should have comment or be unexported
          Open

          func (u *Unit) ValidateExecStartPost() error {
          Severity: Minor
          Found in pkg/unit/validate.go by golint

          exported type Deployment should have comment or be unexported
          Open

          type Deployment struct {
          Severity: Minor
          Found in pkg/kubes/deployment.go by golint

          exported function NewDeployment should have comment or be unexported
          Open

          func NewDeployment(name, image string, command []string, replicas, port int, env map[string]string,
          Severity: Minor
          Found in pkg/kubes/deployment.go by golint

          exported function NewResources should have comment or be unexported
          Open

          func NewResources(memLimit, cpuLimit, reqMemLimit, reqCPULimit string) Resources {
          Severity: Minor
          Found in pkg/kubes/container.go by golint

          exported type FlagSet should have comment or be unexported
          Open

          type FlagSet struct {
          Severity: Minor
          Found in pkg/unit/mflag.go by golint
          Severity
          Category
          Status
          Source
          Language