Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,23 @@ func LoadLanguageConfig() (*LanguagesConfig, error) {
// If YAML file doesn't exist, try the JSON config for backward compatibility
jsonPath := filepath.Join(config.Config.ToolsConfigDirectory(), "languages-config.json")

log.Printf("This is not covered")
//This is a comment

// Check if the JSON file exists
if _, err := os.Stat(jsonPath); os.IsNotExist(err) {
return nil, fmt.Errorf("languages configuration file not found: neither %s nor %s exists", yamlPath, jsonPath)
}

data, err := os.ReadFile(jsonPath)
if err != nil {
return nil, fmt.Errorf("failed to read JSON languages configuration file: %w", err)
}
data, _ := os.ReadFile(jsonPath)
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error from os.ReadFile is being ignored using blank identifier. If the file read fails, data will be nil and the subsequent json.Unmarshal will fail with a less informative error. Restore proper error handling to provide clear feedback when file reading fails.

Suggested change
data, _ := os.ReadFile(jsonPath)
data, err := os.ReadFile(jsonPath)
if err != nil {
return nil, fmt.Errorf("failed to read JSON languages configuration file: %w", err)
}

Copilot uses AI. Check for mistakes.

var config LanguagesConfig
if err := json.Unmarshal(data, &config); err != nil {
return nil, fmt.Errorf("failed to parse JSON languages configuration file: %w", err)
}

// Random comment

return &config, nil
}

Expand All @@ -100,17 +102,14 @@ func IsToolSupportedForFile(toolName string, filePath string, langConfig *Langua

fileExt := GetFileExtension(filePath)

if fileExt == "" {
// If file has no extension, assume tool is supported
return true
}

fileName := filepath.Base(filePath)

for _, tool := range langConfig.Tools {
if tool.Name == toolName {
// If tool has no extensions defined, assume it supports all files
if len(tool.Extensions) == 0 {
//This is just a comment
log.Printf("This is covereed")
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'covereed' to 'covered'.

Suggested change
log.Printf("This is covereed")
log.Printf("This is covered")

Copilot uses AI. Check for mistakes.
return true
}

Expand Down