Linter configuration and linting.
Some checks failed
Linting and tests / Tests (push) Failing after 1m22s
Linting and tests / Linting (push) Failing after 1m32s

This commit is contained in:
2025-09-11 02:30:15 +05:00
parent fbb3733375
commit 71c80799d2
10 changed files with 111 additions and 24 deletions

View File

@@ -163,7 +163,7 @@ func (a *Application) launchStartupTasks() error {
return nil
}
// Shutdown stops application
// Shutdown stops application.
func (a *Application) Shutdown() error {
a.appLogger.Info("Stopping pztrn's Bunker...")

View File

@@ -17,7 +17,7 @@ var (
type Service interface {
// Configure configures service. Called after ConnectDependencies and before LaunchStartupTasks.
Configure() error
// ConnectDependencies gets neccessary dependencies.
// ConnectDependencies gets necessary dependencies.
ConnectDependencies() error
// Initialize initializes service's internal state. Called while registering service with Application
// lifecycle controller.

View File

@@ -41,9 +41,7 @@ func Initialize(app *application.Application) error {
}
func (d *database) Configure() error {
if err := d.configureDBPath(); err != nil {
return fmt.Errorf("configure: %w", err)
}
d.configureDBPath()
db, err := sqlx.Open("sqlite", d.dbPath)
if err != nil {

View File

@@ -4,10 +4,8 @@ import (
"path/filepath"
)
func (d *database) configureDBPath() error {
func (d *database) configureDBPath() {
d.dbPath = filepath.Join(d.app.Fyne().Storage().RootURI().Path(), "database.sqlite3")
d.logger.Info("Database path configured.", "path", d.dbPath)
return nil
}

View File

@@ -14,7 +14,7 @@ func (d *database) Exec(ctx context.Context, query string, params ...interface{}
query = d.db.Rebind(query)
}
d.logger.Debug("Executing query.", "query", query, "params", fmt.Sprintf("%+v", params), "module", "core/database")
d.logger.Debug("Executing query.", "query", query, "params", fmt.Sprintf("%+v", params))
if _, err := d.db.ExecContext(ctx, query, params...); err != nil {
return fmt.Errorf("%w: failed to Exec(): %w", core.ErrDatabase, err)
@@ -29,12 +29,7 @@ func (d *database) Get(ctx context.Context, target interface{}, query string, pa
query = d.db.Rebind(query)
}
d.logger.Debug(
"Getting single data from database with query.",
"query", query,
"params", fmt.Sprintf("%+v", params),
"module", "core/database",
)
d.logger.Debug("Getting single data from database with query.", "query", query, "params", fmt.Sprintf("%+v", params))
if err := d.db.GetContext(ctx, target, query, params...); err != nil {
return fmt.Errorf("%w: failed to Get(): %w", core.ErrDatabase, err)
@@ -49,7 +44,7 @@ func (d *database) NamedExec(ctx context.Context, query string, param interface{
query = d.db.Rebind(query)
}
d.logger.Debug("Executing named query.", "query", query, "params", fmt.Sprintf("%+v", param), "module", "core/database")
d.logger.Debug("Executing named query.", "query", query, "params", fmt.Sprintf("%+v", param))
if _, err := d.db.NamedExecContext(ctx, query, param); err != nil {
return fmt.Errorf("%w: failed to NamedExec(): %w", core.ErrDatabase, err)
@@ -64,12 +59,7 @@ func (d *database) Select(ctx context.Context, target interface{}, query string,
query = d.db.Rebind(query)
}
d.logger.Debug(
"Selecting from database with query.",
"query", query,
"params", fmt.Sprintf("%+v", params),
"module", "core/database",
)
d.logger.Debug("Selecting from database with query.", "query", query, "params", fmt.Sprintf("%+v", params))
if err := d.db.SelectContext(ctx, target, query, params...); err != nil {
return fmt.Errorf("%w: failed to Select(): %w", core.ErrDatabase, err)

View File

@@ -54,7 +54,7 @@ func (m *mainWindow) generateSysInfoTab() *container.TabItem {
for {
//nolint:mnd
if memoryTotal > 1024 {
memoryTotal = memoryTotal / 1024
memoryTotal /= 1024
memoryTotalDivCount++
continue
@@ -81,7 +81,7 @@ func (m *mainWindow) generateSysInfoTab() *container.TabItem {
//nolint:mnd
for {
if memoryFree > 1024 {
memoryFree = memoryFree / 1024
memoryFree /= 1024
memoryFreeDivCount++
continue