Skip to content

Commit 76d19d2

Browse files
fix: additional linting issues and code formatting
- Format all Go files with gofmt -s - Fix remaining unused parameter warnings - Convert single-case switch to if statement in app/root.go - Convert if-else chain to switch statement in app/app.go - Fix remaining unchecked error returns in tests
1 parent 71ef2e6 commit 76d19d2

File tree

18 files changed

+4323
-4323
lines changed

18 files changed

+4323
-4323
lines changed

app/app.go

Lines changed: 82 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,82 @@
1-
package app
2-
3-
import (
4-
"os"
5-
"path/filepath"
6-
7-
tea "github.com/charmbracelet/bubbletea"
8-
9-
"aura/config"
10-
"aura/models"
11-
"aura/ui"
12-
)
13-
14-
type App struct {
15-
program *tea.Program
16-
config *config.Config
17-
currentDir string
18-
state models.AppState
19-
}
20-
21-
func NewApp() (*App, error) {
22-
cfg, err := config.LoadConfig()
23-
if err != nil {
24-
return nil, err
25-
}
26-
27-
currentDir, err := os.Getwd()
28-
if err != nil {
29-
return nil, err
30-
}
31-
32-
currentDir, err = filepath.Abs(currentDir)
33-
if err != nil {
34-
return nil, err
35-
}
36-
37-
app := &App{
38-
config: cfg,
39-
currentDir: currentDir,
40-
state: models.AppState{
41-
CurrentDir: currentDir,
42-
Config: cfg,
43-
TrustedDir: cfg.IsTrustedDir(currentDir),
44-
},
45-
}
46-
47-
var initialModel tea.Model
48-
// Check if configuration is complete (has API key)
49-
if cfg.APIKey == "" || cfg.LLMProvider == "" {
50-
app.state.Screen = models.Configuration
51-
initialModel = ui.NewConfigModel(currentDir)
52-
} else if app.state.TrustedDir {
53-
app.state.Screen = models.Welcome
54-
initialModel = ui.NewWelcomeModel(currentDir)
55-
} else {
56-
app.state.Screen = models.SecurityPrompt
57-
initialModel = ui.NewSecurityPromptModel(currentDir)
58-
}
59-
60-
rootModel := NewRootModel(initialModel, app)
61-
app.program = tea.NewProgram(rootModel, tea.WithAltScreen())
62-
63-
return app, nil
64-
}
65-
66-
func (a *App) Run() error {
67-
_, err := a.program.Run()
68-
return err
69-
}
70-
71-
func (a *App) GetConfig() *config.Config {
72-
return a.config
73-
}
74-
75-
func (a *App) GetCurrentDir() string {
76-
return a.currentDir
77-
}
78-
79-
func (a *App) AddTrustedDir(dir string) error {
80-
return a.config.AddTrustedDir(dir)
81-
}
1+
package app
2+
3+
import (
4+
"os"
5+
"path/filepath"
6+
7+
tea "github.com/charmbracelet/bubbletea"
8+
9+
"aura/config"
10+
"aura/models"
11+
"aura/ui"
12+
)
13+
14+
type App struct {
15+
program *tea.Program
16+
config *config.Config
17+
currentDir string
18+
state models.AppState
19+
}
20+
21+
func NewApp() (*App, error) {
22+
cfg, err := config.LoadConfig()
23+
if err != nil {
24+
return nil, err
25+
}
26+
27+
currentDir, err := os.Getwd()
28+
if err != nil {
29+
return nil, err
30+
}
31+
32+
currentDir, err = filepath.Abs(currentDir)
33+
if err != nil {
34+
return nil, err
35+
}
36+
37+
app := &App{
38+
config: cfg,
39+
currentDir: currentDir,
40+
state: models.AppState{
41+
CurrentDir: currentDir,
42+
Config: cfg,
43+
TrustedDir: cfg.IsTrustedDir(currentDir),
44+
},
45+
}
46+
47+
var initialModel tea.Model
48+
// Check if configuration is complete (has API key)
49+
switch {
50+
case cfg.APIKey == "" || cfg.LLMProvider == "":
51+
app.state.Screen = models.Configuration
52+
initialModel = ui.NewConfigModel(currentDir)
53+
case app.state.TrustedDir:
54+
app.state.Screen = models.Welcome
55+
initialModel = ui.NewWelcomeModel(currentDir)
56+
default:
57+
app.state.Screen = models.SecurityPrompt
58+
initialModel = ui.NewSecurityPromptModel(currentDir)
59+
}
60+
61+
rootModel := NewRootModel(initialModel, app)
62+
app.program = tea.NewProgram(rootModel, tea.WithAltScreen())
63+
64+
return app, nil
65+
}
66+
67+
func (a *App) Run() error {
68+
_, err := a.program.Run()
69+
return err
70+
}
71+
72+
func (a *App) GetConfig() *config.Config {
73+
return a.config
74+
}
75+
76+
func (a *App) GetCurrentDir() string {
77+
return a.currentDir
78+
}
79+
80+
func (a *App) AddTrustedDir(dir string) error {
81+
return a.config.AddTrustedDir(dir)
82+
}

0 commit comments

Comments
 (0)