Skip to content

Commit 64b2ff4

Browse files
committed
fix: improve type hints and variable naming in init command
1. Use Optional[HelmValuesConfig] for better type safety 2. Rename local config variable to new_config to avoid shadowing 3. Add missing typing import This change improves code quality by: - Using proper type hints for better IDE support - Avoiding variable shadowing for better readability - Following Python type hinting best practices
1 parent 8b8b818 commit 64b2ff4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

helm_values_manager/commands/init_command.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Command to initialize a new helm-values configuration."""
22

33
import os
4+
from typing import Optional
45

56
from helm_values_manager.commands.base_command import BaseCommand
67
from helm_values_manager.models.helm_values_config import HelmValuesConfig
@@ -15,7 +16,7 @@ def __init__(self) -> None:
1516
super().__init__()
1617
self.skip_config_load = True
1718

18-
def run(self, config: None = None, **kwargs) -> str:
19+
def run(self, config: Optional[HelmValuesConfig] = None, **kwargs) -> str:
1920
"""
2021
Initialize a new helm-values configuration.
2122
@@ -40,12 +41,12 @@ def run(self, config: None = None, **kwargs) -> str:
4041
raise FileExistsError(f"Configuration file {self.config_file} already exists")
4142

4243
# Create new config
43-
config = HelmValuesConfig()
44-
config.version = "1.0"
45-
config.release = release_name
44+
new_config = HelmValuesConfig()
45+
new_config.version = "1.0"
46+
new_config.release = release_name
4647

4748
# Save config
48-
self.save_config(config)
49+
self.save_config(new_config)
4950

5051
HelmLogger.debug("Initialized helm-values configuration for release: %s", release_name)
5152
return "Successfully initialized helm-values configuration."

0 commit comments

Comments
 (0)