Fix typos across repo; extend codespell config

Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
This commit is contained in:
Oleksandr Redko 2024-01-03 23:16:31 +02:00
parent 58e0c26e20
commit 3cc2a76ae9
26 changed files with 65 additions and 40 deletions

14
common/.codespelldict Normal file
View File

@ -0,0 +1,14 @@
alterting->altering
annotationg->annotating
assemlbe->assemble
capabiltiies->capabilities
custommizing->customizing
eaxecutes->executes
maximumn->maximum
mountns->mounts
name_missmatch->name_mismatch
notaibly->notably
pessimitically->pessimistically
recoreded->recorded
specicifed->specified
unsuppored->unsupported

View File

@ -1,4 +1,15 @@
# https://github.com/codespell-project/codespell#using-a-config-file
[codespell] [codespell]
skip = ./vendor,./.git #,bin,vendor,.git,go.sum,changelog.txt,.cirrus.yml,"RELEASE_NOTES.md,*.xz,*.gz,*.tar,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go"
ignore-words-list = clos,creat
# Comma-separated list of files to skip.
skip = ./vendor,./.git #,bin,vendor,.git,go.sum,changelog.txt,.cirrus.yml,"RELEASE_NOTES.md,*.xz,*.gz,*.tar,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go"
# Comma separated list of words to be ignored. Words must be lowercased.
ignore-words-list = clos,creat,ro,hastable,shouldnot
# Custom dictionary file that contains spelling corrections.
# Run with option '--dictionary=-' to include also default dictionary.
dictionary = .codespelldict
# Check file names as well.
check-filenames = true

View File

@ -22,7 +22,7 @@ jobs:
# Version of codespell bundled with Ubuntu is way old, so use pip. # Version of codespell bundled with Ubuntu is way old, so use pip.
run: pip install codespell run: pip install codespell
- name: run codespell - name: run codespell
run: codespell -L ro,hastable,shouldnot run: codespell --dictionary=-
lint: lint:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:

View File

@ -103,7 +103,7 @@ test-unit: netavark-testplugin
.PHONY: codespell .PHONY: codespell
codespell: codespell:
codespell -L ro,hastable,shouldnot -w codespell --dictionary=- -w
clean: ## Clean artifacts clean: ## Clean artifacts
$(MAKE) -C docs clean $(MAKE) -C docs clean

View File

@ -577,7 +577,7 @@ The unit can be b (bytes), k (kilobytes), m (megabytes) or g (gigabytes).
The format for the size is `<number><unit>`, e.g., `1b` or `3g`. The format for the size is `<number><unit>`, e.g., `1b` or `3g`.
If no unit is included then the size will be in bytes. If no unit is included then the size will be in bytes.
When the limit is exceeded, the logfile will be rotated and the old one will be deleted. When the limit is exceeded, the logfile will be rotated and the old one will be deleted.
If the maximumn size is set to 0, then no limit will be applied, If the maximum size is set to 0, then no limit will be applied,
and the logfile will not be rotated. and the logfile will not be rotated.
**events_logger**="journald" **events_logger**="journald"

View File

@ -13,7 +13,7 @@ type testConfig struct {
} }
const ( const (
confingDefault = `array=["1", "2", "3"]` configDefault = `array=["1", "2", "3"]`
configAppendFront = `array=[{append=true},"4", "5", "6"]` configAppendFront = `array=[{append=true},"4", "5", "6"]`
configAppendMid = `array=["7", {append=true}, "8"]` configAppendMid = `array=["7", {append=true}, "8"]`
configAppendBack = `array=["9", {append=true}]` configAppendBack = `array=["9", {append=true}]`
@ -43,19 +43,19 @@ func TestSliceLoading(t *testing.T) {
expectedErrorSubstring string expectedErrorSubstring string
}{ }{
// Load single configs // Load single configs
{[]string{confingDefault}, []string{"1", "2", "3"}, nil, ""}, {[]string{configDefault}, []string{"1", "2", "3"}, nil, ""},
{[]string{configAppendFront}, []string{"4", "5", "6"}, &bTrue, ""}, {[]string{configAppendFront}, []string{"4", "5", "6"}, &bTrue, ""},
{[]string{configAppendMid}, []string{"7", "8"}, &bTrue, ""}, {[]string{configAppendMid}, []string{"7", "8"}, &bTrue, ""},
{[]string{configAppendBack}, []string{"9"}, &bTrue, ""}, {[]string{configAppendBack}, []string{"9"}, &bTrue, ""},
{[]string{configAppendFalse}, []string{"10"}, &bFalse, ""}, {[]string{configAppendFalse}, []string{"10"}, &bFalse, ""},
// Append=true // Append=true
{[]string{confingDefault, configAppendFront}, []string{"1", "2", "3", "4", "5", "6"}, &bTrue, ""}, {[]string{configDefault, configAppendFront}, []string{"1", "2", "3", "4", "5", "6"}, &bTrue, ""},
{[]string{configAppendFront, confingDefault}, []string{"4", "5", "6", "1", "2", "3"}, &bTrue, ""}, // The attribute is sticky unless explicitly being turned off in a later config {[]string{configAppendFront, configDefault}, []string{"4", "5", "6", "1", "2", "3"}, &bTrue, ""}, // The attribute is sticky unless explicitly being turned off in a later config
{[]string{configAppendFront, confingDefault, configAppendBack}, []string{"4", "5", "6", "1", "2", "3", "9"}, &bTrue, ""}, {[]string{configAppendFront, configDefault, configAppendBack}, []string{"4", "5", "6", "1", "2", "3", "9"}, &bTrue, ""},
// Append=false // Append=false
{[]string{confingDefault, configAppendFalse}, []string{"10"}, &bFalse, ""}, {[]string{configDefault, configAppendFalse}, []string{"10"}, &bFalse, ""},
{[]string{confingDefault, configAppendMid, configAppendFalse}, []string{"10"}, &bFalse, ""}, {[]string{configDefault, configAppendMid, configAppendFalse}, []string{"10"}, &bFalse, ""},
{[]string{confingDefault, configAppendFalse, configAppendMid}, []string{"10", "7", "8"}, &bTrue, ""}, // Append can be re-enabled by a later config {[]string{configDefault, configAppendFalse, configAppendMid}, []string{"10", "7", "8"}, &bTrue, ""}, // Append can be re-enabled by a later config
// Error checks // Error checks
{[]string{`array=["1", false]`}, nil, nil, `unsupported item in attributed string slice: false`}, {[]string{`array=["1", false]`}, nil, nil, `unsupported item in attributed string slice: false`},
@ -84,7 +84,7 @@ func TestSliceEncoding(t *testing.T) {
expectedAppend *bool expectedAppend *bool
}{ }{
{ {
[]string{confingDefault}, []string{configDefault},
"array = [\"1\", \"2\", \"3\"]\n", "array = [\"1\", \"2\", \"3\"]\n",
[]string{"1", "2", "3"}, []string{"1", "2", "3"},
nil, nil,

View File

@ -518,8 +518,8 @@ func checkRegistrySourcesAllows(dest types.ImageReference) (insecure *bool, err
return nil, fmt.Errorf("registry %q denied by policy: not in allowed registries list (%s)", reference.Domain(dref), registrySources) return nil, fmt.Errorf("registry %q denied by policy: not in allowed registries list (%s)", reference.Domain(dref), registrySources)
} }
for _, inseureDomain := range sources.InsecureRegistries { for _, insecureDomain := range sources.InsecureRegistries {
if inseureDomain == reference.Domain(dref) { if insecureDomain == reference.Domain(dref) {
insecure := true insecure := true
return &insecure, nil return &insecure, nil
} }

View File

@ -67,7 +67,7 @@ type Image struct {
} }
} }
// reload the image and pessimitically clear all cached data. // reload the image and pessimistically clear all cached data.
func (i *Image) reload() error { func (i *Image) reload() error {
logrus.Tracef("Reloading image %s", i.ID()) logrus.Tracef("Reloading image %s", i.ID())
img, err := i.runtime.store.Image(i.ID()) img, err := i.runtime.store.Image(i.ID())
@ -611,7 +611,7 @@ func (i *Image) Untag(name string) error {
} }
// FIXME: this is breaking Podman CI but must be re-enabled once // FIXME: this is breaking Podman CI but must be re-enabled once
// c/storage supports alterting the digests of an image. Then, // c/storage supports altering the digests of an image. Then,
// Podman will do the right thing. // Podman will do the right thing.
// //
// !!! Also make sure to re-enable the tests !!! // !!! Also make sure to re-enable the tests !!!

View File

@ -71,7 +71,7 @@ func TestImageFunctions(t *testing.T) {
// manifest list we chose it from. // manifest list we chose it from.
digests := image.Digests() digests := image.Digests()
require.Len(t, digests, 2) require.Len(t, digests, 2)
require.Equal(t, origDigest.String(), digests[0].String(), "first recoreded digest should be the one of the image") require.Equal(t, origDigest.String(), digests[0].String(), "first recorded digest should be the one of the image")
// containers/podman/issues/12729: make sure manifest lookup returns // containers/podman/issues/12729: make sure manifest lookup returns
// the correct error for both digests. // the correct error for both digests.
@ -385,7 +385,7 @@ func TestUntag(t *testing.T) {
require.EqualError(t, err, test.expectError, "untag should have failed: %v", test) require.EqualError(t, err, test.expectError, "untag should have failed: %v", test)
continue continue
} }
require.NoError(t, err, "untag should have succeedded: %v", test) require.NoError(t, err, "untag should have succeeded: %v", test)
_, resolvedName, err := runtime.LookupImage(test.tag, nil) _, resolvedName, err := runtime.LookupImage(test.tag, nil)
require.Error(t, err, "image should not resolve after untag anymore (%s): %v", resolvedName, test) require.Error(t, err, "image should not resolve after untag anymore (%s): %v", resolvedName, test)
} }

View File

@ -53,7 +53,7 @@ func (i *Image) Tree(traverseChildren bool) (string, error) {
return tree.Print(), nil return tree.Print(), nil
} }
// Walk all layers of the image and assemlbe their data. Note that the // Walk all layers of the image and assemble their data. Note that the
// tree is constructed in reverse order to remain backwards compatible // tree is constructed in reverse order to remain backwards compatible
// with Podman. // with Podman.
contents := []string{} contents := []string{}

View File

@ -314,7 +314,7 @@ func (m *ManifestList) Add(ctx context.Context, name string, options *ManifestLi
return newDigest, nil return newDigest, nil
} }
// Options for annotationg a manifest list. // Options for annotating a manifest list.
type ManifestListAnnotateOptions struct { type ManifestListAnnotateOptions struct {
// Add the specified annotations to the added image. // Add the specified annotations to the added image.
Annotations map[string]string Annotations map[string]string

View File

@ -31,7 +31,7 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// PullOptions allows for custommizing image pulls. // PullOptions allows for customizing image pulls.
type PullOptions struct { type PullOptions struct {
CopyOptions CopyOptions

View File

@ -13,7 +13,7 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// PushOptions allows for custommizing image pushes. // PushOptions allows for customizing image pushes.
type PushOptions struct { type PushOptions struct {
CopyOptions CopyOptions
} }

View File

@ -162,7 +162,7 @@ func (r *Runtime) storageToImage(storageImage *storage.Image, ref types.ImageRef
} }
} }
// Exists returns true if the specicifed image exists in the local containers // Exists returns true if the specified image exists in the local containers
// storage. Note that it may return false if an image corrupted. // storage. Note that it may return false if an image corrupted.
func (r *Runtime) Exists(name string) (bool, error) { func (r *Runtime) Exists(name string) (bool, error) {
image, _, err := r.LookupImage(name, nil) image, _, err := r.LookupImage(name, nil)

View File

@ -47,14 +47,14 @@ var _ = Describe("run CNI", func() {
const cniVarDir = "/var/lib/cni" const cniVarDir = "/var/lib/cni"
// runTest is a helper function to run a test. It ensures that each test // runTest is a helper function to run a test. It ensures that each test
// is run in its own netns. It also creates a mountns to mount a tmpfs to /var/lib/cni. // is run in its own netns. It also creates a mounts to mount a tmpfs to /var/lib/cni.
runTest := func(run func()) { runTest := func(run func()) {
_ = netNSTest.Do(func(_ ns.NetNS) error { _ = netNSTest.Do(func(_ ns.NetNS) error {
defer GinkgoRecover() defer GinkgoRecover()
err := os.MkdirAll(cniVarDir, 0o755) err := os.MkdirAll(cniVarDir, 0o755)
Expect(err).To(BeNil(), "Failed to create cniVarDir") Expect(err).To(BeNil(), "Failed to create cniVarDir")
err = unix.Unshare(unix.CLONE_NEWNS) err = unix.Unshare(unix.CLONE_NEWNS)
Expect(err).To(BeNil(), "Failed to create new mountns") Expect(err).To(BeNil(), "Failed to create new mounts")
err = unix.Mount("tmpfs", cniVarDir, "tmpfs", unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV, "") err = unix.Mount("tmpfs", cniVarDir, "tmpfs", unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV, "")
Expect(err).To(BeNil(), "Failed to mount tmpfs for cniVarDir") Expect(err).To(BeNil(), "Failed to mount tmpfs for cniVarDir")
defer unix.Unmount(cniVarDir, 0) //nolint:errcheck defer unix.Unmount(cniVarDir, 0) //nolint:errcheck

View File

@ -7,7 +7,7 @@ import "github.com/containers/common/libnetwork/types"
// NetUtil is a helper interface which all network interfaces should implement to allow easy code sharing // NetUtil is a helper interface which all network interfaces should implement to allow easy code sharing
type NetUtil interface { type NetUtil interface {
// ForEach eaxecutes the given function for each network // ForEach executes the given function for each network
ForEach(func(types.Network)) ForEach(func(types.Network))
// Len returns the number of networks // Len returns the number of networks
Len() int Len() int

View File

@ -2162,7 +2162,7 @@ var _ = Describe("Config", func() {
logString := logBuffer.String() logString := logBuffer.String()
Expect(logString).To(ContainSubstring("Error reading network config file \\\"%s/broken.json\\\": unexpected EOF", networkConfDir)) Expect(logString).To(ContainSubstring("Error reading network config file \\\"%s/broken.json\\\": unexpected EOF", networkConfDir))
Expect(logString).To(ContainSubstring("Network config \\\"%s/invalid name.json\\\" has invalid name: \\\"invalid name\\\", skipping: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument", networkConfDir)) Expect(logString).To(ContainSubstring("Network config \\\"%s/invalid name.json\\\" has invalid name: \\\"invalid name\\\", skipping: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument", networkConfDir))
Expect(logString).To(ContainSubstring("Network config name \\\"name_miss\\\" does not match file name \\\"name_missmatch.json\\\", skipping")) Expect(logString).To(ContainSubstring("Network config name \\\"name_miss\\\" does not match file name \\\"name_mismatch.json\\\", skipping"))
Expect(logString).To(ContainSubstring("Network config \\\"%s/wrongID.json\\\" could not be parsed, skipping: invalid network ID \\\"someID\\\"", networkConfDir)) Expect(logString).To(ContainSubstring("Network config \\\"%s/wrongID.json\\\" could not be parsed, skipping: invalid network ID \\\"someID\\\"", networkConfDir))
Expect(logString).To(ContainSubstring("Network config \\\"%s/invalid_gateway.json\\\" could not be parsed, skipping: gateway 10.89.100.1 not in subnet 10.89.9.0/24", networkConfDir)) Expect(logString).To(ContainSubstring("Network config \\\"%s/invalid_gateway.json\\\" could not be parsed, skipping: gateway 10.89.100.1 not in subnet 10.89.9.0/24", networkConfDir))
}) })

View File

@ -43,7 +43,7 @@ var _ = Describe("run netavark", func() {
) )
// runTest is a helper function to run a test. It ensures that each test // runTest is a helper function to run a test. It ensures that each test
// is run in its own netns. It also creates a mountns to mount a tmpfs to /var/lib/cni. // is run in its own netns. It also creates a mounts to mount a tmpfs to /var/lib/cni.
runTest := func(run func()) { runTest := func(run func()) {
_ = netNSTest.Do(func(_ ns.NetNS) error { _ = netNSTest.Do(func(_ ns.NetNS) error {
defer GinkgoRecover() defer GinkgoRecover()

View File

@ -98,7 +98,7 @@ func TestValidateCapabilities(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
} }
func TestValidateCapabilitieBadCapabilities(t *testing.T) { func TestValidateCapabilitiesBadCapabilities(t *testing.T) {
strSlice := []string{"CAP_SYS_ADMIN", "NO_ADMIN"} strSlice := []string{"CAP_SYS_ADMIN", "NO_ADMIN"}
err := ValidateCapabilities(strSlice) err := ValidateCapabilities(strSlice)
assert.Error(t, err) assert.Error(t, err)

View File

@ -918,7 +918,7 @@ func (c *Config) GetDefaultEnvEx(envHost, httpProxy bool) []string {
} }
// Capabilities returns the capabilities parses the Add and Drop capability // Capabilities returns the capabilities parses the Add and Drop capability
// list from the default capabiltiies for the container // list from the default capabilities for the container
func (c *Config) Capabilities(user string, addCapabilities, dropCapabilities []string) ([]string, error) { func (c *Config) Capabilities(user string, addCapabilities, dropCapabilities []string) ([]string, error) {
userNotRoot := func(user string) bool { userNotRoot := func(user string) bool {
if user == "" || user == "root" || user == "0" { if user == "" || user == "root" || user == "0" {
@ -1245,7 +1245,7 @@ func (c *Config) FindInitBinary() (string, error) {
if c.Engine.InitPath != "" { if c.Engine.InitPath != "" {
return c.Engine.InitPath, nil return c.Engine.InitPath, nil
} }
// keep old default working to guarantee backwards comapt // keep old default working to guarantee backwards compat
if _, err := os.Stat(DefaultInitPath); err == nil { if _, err := os.Stat(DefaultInitPath); err == nil {
return DefaultInitPath, nil return DefaultInitPath, nil
} }

View File

@ -340,7 +340,7 @@ func defaultEngineConfig() (*EngineConfig, error) {
c.HelperBinariesDir.Set(defaultHelperBinariesDir) c.HelperBinariesDir.Set(defaultHelperBinariesDir)
if additionalHelperBinariesDir != "" { if additionalHelperBinariesDir != "" {
// Prioritize addtionalHelperBinariesDir over defaults. // Prioritize additionalHelperBinariesDir over defaults.
c.HelperBinariesDir.Set(append([]string{additionalHelperBinariesDir}, c.HelperBinariesDir.Get()...)) c.HelperBinariesDir.Set(append([]string{additionalHelperBinariesDir}, c.HelperBinariesDir.Get()...))
} }
c.HooksDir.Set(DefaultHooksDirs) c.HooksDir.Set(DefaultHooksDirs)
@ -556,7 +556,7 @@ func (c *Config) DNSServers() []string {
return c.Containers.DNSServers.Get() return c.Containers.DNSServers.Get()
} }
// DNSSerches returns the default DNS searches to add to resolv.conf in containers. // DNSSearches returns the default DNS searches to add to resolv.conf in containers.
func (c *Config) DNSSearches() []string { func (c *Config) DNSSearches() []string {
return c.Containers.DNSSearches.Get() return c.Containers.DNSSearches.Get()
} }

View File

@ -79,7 +79,7 @@ func (d *Driver) Lookup(id string) ([]byte, error) {
return nil, fmt.Errorf("%s: %w", id, errNoSecretData) return nil, fmt.Errorf("%s: %w", id, errNoSecretData)
} }
// Store stores the bytes associated with an ID. An error is returned if the ID arleady exists // Store stores the bytes associated with an ID. An error is returned if the ID already exists
func (d *Driver) Store(id string, data []byte) error { func (d *Driver) Store(id string, data []byte) error {
d.lockfile.Lock() d.lockfile.Lock()
defer d.lockfile.Unlock() defer d.lockfile.Unlock()

View File

@ -15,12 +15,12 @@ import (
var errNotSupported = errors.New("seccomp not enabled in this build") var errNotSupported = errors.New("seccomp not enabled in this build")
// LoadProfile returns an error on unsuppored systems // LoadProfile returns an error on unsupported systems
func LoadProfile(body string, rs *specs.Spec) (*specs.LinuxSeccomp, error) { func LoadProfile(body string, rs *specs.Spec) (*specs.LinuxSeccomp, error) {
return nil, errNotSupported return nil, errNotSupported
} }
// GetDefaultProfile returns an error on unsuppored systems // GetDefaultProfile returns an error on unsupported systems
func GetDefaultProfile(rs *specs.Spec) (*specs.LinuxSeccomp, error) { func GetDefaultProfile(rs *specs.Spec) (*specs.LinuxSeccomp, error) {
return nil, errNotSupported return nil, errNotSupported
} }

View File

@ -79,7 +79,7 @@ func (d *Driver) Lookup(id string) ([]byte, error) {
return nil, fmt.Errorf("%s: %w", id, errNoSecretData) return nil, fmt.Errorf("%s: %w", id, errNoSecretData)
} }
// Store stores the bytes associated with an ID. An error is returned if the ID arleady exists // Store stores the bytes associated with an ID. An error is returned if the ID already exists
func (d *Driver) Store(id string, data []byte) error { func (d *Driver) Store(id string, data []byte) error {
d.lockfile.Lock() d.lockfile.Lock()
defer d.lockfile.Unlock() defer d.lockfile.Unlock()

View File

@ -262,7 +262,7 @@ func ValidateAndConfigure(uri *url.URL, iden string, insecureIsMachineConnection
} }
} }
} }
var authMethods []ssh.AuthMethod // now we validate and check for the authorization methods, most notaibly public key authorization var authMethods []ssh.AuthMethod // now we validate and check for the authorization methods, most notably public key authorization
if len(signers) > 0 { if len(signers) > 0 {
dedup := make(map[string]ssh.Signer) dedup := make(map[string]ssh.Signer)
for _, s := range signers { for _, s := range signers {