Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDX-4721 Remove unused variables and function to fix lint #251

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions clients/http/utils/central.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ import (
"github.com/edgexfoundry/go-mod-core-contracts/v3/errors"
)

// edgeXClientReqURI returns the non-encoded path?query that would be used in an HTTP request for u.
func edgeXClientReqURI(u *url.URL) string {
result := u.Scheme + "://" + u.Host + u.Path
if u.ForceQuery || u.RawQuery != "" {
result += "?" + u.RawQuery
}
return result
}

// CentralGetRequest makes the get request and return the body
func CentralGetRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, requestPath string, requestParams url.Values, authInjector interfaces.AuthenticationInjector) errors.EdgeX {
req, edgexErr := createRequest(ctx, http.MethodGet, baseUrl, requestPath, requestParams)
Expand Down
4 changes: 2 additions & 2 deletions common/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ const (
name = "Name"

// Central
reservedCharsRegexString = "^[^/#+$]+$"
reservedCharsRegexString = "^[^/#+$]+$"
)

var (
rFC3986UnreservedCharsRegex = regexp.MustCompile(rFC3986UnreservedCharsRegexString)

// Central
reservedCharsRegex = regexp.MustCompile(reservedCharsRegexString)
reservedCharsRegex = regexp.MustCompile(reservedCharsRegexString)
)

func init() {
Expand Down
8 changes: 4 additions & 4 deletions dtos/deviceprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type DeviceProfile struct {
DeviceCommands []DeviceCommand `json:"deviceCommands" yaml:"deviceCommands" validate:"dive"`

// Central
ApiVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
ApiVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
}

// Validate satisfies the Validator interface
Expand All @@ -46,7 +46,7 @@ func (dp *DeviceProfile) UnmarshalYAML(unmarshal func(interface{}) error) error
DeviceCommands []DeviceCommand `yaml:"deviceCommands"`

// Central
ApiVersion string `yaml:"apiVersion"`
ApiVersion string `yaml:"apiVersion"`
}
if err := unmarshal(&alias); err != nil {
return edgexErrors.NewCommonEdgeX(edgexErrors.KindContractInvalid, "failed to unmarshal request body as YAML.", err)
Expand Down Expand Up @@ -82,7 +82,7 @@ func ToDeviceProfileModel(deviceProfileDTO DeviceProfile) models.DeviceProfile {
DeviceCommands: ToDeviceCommandModels(deviceProfileDTO.DeviceCommands),

// Central
ApiVersion: deviceProfileDTO.ApiVersion,
ApiVersion: deviceProfileDTO.ApiVersion,
}
}

Expand All @@ -105,7 +105,7 @@ func FromDeviceProfileModelToDTO(deviceProfile models.DeviceProfile) DeviceProfi
DeviceCommands: FromDeviceCommandModelsToDTOs(deviceProfile.DeviceCommands),

// Central
ApiVersion: deviceProfile.ApiVersion,
ApiVersion: deviceProfile.ApiVersion,
}
}

Expand Down
4 changes: 2 additions & 2 deletions dtos/deviceservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type DeviceService struct {
AdminState string `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"`

// Central
TransformScript string `json:"transformScript,omitempty"`
TransformScript string `json:"transformScript,omitempty"`
}

type UpdateDeviceService struct {
Expand All @@ -31,7 +31,7 @@ type UpdateDeviceService struct {
AdminState *string `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"`

// Central
TransformScript *string `json:"transformScript"`
TransformScript *string `json:"transformScript"`
}

// ToDeviceServiceModel transforms the DeviceService DTO to the DeviceService Model
Expand Down
1 change: 0 additions & 1 deletion dtos/reading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ func TestUnmarshalObjectValueError(t *testing.T) {

// Central


func TestNewObjectArrayReading(t *testing.T) {
expectedDeviceName := TestDeviceName
expectedProfileName := TestDeviceProfileName
Expand Down
4 changes: 0 additions & 4 deletions dtos/requests/provisionwatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ var testIdentifiers = map[string]string{
var testBlockingIdentifiers = map[string][]string{
"port": {"397", "398", "399"},
}
var testDeviceDescription = "test device description"
var testDeviceNamePattern = "device-name-{{Address}}-{{Port}}"
var testProfileNamePattern = "profile-name-{{Address}}-{{Port}}"
var testProfileDescription = "test profile description"
var testAddProvisionWatcher = AddProvisionWatcherRequest{
BaseRequest: common.BaseRequest{
RequestId: ExampleUUID,
Expand Down
2 changes: 1 addition & 1 deletion models/deviceresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ type DeviceResource struct {
Tags map[string]any

// Central
Tag string
Tag string
}
2 changes: 1 addition & 1 deletion xrtmodels/deviceInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ToEdgeXV2Device(device DeviceInfo, serviceName string) v2models.Device {

// ToEdgeXV3Device converts the XRT model to EdgeX v3 model
func ToEdgeXV3Device(device DeviceInfo, serviceName string) models.Device {
for protocol, _ := range device.Protocols {
for protocol := range device.Protocols {
device.Properties[common.ProtocolName] = strings.ToLower(protocol)
}
return models.Device{
Expand Down