AutoSpotting/AutoSpotting

View on GitHub
core/main.go

Summary

Maintainability
A
3 hrs
Test Coverage

Method AutoSpotting.handleNewOnDemandInstanceLaunch has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (a *AutoSpotting) handleNewOnDemandInstanceLaunch(r *region, i *instance) error {
    var spotInstanceID *string
    var err error

    if !i.shouldBeReplacedWithSpot() {
Severity: Minor
Found in core/main.go - About 1 hr to fix

    Method AutoSpotting.handleLifecycleHookEvent has 9 return statements (exceeds 4 allowed).
    Open

    func (a *AutoSpotting) handleLifecycleHookEvent(event events.CloudWatchEvent) error {
        var ctEvent CloudTrailEvent
    
        // Try to parse the event.Detail as Cloudwatch Event Rule
        if err := json.Unmarshal(event.Detail, &ctEvent); err != nil {
    Severity: Major
    Found in core/main.go - About 55 mins to fix

      Method AutoSpotting.handleNewOnDemandInstanceLaunch has 8 return statements (exceeds 4 allowed).
      Open

      func (a *AutoSpotting) handleNewOnDemandInstanceLaunch(r *region, i *instance) error {
          var spotInstanceID *string
          var err error
      
          if !i.shouldBeReplacedWithSpot() {
      Severity: Major
      Found in core/main.go - About 50 mins to fix

        Method AutoSpotting.handleNewInstanceLaunch has 7 return statements (exceeds 4 allowed).
        Open

        func (a *AutoSpotting) handleNewInstanceLaunch(regionName string, instanceID string, state string) error {
            r := &region{name: regionName, conf: a.config, services: connections{}}
        
            if !r.enabled() {
                return fmt.Errorf("region %s is not enabled", regionName)
        Severity: Major
        Found in core/main.go - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status