Skip to content

Commit

Permalink
🧹 More minor typo fixes (#3026)
Browse files Browse the repository at this point in the history
Some data types, a lot of comments, a few log messages

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Jan 15, 2024
1 parent 03ff3c4 commit bc32b05
Show file tree
Hide file tree
Showing 23 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion mqlc/mqlc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ func (c *compiler) addValueFieldChunks(ref uint64) {
}

// This block holds all the data and function chunks used
// for the predicate(s) of the .all()/.none()/... fucntion
// for the predicate(s) of the .all()/.none()/... function
var assessmentBlock *llx.Block
// find the referenced block for the where function
for i := len(whereChunk.Function.Args) - 1; i >= 0; i-- {
Expand Down
2 changes: 1 addition & 1 deletion mqlc/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (p *parser) flushComments() string {
return res
}

// rewind pushes the current token back on the stack and replaces it iwth the given token
// rewind pushes the current token back on the stack and replaces it with the given token
func (p *parser) rewind(token lexer.Token) {
p.nextTokens = append(p.nextTokens, p.token)
p.token = token
Expand Down
2 changes: 1 addition & 1 deletion providers-sdk/v1/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func MustLoadSchema(provider SchemaProvider) *resources.Schema {
panic("cannot load schema without provider name or path")
}
var path string
// path towards the .yaml manifest, containing metadata abou the resources
// path towards the .yaml manifest, containing metadata about the resources
var manifestPath string
if provider.Provider != "" {
switch provider.Provider {
Expand Down
2 changes: 1 addition & 1 deletion providers-sdk/v1/util/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var rootCmd = &cobra.Command{

res, err := goGen(configs)
if err != nil {
log.Fatal().Err(err).Msg("failed to generate go code for provideer defaults")
log.Fatal().Err(err).Msg("failed to generate go code for provider defaults")
}

if err = os.WriteFile(outPath, res, 0o644); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions providers/aws/connection/awsec2ebsconn/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func CreateSnapshotFromVolume(ctx context.Context, cfg aws.Config, volID string,
time.Sleep(30 * time.Second) // if it says it doesn't exist, even though we just created it, then it must still be busy creating
notFoundTimeout++
if notFoundTimeout > 10 {
return nil, errors.New("timed out wating for created snapshot to complete; snapshot not found")
return nil, errors.New("timed out waiting for created snapshot to complete; snapshot not found")
}
continue
}
Expand All @@ -273,7 +273,7 @@ func CreateSnapshotFromVolume(ctx context.Context, cfg aws.Config, volID string,
snapProgress = *snaps.Snapshots[0].Progress
snapState = snaps.Snapshots[0].State
if timeout > 24 { // 4 minutes
return nil, errors.New("timed out wating for created snapshot to complete")
return nil, errors.New("timed out waiting for created snapshot to complete")
}
}
log.Info().Str("progress", snapProgress).Msg("snapshot complete")
Expand Down
4 changes: 2 additions & 2 deletions providers/aws/resources/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ func handleTargets(targets []string) []string {
return targets
}

// for now we have to post proces the filters
// for now we have to post process the filters
// more ideally, we should pass the filters in when discovering
// so that we dont unnecesarily discover assets we will later discard
// so that we dont unnecessarily discover assets we will later discard
func discover(runtime *plugin.Runtime, awsAccount *mqlAwsAccount, target string, filters connection.DiscoveryFilters) ([]*inventory.Asset, error) {
conn := runtime.Connection.(*connection.AwsConnection)
accountId := trimAwsAccountIdToJustId(awsAccount.Id.Data)
Expand Down
2 changes: 1 addition & 1 deletion providers/github/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (s *Service) detect(asset *inventory.Asset, conn *connection.GithubConnecti

repoOpt := conn.Conf.Options["repository"]
ownerOpt := conn.Conf.Options["owner"]
// try and parse the repo only if the owner isnt explicitly set
// try and parse the repo only if the owner isn't explicitly set
if repoOpt != "" && ownerOpt == "" {
repoParts := strings.Split(repoOpt, "/")
if len(repoParts) > 1 {
Expand Down
10 changes: 5 additions & 5 deletions providers/github/resources/github_org.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ func (g *mqlGithubOrganization) webhooks() ([]interface{}, error) {
}

type mqlGithubPackageInternal struct {
pacakgeRepositry string
parentResource *mqlGithubOrganization
packageRepository string
parentResource *mqlGithubOrganization
}

func (g *mqlGithubOrganization) packages() ([]interface{}, error) {
Expand Down Expand Up @@ -401,7 +401,7 @@ func (g *mqlGithubOrganization) packages() ([]interface{}, error) {
// NOTE: we need to fetch repo separately because the Github repo object is not complete, instead of
// call the repo fetching all the time, we make this lazy loading
if p.Repository != nil && p.Repository.Name != nil {
pkg.pacakgeRepositry = convert.ToString(p.Repository.Name)
pkg.packageRepository = convert.ToString(p.Repository.Name)
}
res = append(res, pkg)
}
Expand All @@ -413,11 +413,11 @@ func (g *mqlGithubOrganization) packages() ([]interface{}, error) {
func (g *mqlGithubPackage) repository() (*mqlGithubRepository, error) {
conn := g.MqlRuntime.Connection.(*connection.GithubConnection)

if g.pacakgeRepositry == "" {
if g.packageRepository == "" {
return nil, errors.New("could not load the repository")
}

repoName := g.pacakgeRepositry
repoName := g.packageRepository

if g.Owner.Error != nil {
return nil, g.Owner.Error
Expand Down
2 changes: 1 addition & 1 deletion providers/okta/resources/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (o *mqlOktaPolicyRule) id() (string, error) {
return "okta.policyRule/" + o.Id.Data, o.Id.Error
}

// see https://github.com/okta/okta-sdk-golang/issues/286 for context. okta's sdk doesnt letch you fetch
// see https://github.com/okta/okta-sdk-golang/issues/286 for context. okta's sdk doesn't letch you fetch
// type-specific rules which differ between the different policies. as such, we fetch those manually until the sdk allows us to
func fetchAccessPolicyRules(ctx context.Context, policyid, host, token string) ([]okta.AccessPolicyRule, error) {
urlPath := fmt.Sprintf("https://%s/api/v1/policies/%s/rules?limit=50", host, policyid)
Expand Down
2 changes: 1 addition & 1 deletion providers/okta/resources/sdk/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (a *PolicyWrapper) UnmarshalJSON(data []byte) error {
return err
}

// Since the original okta policy does not support settings, we need to handle that outselves
// Since the original okta policy does not support settings, we need to handle that ourselves
settings := struct {
Settings PolicySettings `json:"settings,omitempty"`
}{}
Expand Down
2 changes: 1 addition & 1 deletion providers/os/connection/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func readSSHConfig(cc *inventory.Config) *inventory.Config {
entry, err := cfg.Get(host, "IdentityFile")

// TODO: the ssh_config uses os/home but instead should be use go-homedir, could become a compile issue
// TODO: the problem is that the lib returns defaults and we cannot properly distingush
// TODO: the problem is that the lib returns defaults and we cannot properly distinguish
if err == nil && ssh_config.Default("IdentityFile") != entry {
// commonly ssh config included paths like ~
expandedPath, err := homedir.Expand(entry)
Expand Down
2 changes: 1 addition & 1 deletion providers/os/detector/detector_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var macOS = &PlatformResolver{
},
}

// is part of the darwin platfrom and fallback for non-known darwin systems
// is part of the darwin platform and fallback for non-known darwin systems
var otherDarwin = &PlatformResolver{
Name: "darwin",
IsFamily: false,
Expand Down
2 changes: 1 addition & 1 deletion providers/os/detector/platform_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *PlatformResolver) resolvePlatform(pf *inventory.Platform, conn shared.C
for _, c := range r.Children {
detected, resolved := c.resolvePlatform(pf, conn)
if resolved {
// add family hieracy
// add family hierarchy
detected.Family = append(pf.Family, r.Name)
return detected, resolved
}
Expand Down
2 changes: 1 addition & 1 deletion providers/os/resources/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func createConfiguration(kubeletFlags map[string]interface{}, configFileContent
return nil, fmt.Errorf("error when converting KubeletConfig into dict: %v", err)
}

// JSON marhsalling of KubeletConfiguration does not include fields with zero/null values
// JSON marshalling of KubeletConfiguration does not include fields with zero/null values
// But "0" is an important value for the kubelet, so we need to add it manually
if kubeletConfig.ReadOnlyPort == 0 {
options["readOnlyPort"] = 0.0
Expand Down
2 changes: 1 addition & 1 deletion providers/os/resources/kubelet_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func mergeFlagsIntoConfig(kubeletConfig map[string]interface{}, flags map[string

// mergeDeprecatedFlagsIntoConfig merges deprecated cli flags into the kubelet config
// It only takes care of deprecated flags.
// This is a seperate function in hope we can get rid of it in the future
// This is a separate function in hope we can get rid of it in the future
// The list of flags is taken from
// https://github.com/kubernetes/kubernetes/blob/release-1.25/cmd/kubelet/app/options/options.go
func mergeDeprecatedFlagsIntoConfig(kubeletConfig map[string]interface{}, flags map[string]interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion providers/os/resources/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestResource_K8sKubeletAKS(t *testing.T) {
}

func TestResource_K8sKubeletEKS(t *testing.T) {
// EKS is differetn becasue it uses a JSON config file
// EKS is different because it uses a JSON config file
// and set's the read-only-port to 0
x := testutils.InitTester(testutils.KubeletEKSMock())

Expand Down
4 changes: 2 additions & 2 deletions providers/os/resources/packages/windows_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func ParseWindowsAppPackages(input io.Reader) ([]Package, error) {
return []Package{}, nil
}

type pwershellUninstallEntry struct {
type plwershellUninstallEntry struct {
DisplayName string `json:"DisplayName"`
DisplayVersion string `json:"DisplayVersion"`
Publisher string `json:"Publisher"`
Expand All @@ -268,7 +268,7 @@ func ParseWindowsAppPackages(input io.Reader) ([]Package, error) {
UninstallString string `json:"UninstallString"`
}

var entries []pwershellUninstallEntry
var entries []plwershellUninstallEntry
err = json.Unmarshal(data, &entries)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions providers/os/resources/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func pythonPackageDetailsWithDependenciesToResource(
}
res, err := pythonPackageDetailsWithDependenciesToResource(runtime, depPyPkgDetails, pythonPgkDetailsList, pythonPackageResourceMap)
if err != nil {
log.Warn().Err(err).Msg("failed to create python packag resource")
log.Warn().Err(err).Msg("failed to create python package resource")
continue
}
dependencies = append(dependencies, res)
Expand Down Expand Up @@ -219,7 +219,7 @@ func gatherPackages(afs *afero.Afero, pythonPackagePath string) (allResults []py
return
}
for _, dEntry := range fileList {
// only process files/directories that might acctually contain
// only process files/directories that might actually contain
// the data we're looking for
if !strings.HasSuffix(dEntry.Name(), ".dist-info") &&
!strings.HasSuffix(dEntry.Name(), ".egg-info") {
Expand Down
2 changes: 1 addition & 1 deletion providers/os/resources/python/mime.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func ParseMIME(r io.Reader, pythonMIMEFilepath string) (*PackageDetails, error)
}

func newPythonPackageUrl(name string, version string, homepage string) string {
// ensure the name is accoring to the PURL spec
// ensure the name is according to the PURL spec
// see https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#pypi
name = strings.ReplaceAll(name, "_", "-")

Expand Down
6 changes: 3 additions & 3 deletions providers/os/resources/python/requirestxt.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func ParseRequiresTxtDependencies(r io.Reader) ([]string, error) {
fileScanner := bufio.NewScanner(r)
fileScanner.Split(bufio.ScanLines)

depdendencies := []string{}
dependencies := []string{}
for fileScanner.Scan() {
line := fileScanner.Text()
if strings.HasPrefix(line, "[") {
Expand All @@ -43,8 +43,8 @@ func ParseRequiresTxtDependencies(r io.Reader) ([]string, error) {
if matched == "" {
continue
}
depdendencies = append(depdendencies, matched)
dependencies = append(dependencies, matched)
}

return depdendencies, nil
return dependencies, nil
}
4 changes: 2 additions & 2 deletions providers/os/resources/windows/security_products.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ConvertTo-Json -Depth 3 -Compress $securityProducts
`

// powershellBitlockerVolumeStatus is the struct to parse the powershell result
type powershelSecurityProducts struct {
type powershellSecurityProducts struct {
Firewall []powershellSecurityProduct
AntiVirus []powershellSecurityProduct
AntiSpyware []powershellSecurityProduct
Expand Down Expand Up @@ -161,7 +161,7 @@ func GetSecurityProducts(p shared.Connection) ([]securityProduct, error) {
}

func ParseWindowsSecurityProducts(r io.Reader) ([]securityProduct, error) {
var psSecProducts powershelSecurityProducts
var psSecProducts powershellSecurityProducts
data, err := io.ReadAll(r)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/recording.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (n *readOnlyRecording) Save() error {

func (n *readOnlyRecording) EnsureAsset(asset *inventory.Asset, provider string, connectionID uint32, conf *inventory.Config) {
// For read-only recordings we are still loading from file, so that means
// we are severly lacking connection IDs.
// we are severely lacking connection IDs.
found, _ := n.findAssetConnID(asset, conf)
if found != -1 {
n.assets[connectionID] = &n.Assets[found]
Expand Down
2 changes: 1 addition & 1 deletion providers/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (r *Runtime) watchAndUpdate(resource string, resourceID string, field strin
Field: field,
})
if err != nil {
// Recoverable errors can continue with the exeuction,
// Recoverable errors can continue with the execution,
// they only store errors in the place of actual data.
// Every other error is thrown up the chain.
handled, err := r.handlePluginError(err, provider)
Expand Down

0 comments on commit bc32b05

Please sign in to comment.