lflux/eve-sdeloader

View on GitHub
universe/planet.go

Summary

Maintainability
C
7 hrs
Test Coverage

Method Planet.ImportMoons has 81 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *Planet) ImportMoons() error {
    var moons = make(Moons, 0, len(p.Moons))
    var err error
    for moonID, moon := range p.Moons {
        moon.moonID = moonID
Severity: Major
Found in universe/planet.go - About 2 hrs to fix

    Method SolarSystem.ImportPlanet has 78 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s *SolarSystem) ImportPlanet(planetID int64, planet Planet) error {
        var err error
        planet.name, err = getItemNameByID(planetID)
        if err != nil {
            return errors.Wrap(err, fmt.Sprintf("Error fetching planet name for planet %d, solar system %s",
    Severity: Major
    Found in universe/planet.go - About 2 hrs to fix

      Method SolarSystem.ImportPlanet has 10 return statements (exceeds 4 allowed).
      Open

      func (s *SolarSystem) ImportPlanet(planetID int64, planet Planet) error {
          var err error
          planet.name, err = getItemNameByID(planetID)
          if err != nil {
              return errors.Wrap(err, fmt.Sprintf("Error fetching planet name for planet %d, solar system %s",
      Severity: Major
      Found in universe/planet.go - About 1 hr to fix

        Method Planet.ImportMoons has 8 return statements (exceeds 4 allowed).
        Open

        func (p *Planet) ImportMoons() error {
            var moons = make(Moons, 0, len(p.Moons))
            var err error
            for moonID, moon := range p.Moons {
                moon.moonID = moonID
        Severity: Major
        Found in universe/planet.go - About 50 mins to fix

          Method Planet.ImportBelts has 5 return statements (exceeds 4 allowed).
          Open

          func (p *Planet) ImportBelts() error {
              var err error
              var belts = make(AsteroidBelts, 0, len(p.AsteroidBelts))
              for beltID, belt := range p.AsteroidBelts {
                  belt.planet = p
          Severity: Major
          Found in universe/planet.go - About 35 mins to fix

            Method Planet.ImportMoons has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
            Open

            func (p *Planet) ImportMoons() error {
                var moons = make(Moons, 0, len(p.Moons))
                var err error
                for moonID, moon := range p.Moons {
                    moon.moonID = moonID
            Severity: Minor
            Found in universe/planet.go - About 25 mins 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

            XXX found
            Open

                        index+1, // XXX need to fix orbit index
            Severity: Minor
            Found in universe/planet.go by fixme

            exported method SolarSystem.ImportPlanet should have comment or be unexported
            Open

            func (s *SolarSystem) ImportPlanet(planetID int64, planet Planet) error {
            Severity: Minor
            Found in universe/planet.go by golint

            exported method Planet.ImportBelts should have comment or be unexported
            Open

            func (p *Planet) ImportBelts() error {
            Severity: Minor
            Found in universe/planet.go by golint

            exported type AsteroidBelt should have comment or be unexported
            Open

            type AsteroidBelt struct {
            Severity: Minor
            Found in universe/planet.go by golint

            exported type Planet should have comment or be unexported
            Open

            type Planet struct {
            Severity: Minor
            Found in universe/planet.go by golint

            exported type AsteroidBelts should have comment or be unexported
            Open

            type AsteroidBelts []AsteroidBelt
            Severity: Minor
            Found in universe/planet.go by golint

            exported method Planet.ImportMoons should have comment or be unexported
            Open

            func (p *Planet) ImportMoons() error {
            Severity: Minor
            Found in universe/planet.go by golint

            exported method SolarSystem.ImportPlanets should have comment or be unexported
            Open

            func (s *SolarSystem) ImportPlanets() error {
            Severity: Minor
            Found in universe/planet.go by golint

            There are no issues that match your filters.

            Category
            Status