Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell support (config, workflow to detect/not fix) and make it fix few typos #4436

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,go.sum,.codespellrc
check-hidden = true
# all lines with latin
ignore-regex = .* tincidunt .*|\bMany Withs\b
# ignore-words-list =
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within .codespellrc
---
name: Codespell

on:
push:
branches: [develop]
pull_request:
branches: [develop]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ _Bug fixes_

#### Connection Management
- Optimise connection initialisation for high connection count ([#3394](https://github.com/turbot/steampipe/issues/3394),[#3267](https://github.com/turbot/steampipe/issues/3267),[#3236](https://github.com/turbot/steampipe/issues/3236),[#3229](https://github.com/turbot/steampipe/issues/3229),[#3413](https://github.com/turbot/steampipe/issues/3413))
- Execute RefreshConnections asyncronously in service startup
- Execute RefreshConnections asynchronously in service startup
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Autocomplete and inspect data available before all connections are refreshed
- Add `steampipe_connection_state` table to indicate the loading state of connections
- Add support for `import_schema` property in connection config, controlling whether to create a postgres schema for a steampipe connection. Closes #3407
- Optimise schema creation by cloning connection schemas
Expand All @@ -375,7 +375,7 @@ _Bug fixes_
- Schema names starting with steampipe_ are to be reserved for steampipe.

#### Mod Dependency Management
- Support mods requiring different versions of the same depdency mod. ([#3302](https://github.com/turbot/steampipe/issues/3302))
- Support mods requiring different versions of the same dependency mod. ([#3302](https://github.com/turbot/steampipe/issues/3302))
- Support transitive dependencies referencing variables from different versions of same mod.([#3337](https://github.com/turbot/steampipe/issues/3337))
- Resource references in dependency mods must be fully qualified. ([#3335](https://github.com/turbot/steampipe/issues/3335))
- Locals in dependency mods cannot be referenced. ([#3336](https://github.com/turbot/steampipe/issues/3336))
Expand Down Expand Up @@ -724,7 +724,7 @@ _Bug fixes_
## v0.15.0 [2022-06-23]
_What's new?_
* Add support for Open Telemetry. ([#1193](https://github.com/turbot/steampipe/issues/1193))
* Update `.timing` output to return additional query metadata such as the number of hydrate functions called andd the cache status. ([#2192](https://github.com/turbot/steampipe/issues/2192))
* Update `.timing` output to return additional query metadata such as the number of hydrate functions called and the cache status. ([#2192](https://github.com/turbot/steampipe/issues/2192))
* Add `steampipe_command.scan_metadata` table to support returning additional data from `.timing` command. ([#203](https://github.com/turbot/steampipe-postgres-fdw/issues/203))
* Update postgres config to enable auto-vacuum. ([#2083](https://github.com/turbot/steampipe/issues/2083))
* Add `--show-password` CLI arg to reveal the db user password. Disables password visibility by default. ([#2033](https://github.com/turbot/steampipe/issues/2033))
Expand Down Expand Up @@ -853,7 +853,7 @@ _What's new?_
* Add feedback during workspace load in `dashboard` command. ([#1567](https://github.com/turbot/steampipe/issues/1567))

_Bug fixes_
* Fix excessive memory usage intialising a high number of connections. ([#1656](https://github.com/turbot/steampipe/issues/1656))
* Fix excessive memory usage initialising a high number of connections. ([#1656](https://github.com/turbot/steampipe/issues/1656))
* Fix issue where service was not shut down if command is cancelled during initialisation. ([#1288](https://github.com/turbot/steampipe/issues/1288))
* Fix issue where installing a plugin from any `stream` other than `latest` did not install the default `config` file. ([#1660](https://github.com/turbot/steampipe/issues/1660))
* Fix query argument resolution not working correctly when some args are provided by HCL and some from runtime args. ([#1661](https://github.com/turbot/steampipe/issues/1661))
Expand Down Expand Up @@ -950,7 +950,7 @@ _What's new?_
* Do not show plugin error messages in JSON/CSV output. ([#1110](https://github.com/turbot/steampipe/issues/1110))
* Provider more responsive feedback for control runs. ([#1101](https://github.com/turbot/steampipe/issues/1101))
* Create prepared statements one by one to allow accurate error reporting and reduce memory burden. ([#1148](https://github.com/turbot/steampipe/issues/1148))
* Improve display of asyncronous error in interactive prompt. ([#1085](https://github.com/turbot/steampipe/issues/1085))
* Improve display of asynchronous error in interactive prompt. ([#1085](https://github.com/turbot/steampipe/issues/1085))
* Deprecate `workspace` argument, replace with `workspace-chdir`

_Bug fixes_
Expand Down Expand Up @@ -1039,9 +1039,9 @@ _What's new?_
* Various minor UI tweaks. ([#786](https://github.com/turbot/steampipe/issues/786))

_Bug fixes_
* Fix issue where the `>` prompt disappears when messages are shown from file watcher or asyncronous initialisation. ([#713](https://github.com/turbot/steampipe/issues/713))
* Fix issue where the `>` prompt disappears when messages are shown from file watcher or asynchronous initialisation. ([#713](https://github.com/turbot/steampipe/issues/713))
* Fix errors during async interactive startup leaving the prompt in a bad state. ([#728](https://github.com/turbot/steampipe/issues/728))
* Fix for delay in `loading results` spinner showing, caused by asyncronous initialisation. ([#671](https://github.com/turbot/steampipe/issues/671))
* Fix for delay in `loading results` spinner showing, caused by asynchronous initialisation. ([#671](https://github.com/turbot/steampipe/issues/671))
* Fix for missing `control_description`, `control_title` in `csv` output of `check` command. ([#739](https://github.com/turbot/steampipe/issues/739))
* Fix for `0` exit code even if `service start` fails. ([#762](https://github.com/turbot/steampipe/issues/762))
* Fix issue where configs referring to unavailable plugin will display incorrect error message. ([#796](https://github.com/turbot/steampipe/issues/796))
Expand Down Expand Up @@ -1095,7 +1095,7 @@ _Bug fixes_
* Fixes issue where `STEAMPIPE_INSTALL_DIR` was not being respected. ([#613](https://github.com/turbot/steampipe/issues/613))
* Fix multiple ctrl+C presses causing a crash on control runs. ([#630](https://github.com/turbot/steampipe/issues/630))
* Ensure multiline control errors are rendered in full ([#672](https://github.com/turbot/steampipe/issues/672))
* Fix crash when benchmark has duplicate children. Instead, raise a validaiton failure. ([#667](https://github.com/turbot/steampipe/issues/667))
* Fix crash when benchmark has duplicate children. Instead, raise a validation failure. ([#667](https://github.com/turbot/steampipe/issues/667))
* Fixes issue where `service stop` does not work on `Linux` systems. ([#653](https://github.com/turbot/steampipe/issues/653))
* Plugin schema validation errors should be displayed as warning, and not cause Steampipe to exit. ([#644](https://github.com/turbot/steampipe/issues/644))

Expand Down
2 changes: 1 addition & 1 deletion cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func startServiceAndRefreshConnections(ctx context.Context, listenAddresses []st

if startResult.Status == db_local.ServiceStarted {
// ask the plugin manager to refresh connections
// this is executed asyncronously by the plugin manager
// this is executed asynchronously by the plugin manager
// we ignore this error, since RefreshConnections is async and all errors will flow through
// the notification system
// we do not expect any I/O errors on this since the PluginManager is running in the same box
Expand Down
2 changes: 1 addition & 1 deletion design/adding_to_workspace_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Adding simple properties to `Workspace Profile`

* Add properties to the `WorkspaceProfile` struct in `pkg/steampipeconfig/modconfig/workspace_profile.go`.
* Add `hcl` and `cty` tags to the properties. (eample: `hcl:"search_path" cty:"search_path"`).
* Add `hcl` and `cty` tags to the properties. (example: `hcl:"search_path" cty:"search_path"`).
* Add to `(p *WorkspaceProfile) setBaseProperties()`. This enables `base` profile inheritance. **Remember to check for `nil`**.
* Add to `(p *WorkspaceProfile) ConfigMap(commandName string)`.

Expand Down
2 changes: 1 addition & 1 deletion design/connection_status_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Current behaviour:

Currently this loads the connections.json file
However instead it should load the connections table, joined with the foreign schema list, and identify 'ready' connections.
This is more up to date (the state file is onl written at the end)
This is more up to date (the state file is only written at the end)


## Connection state table
Expand Down
4 changes: 2 additions & 2 deletions design/internal_introspection_tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ to either `ready` or `error`
### Connection config file changed

The when a connection file is changed the ConnectionWatcher calls `pluginManager.OnConnectionConfigChanged`, and then calls
`RefreshConnections` asyncronously
`RefreshConnections` asynchronously

`OnConnectionConfigChanged`calls:
- `handleConnectionConfigChanges`
Expand Down Expand Up @@ -69,7 +69,7 @@ with updated rate limiters.
### Plugin config file changed

The when a connection file is changed the ConnectionWatcher calls `pluginManager.OnConnectionConfigChanged`, and then calls
`RefreshConnections` asyncronously
`RefreshConnections` asynchronously

`OnConnectionConfigChanged` determines which connections have been added, removed and deleted.
It then builds a set of SetConnectionConfigRequest, one for each plugin instance with changed connections
Expand Down
4 changes: 2 additions & 2 deletions design/internal_introspection_tables_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ connection "aws" {

#### On interactive startup:
```
Warning: counld not resolve plugin
Warning: could not resolve plugin
```

#### On file watcher event startup:
```
Warning: counld not resolve plugin
Warning: could not resolve plugin
```

### Actual
Expand Down
6 changes: 3 additions & 3 deletions design/search_path.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Server side search path (the 'steampipe' user search path) is determined accordi

It is set as follows:
- When service is started the user search path is cleared (to avoid a race condition if the config has changed, and a query is executed before the user searhc path is update)
- Post-service-start, RefreshConnections is called asyncronously.
- Post-service-start, RefreshConnections is called asynchronously.
- RefreshConnections sets the required user search path, (determined using the precedence above.)
- It then adds new schemas in the order of the search path

Expand All @@ -21,7 +21,7 @@ Client side search path (the session search path) is determined according to fol
4) The compiled default (public, then alphabetical by connection name)


When a DB session is created, if viper has a setting for either `search_path` ot `search_path_prefix`, the session search path is set (determined using the precedence above.)
When a DB session is created, if viper has a setting for either `search_path` or `search_path_prefix`, the session search path is set (determined using the precedence above.)



Expand Down Expand Up @@ -77,7 +77,7 @@ the updated search path will be reflected in any _new_ Steampipe interactive ses
If an interactive session (or third paty client session) is running, changes to the search path options _will not_ be
reflected in the current session.

### Dasboard Service
### Dashboard Service
If the dashboard service is running, changes to the search path options _will not_ be
reflected until the dashboard service is restarted

Expand Down
2 changes: 1 addition & 1 deletion design/sperr.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ showCaseErr := sperr.Wrap(

```

Outputs of the `showCaseErr` in preceeding program would be:
Outputs of the `showCaseErr` in preceding program would be:

#### `%q`

Expand Down
2 changes: 1 addition & 1 deletion design/steampipe_data_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- `pipes.turbot.com.sptt` - Stores the [Turbot Pipes](https://pipes.turbot.com) token. Deleting the file would require you to run steampipe login again.

- `connection.json` - Stores the connection config information. This file gets re-generated everytime RefreshConnections is called.
- `connection.json` - Stores the connection config information. This file gets re-generated every time RefreshConnections is called.

- `history.json` - Stores the last used queries. Deleting this file would result in losing your history of queries. This file gets re-generated.

Expand Down
2 changes: 1 addition & 1 deletion pkg/connection/connection_state_table_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (u *connectionStateTableUpdater) start(ctx context.Context) error {

var queries []db_common.QueryWithArgs

// update the conection state table to set appropriate state for all connections
// update the connection state table to set appropriate state for all connections
// set updates to "updating"
for name, connectionState := range u.updates.FinalConnectionState {
// set the connection data state based on whether this connection is being created or deleted
Expand Down
4 changes: 2 additions & 2 deletions pkg/connection/connection_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ func (w *ConnectionWatcher) handleFileWatcherEvent([]fsnotify.Event) {
// to use the GlobalConfig here and ignore Workspace Profile in general
cmdconfig.SetDefaultsFromConfig(steampipeconfig.GlobalConfig.ConfigMap())

log.Printf("[INFO] calling RefreshConnections asyncronously")
log.Printf("[INFO] calling RefreshConnections asynchronously")

// call RefreshConnections asyncronously
// call RefreshConnections asynchronously
// the RefreshConnections implements its own locking to ensure only a single execution and a single queues execution
go RefreshConnections(ctx, w.pluginManager)

Expand Down
6 changes: 3 additions & 3 deletions pkg/connection/refresh_connections_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ func (s *refreshConnectionState) executeUpdateQueries(ctx context.Context) {
// this gives any attached interactive clients a chance to update their inspect data and autocomplete
if err := s.pluginManager.SendPostgresSchemaNotification(ctx); err != nil {
// just log
log.Printf("[WARN] failed to send schem update Postgres notification: %s", err.Error())
log.Printf("[WARN] failed to send scheme update Postgres notification: %s", err.Error())
}

if len(remainingUpdates) > 0 {
Expand Down Expand Up @@ -568,7 +568,7 @@ func (s *refreshConnectionState) executeUpdateSetsInParallel(ctx context.Context
return errors
}

// syncronously execute the update queries for one or more connections
// synchronously execute the update queries for one or more connections
func (s *refreshConnectionState) executeUpdateForConnections(ctx context.Context, errChan chan *connectionError, cloneSchemaEnabled bool, connectionStates ...*steampipeconfig.ConnectionState) {
log.Println("[DEBUG] refreshConnectionState.executeUpdateForConnections start")
defer log.Println("[DEBUG] refreshConnectionState.executeUpdateForConnections end")
Expand Down Expand Up @@ -699,7 +699,7 @@ func (s *refreshConnectionState) UpdateCommentsInParallel(ctx context.Context, u
return errors
}

// syncronously execute the comments queries for one or more connections
// synchronously execute the comments queries for one or more connections
func (s *refreshConnectionState) updateCommentsForConnection(ctx context.Context, errChan chan *connectionError, connectionPluginMap map[string]*steampipeconfig.ConnectionPlugin, connectionState *steampipeconfig.ConnectionState) {
log.Printf("[DEBUG] refreshConnectionState.updateCommentsForConnection start for connection '%s'", connectionState.ConnectionName)

Expand Down
2 changes: 1 addition & 1 deletion pkg/connection_sync/wait_for_search_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func WaitForSearchPathSchemas(ctx context.Context, client db_common.Client, sear

_, err = steampipeconfig.LoadConnectionState(ctx, conn.Conn(), steampipeconfig.WithWaitForSearchPath(searchPath))

// NOTE: if we failed to load conection state, this must be because we are connected to an older version of the CLI
// NOTE: if we failed to load connection state, this must be because we are connected to an older version of the CLI
// just return nil error
if db_common.IsRelationNotFoundError(err) {
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_client/db_client_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (c *DbClient) getQueryTiming(ctx context.Context, startTime time.Time, sess
// disable fetching timing information to avoid recursion
c.disableTiming = true

// whatever happens, we need to reenable timing, and send the result back with at least the duration
// whatever happens, we need to re-enable timing, and send the result back with at least the duration
defer func() {
c.disableTiming = false
resultChannel.SetTiming(timingResult)
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_client/db_client_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (c *DbClient) AcquireSession(ctx context.Context) (sessionResult *db_common
session = db_common.NewDBSession(backendPid)
c.sessions[backendPid] = session
}
// we get a new *sql.Conn everytime. USE IT!
// we get a new *sql.Conn every time. USE IT!
session.Connection = databaseConnection
sessionResult.Session = session
c.sessionsMutex.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_common/db_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type DatabaseSession struct {
BackendPid uint32 `json:"backend_pid"`
SearchPath []string `json:"-"`

// this gets rewritten, since the database/sql gives back a new instance everytime
// this gets rewritten, since the database/sql gives back a new instance every time
Connection *pgxpool.Conn `json:"-"`
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_local/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func retainBackup(ctx context.Context) error {
)

if output, err := txtConvertCmd.CombinedOutput(); err != nil {
log.Println("[TRACE] pg_restore convertion process output:", string(output))
log.Println("[TRACE] pg_restore conversion process output:", string(output))
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_local/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func IsDBInstalled() bool {
return true
}

// IsFDWInstalled chceks whether all files required for the Steampipe FDW are available
// IsFDWInstalled checks whether all files required for the Steampipe FDW are available
func IsFDWInstalled() bool {
fdwSQLFile, fdwControlFile := filepaths.GetFDWSQLAndControlLocation()
if _, err := os.Stat(fdwSQLFile); os.IsNotExist(err) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_local/local_db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func GetLocalClient(ctx context.Context, invoker constants.Invoker, opts ...db_c
// NOTE: we cannot do this until after creating the client to ensure we do not miss notifications
if startResult.Status == ServiceStarted {
// ask the plugin manager to refresh connections
// this is executed asyncronously by the plugin manager
// this is executed asynchronously by the plugin manager
// we ignore this error, since RefreshConnections is async and all errors will flow through
// the notification system
// we do not expect any I/O errors on this since the PluginManager is running in the same box
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_local/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/turbot/steampipe/pkg/constants"
)

// SendPostgresNotification send a postgres notification that the schema has chganged
// SendPostgresNotification send a postgres notification that the schema has changed
func SendPostgresNotification(_ context.Context, conn *pgx.Conn, notification any) error {
notificationBytes, err := json.Marshal(notification)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_local/start_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func createCmd(ctx context.Context, port int, listenAddresses []string) *exec.Cm
// log directory
"-c", fmt.Sprintf("log_directory=%s", filepaths.EnsureLogDir()),

// If ssl is off it doesnot matter what we pass in the ssl_cert_file and ssl_key_file
// If ssl is off it doesn't matter what we pass in the ssl_cert_file and ssl_key_file
// SSL will only get validated if ssl is on
"-c", fmt.Sprintf("ssl=%s", sslStatus()),
"-c", fmt.Sprintf("ssl_cert_file=%s", filepaths.GetServerCertLocation()),
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_local/stop_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Postgres has three levels of shutdown:

- SIGTERM - Smart Shutdown : Wait for children to end normally - exit self
- SIGINT - Fast Shutdown : SIGTERM children, causing them to abort current
transations and exit - wait for children to exit -
transactions and exit - wait for children to exit -
exit self
- SIGQUIT - Immediate Shutdown : SIGQUIT children - wait at most 5 seconds,
send SIGKILL to children - exit self immediately
Expand Down
Loading