Skip to content

Commit 2fbb733

Browse files
kami619Ambient Code Botclaude
authored
fix(assessors): support project-named directories and test-only repos in standard_layout check (#322)
* fix(assessors): support project-named directories and test-only repos in standard_layout Enhances StandardLayoutAssessor to recognize multiple valid Python project structures instead of rigidly requiring src/: - Project-named directories (e.g., pandas/pandas/) now pass the check - Test-only repositories now receive NOT_APPLICABLE instead of failing - Parses pyproject.toml for project name (PEP 621 and Poetry formats) - Falls back to detecting any root directory with __init__.py - Adds blocklist to exclude non-source directories (tests, docs, utils, etc.) - Updates remediation to present both src/ and flat layout as valid options Fixes #246 Fixes #305 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(assessors): address PR #322 review feedback Changes based on code review: Critical: - Remove setup.cfg from test_indicators (false positive risk) - Sort directory iteration for deterministic cross-platform behavior Significant: - Limit Strategy 3 (fallback detection) to repos with pyproject.toml - Use word-boundary regex for test-only repo name detection - Expand _NON_SOURCE_DIRS blocklist with migrations, config, etc. Minor: - Remove redundant has_tests check (caller already verifies) - Replace empty strings in commands with comment separators Updated test to expect failure for project-named directory without pyproject.toml, matching the new stricter detection behavior. All 16 tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(assessors): address PR #322 second review feedback Fixes based on code review comment #3948171727: Bug fixes: - pytest.ini/conftest.py only indicate test-only repos when pyproject.toml is absent; mixed projects typically have pyproject.toml so these files alone are not reliable test-only indicators - Remove celery, middleware, alembic from blocklist since these are legitimate package names for their respective projects (Celery, etc.) Design improvement: - Strategy 3 (heuristic fallback) now returns type "heuristic" and evidence shows "— verify" suffix to flag that this is a best-guess match, not an exact name match from pyproject.toml Style cleanup: - Remove self-referential "PR #322 feedback:" comments; replaced with direct rationale where still needed Added 3 new tests: - test_pytest_ini_with_pyproject_is_not_test_only - test_celery_directory_not_blocked - test_heuristic_match_shows_verify_in_evidence All 19 tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(assessors): address PR #322 third review feedback High Priority Fixes: - Add TypedDict (SourceDirectoryInfo) for _find_source_directory return type to provide type safety and prevent runtime key typos - Fix Strategy 3 scoping bug: heuristic fallback now runs whenever pyproject.toml exists, not just when a package name is found. This allows repos with pyproject.toml containing only [build-system] to still benefit from heuristic source directory detection. Medium Priority (Tests): - Add test for pyproject.toml without name field (only [build-system]) - Add test for project-named directory without __init__.py (namespace packages) verifying Strategy 2 falls through to Strategy 3 correctly Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * style: fix black formatting in structure.py Add missing blank line after TypedDict class definition. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(assessors): externalize non-source dirs blocklist to Python.arsrc Addresses PR #322 review Comment 1: - Create Python.arsrc config file with gitignore-like format - Add _load_arsrc_file() with @lru_cache for efficient config loading - Add UserWarning when config file is missing (helps detect packaging issues) - Update pyproject.toml to include *.arsrc in package-data - Add 7 new tests covering config loading, parsing, and packaging The blocklist is now externalized following the reviewer's suggestion to adopt a github/gitignore-like pattern for managing language conventions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Refactor package data entries in pyproject.toml Remove conflicting entries and standardize package data. --------- Co-authored-by: Ambient Code Bot <bot@ambient-code.local> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0adae8e commit 2fbb733

4 files changed

Lines changed: 1091 additions & 32 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ where = ["src"]
5959
agentready = [
6060
"data/*.md",
6161
"data/*.yaml",
62+
"data/*.arsrc",
6263
"data/.agentready-config.example.yaml",
6364
"prompts/*.md",
6465
"templates/*.j2",

0 commit comments

Comments
 (0)