Skip to content

Commit 20c0132

Browse files
authored
Merge pull request #1778 from cjwatson/codespell
Fix spelling errors and run codespell automatically
2 parents ac843e0 + 2eb8a9f commit 20c0132

File tree

153 files changed

+3386
-3348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3386
-3348
lines changed

.codespell-ignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AtLeast
2+
destOp
3+
ECT
4+
inport
5+
renderD
6+
requestor

.devcontainer/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ RUN sed -r -i 's/^Components: main$/Components: main contrib/g' /etc/apt/sources
5050
lxc-templates \
5151
make \
5252
man-db \
53+
pipx \
5354
pkg-config \
5455
protoc-gen-go \
5556
python3-matplotlib \
@@ -69,6 +70,9 @@ RUN sed -r -i 's/^Components: main$/Components: main contrib/g' /etc/apt/sources
6970
# zfsutils-linux
7071
xz-utils
7172

73+
# With pipx >= 1.5.0, we could use pipx --global instead.
74+
RUN PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install codespell
75+
7276
# Add vscode user and add it to sudoers.
7377
RUN groupadd -g 1000 $USERNAME && \
7478
useradd -s /bin/bash -u $USER_UID -g $USER_GID -m $USERNAME && \

.github/workflows/tests.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ jobs:
9090
libtool \
9191
libudev-dev \
9292
make \
93+
pipx \
9394
pkg-config \
9495
shellcheck
9596
96-
python3 -m pip install flake8
97+
# With pipx >= 1.5.0, we could use pipx --global instead.
98+
PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin \
99+
pipx install codespell flake8
97100
98101
- name: Fix repository permissions
99102
run: |

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ endif
307307
ifeq ($(shell command -v flake8),)
308308
echo "Please install flake8"
309309
exit 1
310+
endif
311+
ifeq ($(shell command -v codespell),)
312+
echo "Please install codespell"
313+
exit 1
310314
endif
311315
flake8 test/deps/import-busybox
312316
shellcheck --shell sh test/*.sh test/includes/*.sh test/suites/*.sh test/backends/*.sh test/lint/*.sh

cmd/generate-database/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ensure the file has been cleared of content:
4747

4848
### Generation Directive Arguments
4949

50-
The generation directive aruments have the following form:
50+
The generation directive arguments have the following form:
5151

5252
`//generate-database:mapper <command> flags <kind> <args...>`
5353

cmd/generate-database/db/parse.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func parseField(f *types.Var, structTag string, kind string, pkgName string) (*F
344344
return nil, fmt.Errorf("Unexported field name %q", name)
345345
}
346346

347-
// Ignore fields that are marked with a tag of `db:"ingore"`
347+
// Ignore fields that are marked with a tag of `db:"ignore"`
348348
if structTag != "" {
349349
tagValue := reflect.StructTag(structTag).Get("db")
350350
if tagValue == "ignore" {

cmd/generate-database/file/boilerplate/boilerplate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type preparer interface {
2121

2222
// RegisterStmt register a SQL statement.
2323
//
24-
// Registered statements will be prepared upfront and re-used, to speed up
24+
// Registered statements will be prepared upfront and reused, to speed up
2525
// execution.
2626
//
2727
// Return a unique registration code.

cmd/incus-user/main_daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (c *cmdDaemon) Run(cmd *cobra.Command, args []string) error {
6363
return fmt.Errorf("Failed to obtain connection info: %w", err)
6464
}
6565

66-
// Keep track of the socket path we used to succefully connect to the server
66+
// Keep track of the socket path we used to successfully connect to the server
6767
serverUnixPath := cinfo.SocketPath
6868

6969
// Validate the configuration.

cmd/incus/admin_init_interactive.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func (c *cmdAdminInit) askClustering(config *api.InitPreseed, d incus.InstanceSe
243243
return fmt.Errorf(i18n.G("Failed to setup trust relationship with cluster: %w"), err)
244244
}
245245

246-
// Now we have setup trust, don't send to server, othwerwise it will try and setup trust
246+
// Now we have setup trust, don't send to server, otherwise it will try and setup trust
247247
// again and if using a one-time join token, will fail.
248248
config.Cluster.ClusterToken = ""
249249

@@ -772,7 +772,7 @@ func (c *cmdAdminInit) askDaemon(config *api.InitPreseed, d incus.InstanceServer
772772
This means that unless you manually configured your host otherwise,
773773
you will not have enough uids and gids to allocate to your containers.
774774
775-
Your container's own allocation can be re-used to avoid the problem.
775+
Your container's own allocation can be reused to avoid the problem.
776776
Doing so makes your nested containers slightly less safe as they could
777777
in theory attack their parent container and gain more privileges than
778778
they otherwise would.`) + "\n\n")

cmd/incus/copy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ func (c *cmdCopy) Run(cmd *cobra.Command, args []string) error {
471471
keepVolatile := c.flagRefresh
472472
instanceOnly := c.flagInstanceOnly
473473

474-
// If not target name is specified, one will be chosed by the server
474+
// If target name is not specified, one will be chosen by the server
475475
if len(args) < 2 {
476476
return c.copyInstance(conf, args[0], "", keepVolatile, ephem, stateful, instanceOnly, mode, c.flagStorage, false)
477477
}

cmd/incus/move.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func (c *cmdMove) moveInstance(sourceResource string, destResource string, state
316316
return err
317317
}
318318

319-
// Fetch the current isntance.
319+
// Fetch the current instance.
320320
inst, _, err := source.GetInstance(sourceName)
321321
if err != nil {
322322
return err

cmd/incus/storage_bucket.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Pre-defined column shorthand chars:
518518
return cmd
519519
}
520520

521-
const defaultStorageBucketColumns = "nd"
521+
const defaultStorageBucketColumns = "nd" // codespell:ignore nd
522522

523523
func (c *cmdStorageBucketList) parseColumns(clustered bool) ([]storageBucketColumn, error) {
524524
columnsShorthandMap := map[rune]storageBucketColumn{

cmd/incusd/api_cluster.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2160,8 +2160,8 @@ func internalClusterPostAccept(d *Daemon, r *http.Request) response.Response {
21602160
return response.BadRequest(fmt.Errorf("No name provided"))
21612161
}
21622162

2163-
// Redirect all requests to the leader, which is the one with
2164-
// knowning what nodes are part of the raft cluster.
2163+
// Redirect all requests to the leader, which is the one
2164+
// knowing what nodes are part of the raft cluster.
21652165
localClusterAddress := s.LocalConfig.ClusterAddress()
21662166

21672167
leader, err := s.Cluster.LeaderAddress()

cmd/incusd/api_internal_recover.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func internalRecoverScan(ctx context.Context, s *state.State, userPools []api.St
319319

320320
// Create the pools themselves.
321321
for _, pool := range pools {
322-
// Create missing storage pool DB record if neeed.
322+
// Create missing storage pool DB record if needed.
323323
if pool.ID() == storagePools.PoolIDTemporary {
324324
var instPoolVol *backupConfig.Config // Instance volume used for new pool record.
325325
var poolID int64 // Pool ID of created pool record.

cmd/incusd/api_project.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ func projectValidateConfig(s *state.State, config map[string]string) error {
15781578
// gendoc:generate(entity=project, group=restricted, key=restricted.containers.privilege)
15791579
// Possible values are `unprivileged`, `isolated`, and `allow`.
15801580
//
1581-
// - When set to `unpriviliged`, this option prevents setting {config:option}`instance-security:security.privileged` to `true`.
1581+
// - When set to `unprivileged`, this option prevents setting {config:option}`instance-security:security.privileged` to `true`.
15821582
// - When set to `isolated`, this option prevents setting {config:option}`instance-security:security.privileged` and {config:option}`instance-security:security.idmap.isolated` to `true`.
15831583
// - When set to `allow`, there is no restriction.
15841584
// ---

cmd/incusd/daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ func (d *Daemon) Stop(ctx context.Context, sig os.Signal) error {
18391839
if sig == unix.SIGPWR || sig == unix.SIGTERM {
18401840
if d.db.Cluster != nil {
18411841
// waitForOperations will block until all operations are done, or it's forced to shut down.
1842-
// For the latter case, we re-use the shutdown channel which is filled when a shutdown is
1842+
// For the latter case, we reuse the shutdown channel which is filled when a shutdown is
18431843
// initiated using `shutdown`.
18441844
waitForOperations(ctx, d.db.Cluster, s.GlobalConfig.ShutdownTimeout())
18451845
}

cmd/incusd/daemon_images.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func ImageDownload(ctx context.Context, r *http.Request, s *state.State, op *ope
544544
return nil, false, fmt.Errorf("Unsupported protocol: %v", protocol)
545545
}
546546

547-
// Override visiblity
547+
// Override visibility
548548
info.Public = args.Public
549549

550550
// We want to enable auto-update only if we were passed an

cmd/incusd/dev_incus.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ func devIncusAPI(d *Daemon, f hoistFunc) http.Handler {
328328
* event, we use SO_PEERCRED to extract the creds for the socket.
329329
*
330330
* 2. We store a map from the connection pointer to the pid for that
331-
* connection, so that once the HTTP negotiation occurrs and we get a
331+
* connection, so that once the HTTP negotiation occurs and we get a
332332
* ResponseWriter, we know (because we negotiated on the first byte) which
333-
* pid the connection belogs to.
333+
* pid the connection belongs to.
334334
*
335335
* 3. Regular HTTP negotiation and dispatch occurs via net/http.
336336
*

cmd/incusd/instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ func pruneExpiredAndAutoCreateInstanceSnapshotsTask(d *Daemon) (task.Func, task.
672672
return
673673
}
674674

675-
// Get list of instances on the local member that are due to have snaphots creating.
675+
// Get list of instances on the local member that are due to have snapshots creating.
676676
filter := dbCluster.InstanceFilter{Node: &s.ServerName}
677677

678678
err = s.DB.Cluster.Transaction(ctx, func(ctx context.Context, tx *db.ClusterTx) error {

cmd/incusd/instance_access.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
// swagger:operation GET /1.0/instances/{name}/access instances instance_access
1717
//
18-
// Get who has access to an instnace
18+
// Get who has access to an instance
1919
//
2020
// Gets the access information for the instance.
2121
//

cmd/incusd/instance_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (suite *containerTestSuite) TestContainer_LoadFromDB() {
208208
suite.Exactly(
209209
apiC1,
210210
apiC2,
211-
"The loaded container isn't excactly the same as the created one.",
211+
"The loaded container isn't exactly the same as the created one.",
212212
)
213213
}
214214

cmd/incusd/main_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func mockStartDaemon() (*Daemon, error) {
2020
d := defaultDaemon()
2121
d.os.MockMode = true
2222

23-
// Setup test certificates. We re-use the ones already on disk under
23+
// Setup test certificates. We reuse the ones already on disk under
2424
// the test/ directory, to avoid generating new ones, which is
2525
// expensive.
2626
err := sys.SetupTestCerts(internalUtil.VarPath())

cmd/incusd/migration_connection.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (c *migrationConn) AcceptIncoming(r *http.Request, w http.ResponseWriter) e
111111
}
112112

113113
// WebSocket returns the underlying websocket connection.
114-
// If the connection isn't yet active it will either wait for an incoming connection or if configured, will atempt
114+
// If the connection isn't yet active it will either wait for an incoming connection or if configured, will attempt
115115
// to initiate a new outbound connection. If the context is cancelled before the connection is established it
116116
// will return with an error.
117117
func (c *migrationConn) WebSocket(ctx context.Context) (*websocket.Conn, error) {

cmd/incusd/networks.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
"github.com/lxc/incus/v6/shared/util"
4343
)
4444

45-
// Lock to prevent concurent networks creation.
45+
// Lock to prevent concurrent networks creation.
4646
var networkCreateLock sync.Mutex
4747

4848
var networksCmd = APIEndpoint{
@@ -1187,7 +1187,7 @@ func networkPost(d *Daemon, r *http.Request) response.Response {
11871187
// network having already been renamed in the database, which is
11881188
// a chicken-and-egg problem for cluster notifications (the
11891189
// serving node should typically do the database job, so the
1190-
// network is not yet renamed inthe db when the notified node
1190+
// network is not yet renamed in the db when the notified node
11911191
// runs network.Start).
11921192
if s.ServerClustered {
11931193
return response.BadRequest(fmt.Errorf("Renaming clustered network not supported"))

cmd/incusd/snapshot_common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func cronSpecIsNow(spec string) (bool, error) {
107107
now := time.Now()
108108

109109
// Truncate the time now back to the start of the minute.
110-
// This is neded because the cron scheduler will add a minute to the scheduled time
110+
// This is needed because the cron scheduler will add a minute to the scheduled time
111111
// and we don't want the next scheduled time to roll over to the next minute and break
112112
// the time comparison below.
113113
now = now.Truncate(time.Minute)

cmd/incusd/storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
// Simple cache used to store the activated drivers on this server.
27-
// This allows us to avoid querying the database everytime and API call is made.
27+
// This allows us to avoid querying the database every time an API call is made.
2828
var (
2929
storagePoolUsedDriversCacheVal atomic.Value
3030
storagePoolSupportedDriversCacheVal atomic.Value

cmd/incusd/storage_pools.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/lxc/incus/v6/shared/util"
3232
)
3333

34-
// Lock to prevent concurent storage pools creation.
34+
// Lock to prevent concurrent storage pools creation.
3535
var storagePoolCreateLock sync.Mutex
3636

3737
var storagePoolsCmd = APIEndpoint{

cmd/incusd/storage_volumes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func storagePoolVolumesGet(d *Daemon, r *http.Request) response.Response {
359359
}
360360

361361
// The project name used for custom volumes varies based on whether the
362-
// project has the featues.storage.volumes feature enabled.
362+
// project has the features.storage.volumes feature enabled.
363363
customVolProjectName = project.StorageVolumeProjectFromRecord(p, db.StoragePoolVolumeTypeCustom)
364364

365365
projectImages, err = tx.GetImagesFingerprints(ctx, requestProjectName, false)

cmd/lxc-to-incus/main_migrate_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ func TestValidateConfig(t *testing.T) {
2626
true,
2727
},
2828
{
29-
"container name missmatch (1)",
29+
"container name mismatch (1)",
3030
[]string{
3131
"lxc.uts.name = c2",
3232
},
3333
"Container name doesn't match lxc.uts.name / lxc.utsname",
3434
true,
3535
},
3636
{
37-
"container name missmatch (2)",
37+
"container name mismatch (2)",
3838
[]string{
3939
"lxc.utsname = c2",
4040
},

cmd/lxd-to-incus/db.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func lz4Uncompress(zfilename string) error {
9292

9393
zinfo, err := zfile.Stat()
9494
if err != nil {
95-
return fmt.Errorf("Fialed to get file info for %q: %w", zfilename, err)
95+
return fmt.Errorf("Failed to get file info for %q: %w", zfilename, err)
9696
}
9797

9898
// use the same mode for the output file

cmd/lxd-to-incus/validate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (c *cmdMigrate) validate(source source, target target) error {
8383
return false, nil
8484
}
8585

86-
// Check if any instance is persent.
86+
// Check if any instance is present.
8787
names, err = srcClient.GetInstanceNames(api.InstanceTypeAny)
8888
if err != nil {
8989
return false, err

doc/config_options.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ When set to `allow`, {config:option}`instance-security:security.nesting` can be
18631863
:type: "string"
18641864
Possible values are `unprivileged`, `isolated`, and `allow`.
18651865

1866-
- When set to `unpriviliged`, this option prevents setting {config:option}`instance-security:security.privileged` to `true`.
1866+
- When set to `unprivileged`, this option prevents setting {config:option}`instance-security:security.privileged` to `true`.
18671867
- When set to `isolated`, this option prevents setting {config:option}`instance-security:security.privileged` and {config:option}`instance-security:security.idmap.isolated` to `true`.
18681868
- When set to `allow`, there is no restriction.
18691869
```

doc/reference/storage_zfs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Note that this method might have ramifications for restoring snapshots.
3939
See {ref}`storage-zfs-limitations` below.
4040

4141
Incus automatically enables trimming support on all newly created pools on ZFS 0.8 or later.
42-
This increases the lifetime of SSDs by allowing better block re-use by the controller, and it also allows to free space on the root file system when using a loop-backed ZFS pool.
42+
This increases the lifetime of SSDs by allowing better block reuse by the controller, and it also allows to free space on the root file system when using a loop-backed ZFS pool.
4343
If you are running a ZFS version earlier than 0.8 and want to enable trimming, upgrade to at least version 0.8.
4444
Then use the following commands to make sure that trimming is automatically enabled for the ZFS pool in the future and trim all currently unused space:
4545

doc/rest-api.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4045,7 +4045,7 @@ definitions:
40454045
type: string
40464046
x-go-name: Description
40474047
err:
4048-
description: Operation error mesage
4048+
description: Operation error message
40494049
example: Some error message
40504050
type: string
40514051
x-go-name: Err
@@ -4087,7 +4087,7 @@ definitions:
40874087
items:
40884088
type: string
40894089
type: array
4090-
description: Affected resourcs
4090+
description: Affected resources
40914091
example:
40924092
instances:
40934093
- /1.0/instances/foo
@@ -9169,7 +9169,7 @@ paths:
91699169
$ref: '#/responses/Forbidden'
91709170
"500":
91719171
$ref: '#/responses/InternalServerError'
9172-
summary: Get who has access to an instnace
9172+
summary: Get who has access to an instance
91739173
tags:
91749174
- instances
91759175
/1.0/instances/{name}/backups:

internal/rsync/rsync.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ func AtLeast(min string) bool {
460460
return false
461461
}
462462

463-
// Load minium version.
463+
// Load minimum version.
464464
minVer, err := version.NewDottedVersion(min)
465465
if err != nil {
466466
return false

0 commit comments

Comments
 (0)