Skip to content

bug: gaze crap --analyzer fails with 'no go.mod found' for non-Go projects #250

Description

@jflowers

Problem

gaze crap --analyzer snake-eyes --language python . fails immediately with:

Error: no go.mod found

Root Cause

In cmd/gaze/main.go, line ~929, runCrap calls loader.FindModuleRoot() unconditionally before checking the --analyzer flag. For non-Go projects (Python, TypeScript, etc.), there is no go.mod, causing an immediate failure before the external analyzer path is ever reached.

Correct Pattern

gaze quality handles this correctly — it defers module resolution until after checking --analyzer, and when an external analyzer is set, it uses os.Getwd() instead of FindModuleRoot(). See runQualityWithExternalAnalyzer in PR #242.

Reproduction

# In any Python project with snake-eyes installed:
gaze crap --analyzer snake-eyes --language python .
# => Error: no go.mod found

# Compare with quality, which works:
gaze quality --analyzer snake-eyes --language python .
# => Runs successfully

Proposed Fix

Follow the same pattern as runQualityWithExternalAnalyzer: check for --analyzer before calling loader.FindModuleRoot(). When an external analyzer is set, use os.Getwd() for the module directory and skip Go-specific module resolution.

Impact

HIGH — gaze crap is completely unusable with external analyzers for non-Go projects. This blocks the primary CRAP score use case for language analyzers like snake-eyes.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions