Skip to content

Commit

Permalink
chore: fix typos and style
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoVeille authored and Roemer committed Jun 1, 2024
1 parent 9d4a017 commit 57641ed
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
gotaskr (Go-Task-Runner) is a generic task runner which is invoked via CLI.

The tasks are written in plain Go and can easily be called from the CLI.
This is especially usefull for tasks in the CI.
This is especially useful for tasks in the CI.

The tasks can be chained and in the end, there is a statistic about
the tasks that were executed and their runtime.
Expand All @@ -29,7 +29,7 @@ There are some inbuilt helpers for often used things for various DevOps tasks.
- Even works in existing go repositories (see [build](build) from this repository as an example)

## Visual Studio Code Extension
gotaskr has a corresponding Visual Studio Code extension that allows easily running or even debugging tasks directly from Visual Studio Code. It also allows to add arguments when running or debugging them.
gotaskr has a corresponding Visual Studio Code extension that allows easily running or even debugging tasks directly from Visual Studio Code. It also allows adding arguments when running or debugging them.

Example:

Expand Down
2 changes: 1 addition & 1 deletion execr/execr.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package execr is a wapper to run exec commands.
// Package execr is a wrapper to run exec commands.
package execr

import (
Expand Down
4 changes: 2 additions & 2 deletions goext/goext.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Ternary[T any](cond bool, vtrue, vfalse T) T {
return vfalse
}

// Printfln allows to use Printf and Println in one call.
// Printfln allows using Printf and Println in one call.
func Printfln(format string, a ...any) (n int, err error) {
text := fmt.Sprintf(format, a...)
return fmt.Println(text)
Expand All @@ -33,7 +33,7 @@ func Noop() error {
}

// Pass is a no-op function that can be used to set variables to used.
// Usefull during development but must be removed afterwards!
// Useful during development but must be removed afterwards!
func Pass(i ...interface{}) {
// No-Op
}
8 changes: 4 additions & 4 deletions goext/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type RunOption interface {
revert() error
}

// Runs a given method with addiitional options.
// Runs a given method with additional options.
func RunWithOptions(f func() error, options ...RunOption) (err error) {
// Apply the options
for _, option := range options {
Expand All @@ -34,7 +34,7 @@ func RunWithOptions(f func() error, options ...RunOption) (err error) {
return
}

// Runs a given method with returns one parameter with addiitional options.
// Runs a given method with returns one parameter with additional options.
func RunWithOptions1P[P1 any](f func() (P1, error), options ...RunOption) (P1, error) {
var p1 P1
return p1, RunWithOptions(func() error {
Expand All @@ -44,7 +44,7 @@ func RunWithOptions1P[P1 any](f func() (P1, error), options ...RunOption) (P1, e
}, options...)
}

// Runs a given method with returns two parameters with addiitional options.
// Runs a given method with returns two parameters with additional options.
func RunWithOptions2P[P1 any, P2 any](f func() (P1, P2, error), options ...RunOption) (P1, P2, error) {
var p1 P1
var p2 P2
Expand All @@ -55,7 +55,7 @@ func RunWithOptions2P[P1 any, P2 any](f func() (P1, P2, error), options ...RunOp
}, options...)
}

// Runs a given method with returns three parameters with addiitional options.
// Runs a given method with returns three parameters with additional options.
func RunWithOptions3P[P1 any, P2 any, P3 any](f func() (P1, P2, P3, error), options ...RunOption) (P1, P2, P3, error) {
var p1 P1
var p2 P2
Expand Down
2 changes: 1 addition & 1 deletion goext/slice_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func AppendIf[T any](slice []T, cond bool, values ...T) []T {
return slice
}

// Appends the given value if the condition is fulfilled. Calculates the value to add only if the condition is fulfulled.
// Appends the given value if the condition is fulfilled. Calculates the value to add only if the condition is fulfilled.
func AppendIfFunc[T any](slice []T, cond bool, f func() []T) []T {
if cond {
values := f()
Expand Down
16 changes: 8 additions & 8 deletions gotaskr.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var argumentsMap = argparse.ParseArgs()
// Prepare a map for all the task objects
var taskMap map[string]*TaskObject = make(map[string]*TaskObject)

// Prepare a list of the task names. Used to print the tasks in order
// Prepare a list of the task names. Used to print the tasks in order.
var taskList []string

// Prepare an array for the tasks that were run (in run order)
Expand Down Expand Up @@ -118,7 +118,7 @@ func Execute() int {
log.Information()
printTaskRuns()

// If the teardown failed but nothing else, still fail with the teardowns error
// If the teardown failed but nothing else, still fail with the teardown error
if teardownErr != nil && exitCode == 0 {
exitCode = getExitCodeFromError(teardownErr)
}
Expand All @@ -143,7 +143,7 @@ func GetArgumentOrDefault(argName string, defaultValue string) (string, bool) {
return defaultValue, false
}

// HasArgument returns true if an arument was set and false otherwise, regardless of the value.
// HasArgument returns true if an argument was set and false otherwise, regardless of the value.
func HasArgument(argName string) bool {
_, exist := GetArgument(argName)
return exist
Expand Down Expand Up @@ -215,7 +215,7 @@ func RunTarget(target string) error {
// Run the task teardown method
teardownErr := runLifetimeFunc("TaskTeardown", context.TaskTeardownFunc)

// If the teardown failed but nothing else, still fail with the teardowns error
// If the teardown failed but nothing else, still fail with the teardown error
if teardownErr != nil && taskErr == nil {
return teardownErr
}
Expand Down Expand Up @@ -251,7 +251,7 @@ func runLifetimeFunc(lifetimeStage string, function func() error) error {
log.Informationf("--- %s %s", lifetimeStage, strings.Repeat("-", 60-5-len(lifetimeStage)))
err := runFuncRecover(function)
if err != nil {
log.Informationf("Error occured: %v", err)
log.Informationf("Error occurred: %v", err)
return err
}
return nil
Expand Down Expand Up @@ -322,10 +322,10 @@ type TaskObject struct {
description string // The description of the task.
arguments []argument // The arguments of the task.
taskFunc func() error // The function of the task.
dependencies []string // A list of dependecy tasks.
dependencies []string // A list of dependency tasks.
dependees []string // A list of dependee tasks.
followups []string // A list of followup tasks.
continueOnError bool // A flag to incdicate if the run should continue when an error occured.
continueOnError bool // A flag to indicate if the run should continue when an error occurred.
deferOnError bool // A flag to indicate if the error should be deferred until the end.
didRun bool // A flag to indicate if the task did already run.
duration time.Duration // A runtime duration of the task if it ran already.
Expand Down Expand Up @@ -441,7 +441,7 @@ func (taskObject *TaskObject) Argument(argumentName string, argumentDescription
return taskObject
}

// AddFollowupTask allows to add one or more tasks that should run after the current finished.
// AddFollowupTask allows adding one or more tasks that should run after the current finished.
func AddFollowupTask(taskName ...string) {
currentRunningTask.Then(taskName...)
}
Expand Down
10 changes: 5 additions & 5 deletions gttools/cypress.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type CypressRunSettings struct {
Browser string // defines the browser to launch like chrome, chromium, edge, electron, firefox. Alternatively a path to an executable.
CiBuildId string // the unique id to group tests together.
Component bool // flag to define if component tests should run.
Config string // specify the config to use. Defined as key value pairs, comma separated. Can alsop be a stringified json object.
Config string // specify the config to use. Defined as key value pairs, comma separated. Can also be a stringified json object.
ConfigFile string // the path to a config file to use.
E2e bool // flag to define if end to end tests should run (default).
Env map[string]string // environment variables to use.
Expand All @@ -44,7 +44,7 @@ type CypressRunSettings struct {
Port int // override the default port.
Project string // the path to a specific project to run.
Quiet bool // flag to indicate the quite mode where no output is passed to stdout.
Record bool // flag to indicate if the tests shouldbe recorded or not.
Record bool // flag to indicate if the tests should be recorded or not.
Reporter string // define the reporter to use. Can be any of the mocha, cypress or a custom reporter.
ReporterOptions string // specify the reporter options to use as key value pairs, comma separated. Can also be a stringified json object.
Specs []string // define the spec file(s) to run.
Expand All @@ -57,7 +57,7 @@ type CypressOpenSettings struct {
ToolSettingsBase
Browser string // defines the browser to launch like chrome, chromium, edge, electron, firefox. Alternatively a path to an executable.
Component bool // flag to define if component tests should run.
Config string // specify the config to use. Defined as key value pairs, comma separated. Can alsop be a stringified json object.
Config string // specify the config to use. Defined as key value pairs, comma separated. Can also be a stringified json object.
ConfigFile string // the path to a config file to use.
Detached bool // flag to define if Cypress should open in detached mode.
E2e bool // flag to define if end to end tests should run (default).
Expand Down Expand Up @@ -87,15 +87,15 @@ func (settings *CypressRunSettings) AddSpecs(specs ...string) *CypressRunSetting
return settings
}

// AddTags adds one or more tagst to the Cypress settings.
// AddTags adds one or more tags to the Cypress settings.
func (settings *CypressRunSettings) AddTags(tags ...string) *CypressRunSettings {
for _, entry := range tags {
settings.Tags = goext.AppendIfMissing(settings.Tags, entry)
}
return settings
}

// CypressRun allows you to run Cypress with a defined binary. Usefull for example when using cy2.
// CypressRun allows you to run Cypress with a defined binary. Useful for example when using cy2.
func (tool *CypressTool) CypressRun(cypressBinPath string, settings *CypressRunSettings) error {
return cypressExecute(cypressBinPath, settings.buildCliArguments(), settings.ToolSettingsBase)
}
Expand Down
2 changes: 1 addition & 1 deletion gttools/devcontainer_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ type DevContainerCliFeaturesPublishSettings struct {
Target string
// Name of the OCI registry.
Registry string
// Unique indentifier for the collection of features.
// Unique identifier for the collection of features.
Namespace string
// Log level.
LogLevel DevContainerCliLogLevel
Expand Down
6 changes: 3 additions & 3 deletions gttools/flyway.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type FlywaySettings struct {
FailOnMissingLocations *bool
// At the start of a migration, Flyway will attempt to take a lock to prevent competing instances executing in parallel.
LockRetryCount *int
// Allows you to override Flyway's logging auto-detection and specify one or multiple loggers to use.
// Allows you to override Flyway's logging autodetection and specify one or multiple loggers to use.
Loggers []FlywayLogger
// Whether to allow mixing transactional and non-transactional statements within the same migration.
Mixed *bool
Expand All @@ -82,7 +82,7 @@ type FlywaySettings struct {
WorkingDirectory string

//// Schema
// Whether Flyway should attempt to create the schemas specified in the schemas property.
// Whether Flyway should attempt to create the schemas specified in the schemas' property.
CreateSchemas *bool
// The default schema managed by Flyway.
DefaultSchema string
Expand Down Expand Up @@ -138,7 +138,7 @@ type FlywaySettings struct {
OutputType FlywayOutputType

//// PostgreSQL
// Whether or not transactional advisory locks should be used with PostgreSQL.
// Whether transactional advisory locks should be used with PostgreSQL.
PostgresqlTransactionalLock *bool
}

Expand Down
2 changes: 1 addition & 1 deletion gttools/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func CreateGitLabTool() *GitLabTool {
}

// GitLabReport defines the data for the quality report for GitLab.
// See https://docs.gitlab.com/ee/ci/testing/code_quality.html#implementing-a-custom-tool for details
// See https://docs.gitlab.com/ee/ci/testing/code_quality.html#implementing-a-custom-tool for details.
type GitLabReport struct {
Entries []*GitLabCodeQualityEntry
}
Expand Down
2 changes: 1 addition & 1 deletion gttools/gttools.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func CreateToolsClient() *ToolsClient {
}
}

// ToolSettingsBase are common settings usefull for all tools that run executables.
// ToolSettingsBase are common settings useful for all tools that run executables.
type ToolSettingsBase struct {
WorkingDirectory string // the path to use as working directory when running the tool
OutputToConsole bool // flag to define if the output of the tool should be written into the console or not.
Expand Down
2 changes: 1 addition & 1 deletion gttools/nx.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ type NxShowProjectsSettings struct {
WithTarget string // Show only projects that have a specific target.
}

// ShowProjects returns projects according to the given criterias.
// ShowProjects returns projects according to the given criteria.
func (tool *NxTool) ShowProjects(runType NxRunType, settings NxShowProjectsSettings) ([]string, error) {
args := []string{"projects"}
args = goext.AppendIf(args, settings.Affected, "--affected")
Expand Down

0 comments on commit 57641ed

Please sign in to comment.