portainer/portainer

View on GitHub
api/hostmanagement/openamt/openamt.go

Summary

Maintainability
A
3 hrs
Test Coverage

Method Service.DeviceInformation has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (service *Service) DeviceInformation(configuration portainer.OpenAMTConfiguration, deviceGUID string) (*portainer.OpenAMTDeviceInformation, error) {
    token, err := service.Authorization(configuration)
    if err != nil {
        return nil, err
    }
Severity: Minor
Found in api/hostmanagement/openamt/openamt.go - About 1 hr to fix

    Method Service.DeviceInformation has 10 return statements (exceeds 4 allowed).
    Open

    func (service *Service) DeviceInformation(configuration portainer.OpenAMTConfiguration, deviceGUID string) (*portainer.OpenAMTDeviceInformation, error) {
        token, err := service.Authorization(configuration)
        if err != nil {
            return nil, err
        }
    Severity: Major
    Found in api/hostmanagement/openamt/openamt.go - About 1 hr to fix

      Method Service.executeGetRequest has 7 return statements (exceeds 4 allowed).
      Open

      func (service *Service) executeGetRequest(url string, token string) ([]byte, error) {
          req, err := http.NewRequest(http.MethodGet, url, nil)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in api/hostmanagement/openamt/openamt.go - About 45 mins to fix

        Method Service.executeSaveRequest has 6 return statements (exceeds 4 allowed).
        Open

        func (service *Service) executeSaveRequest(method string, url string, token string, payload []byte) ([]byte, error) {
            req, err := http.NewRequest(method, url, bytes.NewBuffer(payload))
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in api/hostmanagement/openamt/openamt.go - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status