Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions src/agentready/assessors/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,17 @@ def _assess_go_coverage(self, repository: Repository) -> Finding:

text_sources = self._read_go_build_files(repository)

has_test_cmd = bool(re.search(r"(?:\bgo|\$\(GO\))\s+test\b", text_sources))
has_test_cmd = bool(
re.search(
r"(?:\bgo|\$\(GO\))\s+test\b|\bmake\s+test\b|\bginkgo\b",
text_sources,
)
)
if has_test_cmd:
score += 20.0
evidence.append("Go test command found in project files")
else:
evidence.append("No 'go test' command found in Makefile/CI/README")
evidence.append("No test command found in Makefile/CI/README/AGENTS.md")

has_coverage = bool(
re.search(r"(?<!\S)-cover(?:\b|profile\b|mode\b)", text_sources)
Expand Down Expand Up @@ -634,6 +639,8 @@ def _read_go_build_files(self, repository: Repository) -> str:
repository.path / "Makefile",
repository.path / "Taskfile.yml",
repository.path / "README.md",
repository.path / "AGENTS.md",
repository.path / "CLAUDE.md",
Comment on lines +642 to +643
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider adding AGENTS.md/CLAUDE.md to monorepo subdirectory scan for consistency.

Lines 650-655 add Makefile, Taskfile.yml, and README.md from Go module subdirectories, but AGENTS.md and CLAUDE.md are only checked at the repository root. This is likely intentional (these docs typically live at root), but creates a minor inconsistency with how README.md is handled.

♻️ Optional consistency improvement
             files_to_check.extend(
                 [
                     module_root / "Makefile",
                     module_root / "Taskfile.yml",
                     module_root / "README.md",
+                    module_root / "AGENTS.md",
+                    module_root / "CLAUDE.md",
                 ]
             )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
repository.path / "AGENTS.md",
repository.path / "CLAUDE.md",
files_to_check.extend(
[
module_root / "Makefile",
module_root / "Taskfile.yml",
module_root / "README.md",
module_root / "AGENTS.md",
module_root / "CLAUDE.md",
]
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/agentready/assessors/testing.py` around lines 642 - 643, Update the
monorepo subdirectory scan to include AGENTS.md and CLAUDE.md the same way
README.md is added for Go module subdirectories: extend the logic that currently
appends repository.path / "AGENTS.md" and repository.path / "CLAUDE.md" (and the
code that adds Makefile, Taskfile.yml, README.md in the Go module loop) so those
two files are also checked/collected from each submodule directory rather than
only at repo root; locate the block that builds the per-submodule file list
(where README.md is appended) and add entries for "AGENTS.md" and "CLAUDE.md" to
that list.

]

# Include module-local build files (Go monorepos)
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/test_assessors_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,29 @@ def test_go_remediation_on_fail(self, tmp_path):
assert finding.remediation is not None
assert any("go test" in cmd for cmd in finding.remediation.commands)

def test_go_test_command_in_agents_md(self, tmp_path):
"""Go test command documented in AGENTS.md is detected (#470)."""
repo = _make_go_repo(tmp_path)

test_file = tmp_path / "main_test.go"
test_file.write_text('package main\nimport "testing"\n')
_git_add(tmp_path, test_file)

agents_md = tmp_path / "AGENTS.md"
agents_md.write_text(
"## Quick Commands\n\n"
"| Action | Command |\n"
"|--------|----------|\n"
"| Run tests | `make test` (runs fmt and vet first) |\n"
"| Lint | `make lint` |\n"
)

assessor = TestExecutionAssessor()
finding = assessor.assess(repo)

assert any("test command found" in e.lower() for e in finding.evidence)
assert finding.score >= 60.0


# =============================================================================
# TypeAnnotationsAssessor — Go support
Expand Down
Loading