Skip to content

Commit cef145b

Browse files
committed
♻️ refactor: cleared lints
1 parent 5656db1 commit cef145b

62 files changed

Lines changed: 279 additions & 226 deletions

Some content is hidden

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

internal/adapters/primary/cli/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/spf13/cobra"
66
)
77

8-
// RegisterConfigCommand registers the config command
8+
// RegisterConfigCommand registers the config command.
99
func RegisterConfigCommand(root *cobra.Command) {
1010
configCmd := &cobra.Command{
1111
Use: "config",

internal/adapters/primary/cli/config/delphi.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import (
1515
"github.com/spf13/cobra"
1616
)
1717

18-
// delphiCmd registers the delphi command
18+
// delphiCmd registers the delphi command.
1919
func delphiCmd(root *cobra.Command) {
2020
delphiCmd := &cobra.Command{
2121
Use: "delphi",
2222
Short: "Configure Delphi version",
2323
Long: `Configure Delphi version to compile modules`,
24-
Run: func(cmd *cobra.Command, _ []string) {
24+
Run: func(_ *cobra.Command, _ []string) {
2525
selectDelphiInteractive()
2626
},
2727
}
@@ -56,7 +56,7 @@ func delphiCmd(root *cobra.Command) {
5656
delphiCmd.AddCommand(use)
5757
}
5858

59-
// selectDelphiInteractive selects the delphi version interactively
59+
// selectDelphiInteractive selects the delphi version interactively.
6060
func selectDelphiInteractive() {
6161
installations := registryadapter.GetDetectedDelphis()
6262
if len(installations) == 0 {
@@ -114,7 +114,7 @@ func selectDelphiInteractive() {
114114
msg.Info(" Path: %s", config.DelphiPath)
115115
}
116116

117-
// listDelphiVersions lists the delphi versions
117+
// listDelphiVersions lists the delphi versions.
118118
func listDelphiVersions() {
119119
installations := registryadapter.GetDetectedDelphis()
120120
if len(installations) == 0 {
@@ -135,6 +135,8 @@ func listDelphiVersions() {
135135
}
136136

137137
// useDelphiVersion uses the delphi version
138+
//
139+
//nolint:gocognit,nestif // Complex Delphi version selection logic
138140
func useDelphiVersion(pathOrIndex string) {
139141
config := env.GlobalConfiguration()
140142
installations := registryadapter.GetDetectedDelphis()
@@ -165,7 +167,6 @@ func useDelphiVersion(pathOrIndex string) {
165167
} else {
166168
found := false
167169
for _, inst := range installations {
168-
169170
if inst.Version == pathOrIndex {
170171
config.DelphiPath = filepath.Dir(inst.Path)
171172
found = true

internal/adapters/primary/cli/config/git.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/spf13/cobra"
1010
)
1111

12-
// boolToMode converts boolean to mode string
12+
// boolToMode converts boolean to mode string.
1313
func boolToMode(embedded bool) string {
1414
if embedded {
1515
return "embedded"
@@ -18,7 +18,7 @@ func boolToMode(embedded bool) string {
1818
return "native"
1919
}
2020

21-
// registryGitCmd registers the git command
21+
// registryGitCmd registers the git command.
2222
func registryGitCmd(root *cobra.Command) {
2323
gitCmd := &cobra.Command{
2424
Use: "git",

internal/adapters/primary/cli/config/purgeCache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/spf13/cobra"
1414
)
1515

16-
// RegisterCmd registers the cache command
16+
// RegisterCmd registers the cache command.
1717
func RegisterCmd(cmd *cobra.Command) {
1818
purgeCacheCmd := &cobra.Command{
1919
Use: "cache",
@@ -35,14 +35,14 @@ func RegisterCmd(cmd *cobra.Command) {
3535
cmd.AddCommand(purgeCacheCmd)
3636
}
3737

38-
// removeCacheWithConfirmation removes the cache with confirmation
38+
// removeCacheWithConfirmation removes the cache with confirmation.
3939
func removeCacheWithConfirmation() error {
4040
modulesDir := env.GetModulesDir()
4141

4242
var totalSize int64
4343
err := filepath.Walk(modulesDir, func(_ string, info os.FileInfo, err error) error {
4444
if err != nil {
45-
return nil
45+
return err
4646
}
4747
if !info.IsDir() {
4848
totalSize += info.Size()
@@ -82,7 +82,7 @@ func removeCacheWithConfirmation() error {
8282
return gc.RunGC(true)
8383
}
8484

85-
// formatBytes formats bytes to string
85+
// formatBytes formats bytes to string.
8686
func formatBytes(bytes int64) string {
8787
const unit = 1024
8888
if bytes < unit {

internal/adapters/primary/cli/dependencies.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
branchOutdated
2929
)
3030

31-
// dependenciesCmdRegister registers the dependencies command
31+
// dependenciesCmdRegister registers the dependencies command.
3232
func dependenciesCmdRegister(root *cobra.Command) {
3333
var showVersion bool
3434

@@ -57,7 +57,7 @@ func dependenciesCmdRegister(root *cobra.Command) {
5757
dependenciesCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "show dependency version")
5858
}
5959

60-
// printDependencies prints the dependencies
60+
// printDependencies prints the dependencies.
6161
func printDependencies(showVersion bool) {
6262
var tree = treeprint.New()
6363
pkg, err := pkgmanager.LoadPackage()
@@ -75,7 +75,7 @@ func printDependencies(showVersion bool) {
7575
msg.Info(tree.String())
7676
}
7777

78-
// printDeps prints the dependencies recursively
78+
// printDeps prints the dependencies recursively.
7979
func printDeps(dep *domain.Dependency,
8080
deps []domain.Dependency,
8181
lock domain.PackageLock,
@@ -100,7 +100,7 @@ func printDeps(dep *domain.Dependency,
100100
}
101101
}
102102

103-
// printSingleDependency prints a single dependency
103+
// printSingleDependency prints a single dependency.
104104
func printSingleDependency(
105105
dep *domain.Dependency,
106106
lock domain.PackageLock,
@@ -129,7 +129,7 @@ func printSingleDependency(
129129
return tree.AddBranch(output)
130130
}
131131

132-
// isOutdated checks if the dependency is outdated
132+
// isOutdated checks if the dependency is outdated.
133133
func isOutdated(dependency domain.Dependency, version string) (dependencyStatus, string) {
134134
if err := installer.GetDependency(dependency); err != nil {
135135
return updated, ""

internal/adapters/primary/cli/init.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
var reFolderName = regexp.MustCompile(`^.+` + regexp.QuoteMeta(string(filepath.Separator)) + `([^\\]+)$`)
1818

19-
// initCmdRegister registers the init command
19+
// initCmdRegister registers the init command.
2020
func initCmdRegister(root *cobra.Command) {
2121
var quiet bool
2222

@@ -39,7 +39,7 @@ func initCmdRegister(root *cobra.Command) {
3939
root.AddCommand(initCmd)
4040
}
4141

42-
// doInitialization initializes the project
42+
// doInitialization initializes the project.
4343
func doInitialization(quiet bool) {
4444
if !quiet {
4545
printHead()
@@ -69,14 +69,14 @@ func doInitialization(quiet bool) {
6969
msg.Die("Failed to save package: %v", err)
7070
}
7171

72-
jsonData, err := json.MarshalIndent(packageData, "", " ")
73-
if err != nil {
74-
msg.Die("Failed to marshal package: %v", err)
72+
jsonData, errMarshal := json.MarshalIndent(packageData, "", " ")
73+
if errMarshal != nil {
74+
msg.Die("Failed to marshal package: %v", errMarshal)
7575
}
7676
msg.Info("\n" + string(jsonData))
7777
}
7878

79-
// getParamOrDef gets the parameter or default value
79+
// getParamOrDef gets the parameter or default value.
8080
func getParamOrDef(msg string, def ...string) string {
8181
input := &pterm.DefaultInteractiveTextInput
8282

@@ -89,7 +89,7 @@ func getParamOrDef(msg string, def ...string) string {
8989
return result
9090
}
9191

92-
// printHead prints the head message
92+
// printHead prints the head message.
9393
func printHead() {
9494
msg.Info(`
9595
This utility will walk you through creating a boss.json file.

internal/adapters/primary/cli/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
// installCmdRegister registers the install command
9+
// installCmdRegister registers the install command.
1010
func installCmdRegister(root *cobra.Command) {
1111
var noSaveInstall bool
1212
var compilerVersion string

internal/adapters/primary/cli/login.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/spf13/cobra"
1212
)
1313

14-
// loginCmdRegister registers the login command
14+
// loginCmdRegister registers the login command.
1515
func loginCmdRegister(root *cobra.Command) {
1616
var removeLogin bool
1717
var useSSH bool
@@ -50,7 +50,7 @@ func loginCmdRegister(root *cobra.Command) {
5050
root.AddCommand(logoutCmd)
5151
}
5252

53-
// login logs in the user
53+
// login logs in the user.
5454
func login(removeLogin bool, useSSH bool, privateKey string, userName string, password string, args []string) {
5555
configuration := env.GlobalConfiguration()
5656

@@ -87,7 +87,7 @@ func login(removeLogin bool, useSSH bool, privateKey string, userName string, pa
8787
configuration.SaveConfiguration()
8888
}
8989

90-
// setAuthWithParams sets the authentication with parameters
90+
// setAuthWithParams sets the authentication with parameters.
9191
func setAuthWithParams(auth *env.Auth, useSSH bool, privateKey, userName, password string) {
9292
auth.UseSSH = useSSH
9393
if auth.UseSSH || (privateKey != "") {
@@ -100,7 +100,7 @@ func setAuthWithParams(auth *env.Auth, useSSH bool, privateKey, userName, passwo
100100
}
101101
}
102102

103-
// setAuthInteractively sets the authentication interactively
103+
// setAuthInteractively sets the authentication interactively.
104104
func setAuthInteractively(auth *env.Auth) {
105105
authMethods := []string{"SSH Key", "Username/Password"}
106106
selectedMethod, err := pterm.DefaultInteractiveSelect.
@@ -123,7 +123,7 @@ func setAuthInteractively(auth *env.Auth) {
123123
}
124124
}
125125

126-
// getPass gets the password
126+
// getPass gets the password.
127127
func getPass(description string) string {
128128
pass, err := pterm.DefaultInteractiveTextInput.WithMask("•").Show(description)
129129
if err != nil {
@@ -132,7 +132,7 @@ func getPass(description string) string {
132132
return pass
133133
}
134134

135-
// getSSHKeyPath gets the ssh key path
135+
// getSSHKeyPath gets the ssh key path.
136136
func getSSHKeyPath() string {
137137
usr, err := user.Current()
138138
if err != nil {

internal/adapters/primary/cli/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9-
// runCmdRegister registers the run command
9+
// runCmdRegister registers the run command.
1010
func runCmdRegister(root *cobra.Command) {
1111
var runScript = &cobra.Command{
1212
Use: "run",

internal/adapters/primary/cli/uninstall.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/spf13/cobra"
1313
)
1414

15-
// uninstallCmdRegister registers the uninstall command
15+
// uninstallCmdRegister registers the uninstall command.
1616
func uninstallCmdRegister(root *cobra.Command) {
1717
var noSaveUninstall bool
1818
var selectMode bool
@@ -49,7 +49,7 @@ func uninstallCmdRegister(root *cobra.Command) {
4949
uninstallCmd.Flags().BoolVarP(&selectMode, "select", "s", false, "select dependencies to uninstall")
5050
}
5151

52-
// uninstallWithSelect uninstalls the selected dependencies
52+
// uninstallWithSelect uninstalls the selected dependencies.
5353
func uninstallWithSelect(noSave bool) {
5454
pkg, err := pkgmanager.LoadPackage()
5555
if err != nil {

0 commit comments

Comments
 (0)