Skip to content

Commit

Permalink
Fix a few minor types in variables/log messages (#3024)
Browse files Browse the repository at this point in the history
Minor spelling cleanup

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Jan 14, 2024
1 parent 3e502d0 commit 3c1bfad
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion providers/aws/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba

func (s *Service) detect(asset *inventory.Asset, conn plugin.Connection) error {
if len(asset.Connections) > 0 && asset.Connections[0].Type == "ssh" {
// workaround to make sure we dont assign the aws platform to ec2 instances
// workaround to make sure we don't assign the aws platform to ec2 instances
return nil
}
if c, ok := conn.(*connection.AwsConnection); ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestParseTarget(t *testing.T) {
assert.Equal(t, target, scanTarget.Target)
assert.Equal(t, DiskTargetType, scanTarget.TargetType)
})
t.Run("parse snapshot target with a fully qualifed Azure resource id", func(t *testing.T) {
t.Run("parse snapshot target with a fully qualified Azure resource ID", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: instanceInfo{
resourceGroup: "my-rg",
Expand All @@ -95,7 +95,7 @@ func TestParseTarget(t *testing.T) {
assert.Equal(t, "test-snp", scanTarget.Target)
assert.Equal(t, SnapshotTargetType, scanTarget.TargetType)
})
t.Run("parse instance target with a fully qualifed Azure resource id", func(t *testing.T) {
t.Run("parse instance target with a fully qualified Azure resource ID", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: instanceInfo{
resourceGroup: "my-rg",
Expand All @@ -116,7 +116,7 @@ func TestParseTarget(t *testing.T) {
assert.Equal(t, "debian", scanTarget.Target)
assert.Equal(t, InstanceTargetType, scanTarget.TargetType)
})
t.Run("parse disk target with a fully qualifed Azure resource id", func(t *testing.T) {
t.Run("parse disk target with a fully qualified Azure resource ID", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: instanceInfo{
resourceGroup: "my-rg",
Expand Down
4 changes: 2 additions & 2 deletions providers/azure/connection/azureinstancesnapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (sc *snapshotCreator) createDisk(disk compute.Disk, resourceGroupName, disk
}

// createSnapshotDisk creates a new disk from a snapshot
func (sc *snapshotCreator) createSnapshotDisk(sourceSnaphotId, resourceGroupName, diskName, location string, zones []*string) (compute.Disk, error) {
func (sc *snapshotCreator) createSnapshotDisk(sourceSnapshotId, resourceGroupName, diskName, location string, zones []*string) (compute.Disk, error) {
// create a new disk from snapshot
createOpt := compute.DiskCreateOptionCopy
disk := compute.Disk{
Expand All @@ -177,7 +177,7 @@ func (sc *snapshotCreator) createSnapshotDisk(sourceSnaphotId, resourceGroupName
Name: &diskName,
Properties: &compute.DiskProperties{
CreationData: &compute.CreationData{
SourceResourceID: &sourceSnaphotId,
SourceResourceID: &sourceSnapshotId,
CreateOption: &createOpt,
},
},
Expand Down
2 changes: 1 addition & 1 deletion providers/azure/resources/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (a *mqlAzureSubscriptionComputeService) vms() ([]interface{}, error) {

func (a *mqlAzureSubscriptionComputeServiceVm) extensions() ([]interface{}, error) {
conn := a.MqlRuntime.Connection.(*connection.AzureConnection)
// id is a azure resource id
// id is a Azure resource ID
id := a.Id.Data
resourceID, err := ParseResourceID(id)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion providers/azure/resources/resourceid.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func ParseResourceID(id string) (*ResourceID, error) {
// sanitize resource id
idURL, err := url.ParseRequestURI(id)
if err != nil {
return nil, fmt.Errorf("cannot parse azure resource id: %s", err)
return nil, fmt.Errorf("cannot parse Azure resource ID: %s", err)
}
path := idURL.Path
path = strings.TrimPrefix(path, "/")
Expand Down
2 changes: 1 addition & 1 deletion providers/gcp/connection/gcpinstancesnapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (sc *SnapshotCreator) cloneDisk(sourceDisk, projectID, zone, diskName strin
return sc.createDisk(disk, projectID, zone, diskName)
}

// attachDisk attaches a disk to an instanc
// attachDisk attaches a disk to an instance
func (sc *SnapshotCreator) attachDisk(projectID, zone, instanceName, sourceDiskUrl, deviceName string) error {
ctx := context.Background()

Expand Down
12 changes: 6 additions & 6 deletions providers/os/resources/vulnmgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (v *mqlVulnmgmt) populateData() error {
mqlVulAdvisories := make([]interface{}, len(vulnReport.Advisories))
for i, a := range vulnReport.Advisories {
var parsedPublished *time.Time
var parsedModifed *time.Time
var parsedModified *time.Time
var err error
published, err := time.Parse(time.RFC3339, a.PublishedAt)
if err != nil {
Expand All @@ -115,7 +115,7 @@ func (v *mqlVulnmgmt) populateData() error {
if err != nil {
log.Debug().Str("date", a.ModifiedAt).Str("advisory", a.Id).Msg("could not parse modified date")
} else {
parsedModifed = &modified
parsedModified = &modified
}
cvssScore, err := CreateResource(v.MqlRuntime, "audit.cvss", map[string]*llx.RawData{
"score": llx.FloatData(float64(a.CvssScore.Value) / 10),
Expand All @@ -129,7 +129,7 @@ func (v *mqlVulnmgmt) populateData() error {
"title": llx.StringData(a.Title),
"description": llx.StringData(a.Description),
"published": llx.TimeDataPtr(parsedPublished),
"modified": llx.TimeDataPtr(parsedModifed),
"modified": llx.TimeDataPtr(parsedModified),
"worstScore": llx.ResourceData(cvssScore, "audit.cvss"),
})
if err != nil {
Expand All @@ -141,7 +141,7 @@ func (v *mqlVulnmgmt) populateData() error {
mqlVulnCves := make([]interface{}, len(vulnReport.Cves))
for i, c := range vulnReport.Cves {
var parsedPublished *time.Time
var parsedModifed *time.Time
var parsedModified *time.Time
var err error
published, err := time.Parse(time.RFC3339, c.PublishedAt)
if err != nil {
Expand All @@ -153,7 +153,7 @@ func (v *mqlVulnmgmt) populateData() error {
if err != nil {
log.Debug().Str("date", c.ModifiedAt).Str("cve", c.Id).Msg("could not parse modified date")
} else {
parsedModifed = &modified
parsedModified = &modified
}
cvssScore, err := CreateResource(v.MqlRuntime, "audit.cvss", map[string]*llx.RawData{
"score": llx.FloatData(float64(c.CvssScore.Value) / 10),
Expand All @@ -166,7 +166,7 @@ func (v *mqlVulnmgmt) populateData() error {
"id": llx.StringData(c.Id),
"worstScore": llx.ResourceData(cvssScore, "audit.cvss"),
"published": llx.TimeDataPtr(parsedPublished),
"modified": llx.TimeDataPtr(parsedModifed),
"modified": llx.TimeDataPtr(parsedModified),
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion providers/terraform/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error)
}

// TODO: somewhere here, parse the args for the previous sub-commands
// perhaps set the conn.Type here dependeing on the args (like in the os provider)
// perhaps set the conn.Type here depending on the args (like in the os provider)
// and later on decide which thing to call based on the conn.Type
// below in this file we already have something similar:
// tc.Options["asset-type"] == "state"
Expand Down
8 changes: 4 additions & 4 deletions providers/vsphere/resources/vulnmgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (v *mqlVulnmgmt) populateData() error {
if err != nil {
return err
}
parsedModifed, err := time.Parse(time.RFC3339, a.ModifiedAt)
parsedModified, err := time.Parse(time.RFC3339, a.ModifiedAt)
if err != nil {
return err
}
Expand All @@ -110,7 +110,7 @@ func (v *mqlVulnmgmt) populateData() error {
"title": llx.StringData(a.Title),
"description": llx.StringData(a.Description),
"published": llx.TimeData(parsedPublished),
"modified": llx.TimeData(parsedModifed),
"modified": llx.TimeData(parsedModified),
"worstScore": llx.ResourceData(cvssScore, "audit.cvss"),
})
if err != nil {
Expand All @@ -125,7 +125,7 @@ func (v *mqlVulnmgmt) populateData() error {
if err != nil {
return err
}
parsedModifed, err := time.Parse(time.RFC3339, c.ModifiedAt)
parsedModified, err := time.Parse(time.RFC3339, c.ModifiedAt)
if err != nil {
return err
}
Expand All @@ -140,7 +140,7 @@ func (v *mqlVulnmgmt) populateData() error {
"id": llx.StringData(c.Id),
"worstScore": llx.ResourceData(cvssScore, "audit.cvss"),
"published": llx.TimeData(parsedPublished),
"modified": llx.TimeData(parsedModifed),
"modified": llx.TimeData(parsedModified),
})
if err != nil {
return err
Expand Down

0 comments on commit 3c1bfad

Please sign in to comment.