Merge pull request #1781 from alexandear/fix-typos-across-repo

Fix typos across repo; extend codespell config
This commit is contained in:
openshift-merge-bot[bot] 2024-01-04 11:12:20 +00:00 committed by GitHub
commit ce424557dd
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]
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.
run: pip install codespell
- name: run codespell
run: codespell -L ro,hastable,shouldnot
run: codespell --dictionary=-
lint:
runs-on: ubuntu-22.04
steps:

View File

@ -103,7 +103,7 @@ test-unit: netavark-testplugin
.PHONY: codespell
codespell:
codespell -L ro,hastable,shouldnot -w
codespell --dictionary=- -w
clean: ## Clean artifacts
$(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`.
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.
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.
**events_logger**="journald"

View File

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

View File

@ -517,8 +517,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)
}
for _, inseureDomain := range sources.InsecureRegistries {
if inseureDomain == reference.Domain(dref) {
for _, insecureDomain := range sources.InsecureRegistries {
if insecureDomain == reference.Domain(dref) {
insecure := true
return &insecure, nil
}

View File

@ -66,7 +66,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 {
logrus.Tracef("Reloading image %s", i.ID())
img, err := i.runtime.store.Image(i.ID())
@ -610,7 +610,7 @@ func (i *Image) Untag(name string) error {
}
// 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.
//
// !!! Also make sure to re-enable the tests !!!

View File

@ -70,7 +70,7 @@ func TestImageFunctions(t *testing.T) {
// manifest list we chose it from.
digests := image.Digests()
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
// the correct error for both digests.
@ -384,7 +384,7 @@ func TestUntag(t *testing.T) {
require.EqualError(t, err, test.expectError, "untag should have failed: %v", test)
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)
require.Error(t, err, "image should not resolve after untag anymore (%s): %v", resolvedName, test)
}

View File

@ -52,7 +52,7 @@ func (i *Image) Tree(traverseChildren bool) (string, error) {
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
// with Podman.
contents := []string{}

View File

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

View File

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

View File

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

View File

@ -161,7 +161,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.
func (r *Runtime) Exists(name string) (bool, error) {
image, _, err := r.LookupImage(name, nil)

View File

@ -46,14 +46,14 @@ var _ = Describe("run CNI", func() {
const cniVarDir = "/var/lib/cni"
// 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()) {
_ = netNSTest.Do(func(_ ns.NetNS) error {
defer GinkgoRecover()
err := os.MkdirAll(cniVarDir, 0o755)
Expect(err).To(BeNil(), "Failed to create cniVarDir")
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, "")
Expect(err).To(BeNil(), "Failed to mount tmpfs for cniVarDir")
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
type NetUtil interface {
// ForEach eaxecutes the given function for each network
// ForEach executes the given function for each network
ForEach(func(types.Network))
// Len returns the number of networks
Len() int

View File

@ -2161,7 +2161,7 @@ var _ = Describe("Config", func() {
logString := logBuffer.String()
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 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/invalid_gateway.json\\\" could not be parsed, skipping: gateway 10.89.100.1 not in subnet 10.89.9.0/24", networkConfDir))
})

View File

@ -42,7 +42,7 @@ var _ = Describe("run netavark", func() {
)
// 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()) {
_ = netNSTest.Do(func(_ ns.NetNS) error {
defer GinkgoRecover()

View File

@ -98,7 +98,7 @@ func TestValidateCapabilities(t *testing.T) {
require.Nil(t, err)
}
func TestValidateCapabilitieBadCapabilities(t *testing.T) {
func TestValidateCapabilitiesBadCapabilities(t *testing.T) {
strSlice := []string{"CAP_SYS_ADMIN", "NO_ADMIN"}
err := ValidateCapabilities(strSlice)
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
// 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) {
userNotRoot := func(user string) bool {
if user == "" || user == "root" || user == "0" {
@ -1245,7 +1245,7 @@ func (c *Config) FindInitBinary() (string, error) {
if c.Engine.InitPath != "" {
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 {
return DefaultInitPath, nil
}

View File

@ -340,7 +340,7 @@ func defaultEngineConfig() (*EngineConfig, error) {
c.HelperBinariesDir.Set(defaultHelperBinariesDir)
if additionalHelperBinariesDir != "" {
// Prioritize addtionalHelperBinariesDir over defaults.
// Prioritize additionalHelperBinariesDir over defaults.
c.HelperBinariesDir.Set(append([]string{additionalHelperBinariesDir}, c.HelperBinariesDir.Get()...))
}
c.HooksDir.Set(DefaultHooksDirs)
@ -556,7 +556,7 @@ func (c *Config) DNSServers() []string {
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 {
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)
}
// 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 {
d.lockfile.Lock()
defer d.lockfile.Unlock()

View File

@ -14,12 +14,12 @@ import (
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) {
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) {
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)
}
// 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 {
d.lockfile.Lock()
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 {
dedup := make(map[string]ssh.Signer)
for _, s := range signers {