From bc32b05e5d098d34b76bf7a911e4024d9be67762 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 15 Jan 2024 15:04:12 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20=20More=20minor=20typo=20fixes?= =?UTF-8?q?=20(#3026)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some data types, a lot of comments, a few log messages Signed-off-by: Tim Smith --- mqlc/mqlc.go | 2 +- mqlc/parser/parser.go | 2 +- providers-sdk/v1/testutils/testutils.go | 2 +- providers-sdk/v1/util/defaults/defaults.go | 2 +- providers/aws/connection/awsec2ebsconn/setup.go | 4 ++-- providers/aws/resources/discovery.go | 4 ++-- providers/github/provider/provider.go | 2 +- providers/github/resources/github_org.go | 10 +++++----- providers/okta/resources/policies.go | 2 +- providers/okta/resources/sdk/policies.go | 2 +- providers/os/connection/ssh.go | 2 +- providers/os/detector/detector_all.go | 2 +- providers/os/detector/platform_resolver.go | 2 +- providers/os/resources/kubelet.go | 2 +- providers/os/resources/kubelet_flags.go | 2 +- providers/os/resources/kubelet_test.go | 2 +- providers/os/resources/packages/windows_packages.go | 4 ++-- providers/os/resources/python.go | 4 ++-- providers/os/resources/python/mime.go | 2 +- providers/os/resources/python/requirestxt.go | 6 +++--- providers/os/resources/windows/security_products.go | 4 ++-- providers/recording.go | 2 +- providers/runtime.go | 2 +- 23 files changed, 34 insertions(+), 34 deletions(-) diff --git a/mqlc/mqlc.go b/mqlc/mqlc.go index c9c180f68b..b2baedaf64 100644 --- a/mqlc/mqlc.go +++ b/mqlc/mqlc.go @@ -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-- { diff --git a/mqlc/parser/parser.go b/mqlc/parser/parser.go index 6c1811a24b..5adb19dd23 100644 --- a/mqlc/parser/parser.go +++ b/mqlc/parser/parser.go @@ -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 diff --git a/providers-sdk/v1/testutils/testutils.go b/providers-sdk/v1/testutils/testutils.go index f9cd82109d..2c36baba2d 100644 --- a/providers-sdk/v1/testutils/testutils.go +++ b/providers-sdk/v1/testutils/testutils.go @@ -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 { diff --git a/providers-sdk/v1/util/defaults/defaults.go b/providers-sdk/v1/util/defaults/defaults.go index 7a3e707a2a..f99b827dac 100644 --- a/providers-sdk/v1/util/defaults/defaults.go +++ b/providers-sdk/v1/util/defaults/defaults.go @@ -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 { diff --git a/providers/aws/connection/awsec2ebsconn/setup.go b/providers/aws/connection/awsec2ebsconn/setup.go index 4d98014388..a6d80ea168 100644 --- a/providers/aws/connection/awsec2ebsconn/setup.go +++ b/providers/aws/connection/awsec2ebsconn/setup.go @@ -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 } @@ -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") diff --git a/providers/aws/resources/discovery.go b/providers/aws/resources/discovery.go index 492879653c..6778021af2 100644 --- a/providers/aws/resources/discovery.go +++ b/providers/aws/resources/discovery.go @@ -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) diff --git a/providers/github/provider/provider.go b/providers/github/provider/provider.go index ece6fa3bb7..19511ff90a 100644 --- a/providers/github/provider/provider.go +++ b/providers/github/provider/provider.go @@ -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 { diff --git a/providers/github/resources/github_org.go b/providers/github/resources/github_org.go index 137867a06f..4ac8279c8f 100644 --- a/providers/github/resources/github_org.go +++ b/providers/github/resources/github_org.go @@ -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) { @@ -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) } @@ -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 diff --git a/providers/okta/resources/policies.go b/providers/okta/resources/policies.go index 71216725b9..f3354872f6 100644 --- a/providers/okta/resources/policies.go +++ b/providers/okta/resources/policies.go @@ -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) diff --git a/providers/okta/resources/sdk/policies.go b/providers/okta/resources/sdk/policies.go index 56f8e644b3..051b89caf1 100644 --- a/providers/okta/resources/sdk/policies.go +++ b/providers/okta/resources/sdk/policies.go @@ -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"` }{} diff --git a/providers/os/connection/ssh.go b/providers/os/connection/ssh.go index 82b0d5258c..dd47a457d8 100644 --- a/providers/os/connection/ssh.go +++ b/providers/os/connection/ssh.go @@ -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) diff --git a/providers/os/detector/detector_all.go b/providers/os/detector/detector_all.go index 9a2e02e6ef..f75398c0c2 100644 --- a/providers/os/detector/detector_all.go +++ b/providers/os/detector/detector_all.go @@ -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, diff --git a/providers/os/detector/platform_resolver.go b/providers/os/detector/platform_resolver.go index 1193fd4c36..8ff1d0be01 100644 --- a/providers/os/detector/platform_resolver.go +++ b/providers/os/detector/platform_resolver.go @@ -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 } diff --git a/providers/os/resources/kubelet.go b/providers/os/resources/kubelet.go index c7e961e207..5106732259 100644 --- a/providers/os/resources/kubelet.go +++ b/providers/os/resources/kubelet.go @@ -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 diff --git a/providers/os/resources/kubelet_flags.go b/providers/os/resources/kubelet_flags.go index 47261551c3..94d0227e5d 100644 --- a/providers/os/resources/kubelet_flags.go +++ b/providers/os/resources/kubelet_flags.go @@ -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 { diff --git a/providers/os/resources/kubelet_test.go b/providers/os/resources/kubelet_test.go index 9493a71b3a..8cca345130 100644 --- a/providers/os/resources/kubelet_test.go +++ b/providers/os/resources/kubelet_test.go @@ -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()) diff --git a/providers/os/resources/packages/windows_packages.go b/providers/os/resources/packages/windows_packages.go index 974e85c0d6..8df5306b9c 100644 --- a/providers/os/resources/packages/windows_packages.go +++ b/providers/os/resources/packages/windows_packages.go @@ -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"` @@ -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 diff --git a/providers/os/resources/python.go b/providers/os/resources/python.go index b2819b5be1..97674e7b2d 100644 --- a/providers/os/resources/python.go +++ b/providers/os/resources/python.go @@ -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) @@ -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") { diff --git a/providers/os/resources/python/mime.go b/providers/os/resources/python/mime.go index 68231256b1..d2e6a02fa9 100644 --- a/providers/os/resources/python/mime.go +++ b/providers/os/resources/python/mime.go @@ -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, "_", "-") diff --git a/providers/os/resources/python/requirestxt.go b/providers/os/resources/python/requirestxt.go index f172f76abc..caa14ca6cc 100644 --- a/providers/os/resources/python/requirestxt.go +++ b/providers/os/resources/python/requirestxt.go @@ -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, "[") { @@ -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 } diff --git a/providers/os/resources/windows/security_products.go b/providers/os/resources/windows/security_products.go index b3f3183d99..8fa8f8cb21 100644 --- a/providers/os/resources/windows/security_products.go +++ b/providers/os/resources/windows/security_products.go @@ -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 @@ -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 diff --git a/providers/recording.go b/providers/recording.go index e8356a8b9c..b93fdb4a6a 100644 --- a/providers/recording.go +++ b/providers/recording.go @@ -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] diff --git a/providers/runtime.go b/providers/runtime.go index ab2ad0e3f9..4a76d842b6 100644 --- a/providers/runtime.go +++ b/providers/runtime.go @@ -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)