Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
select_rules
codeintel.context.select_rules
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| assemble_context | context.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| context | context.py | same file |
codeintel.context.select_rulesbackend/app/codeintel/context.py, lines 264–291Open source
def select_rules(db: Session, *, profile_id: str | None = None, repositories: list[str] | None = None) -> list[dict]: """ACTIVE coding rules: a CodingProfile's (when ``profile_id`` is given) or those learned for ``repositories``; highest confidence first.""" if profile_id: scope, limit = ProposedRule.profile_id == profile_id, 20 elif repositories: scope, limit = ProposedRule.repository.in_(repositories), 10 else: return [] stmt = ( select(ProposedRule) .where(ProposedRule.status == "ACTIVE", scope) .order_by(ProposedRule.confidence.desc()) .limit(limit) ) out = [] for rule in db.execute(stmt).scalars(): schema = rule.rule_schema or {} out.append({ "name": rule.rule_name, "description": rule.rule_description, "confidence": rule.confidence, "pattern_type": schema.get("pattern_type"), "example": schema.get("example_code") or None, "file_path": rule.file_path, "profile_id": rule.profile_id, }) return outWhat the index recorded
- Signature
def select_rules(db: Session, *, profile_id: str | None, repositories: list[str] | None) -> list[dict]:- File
backend/app/codeintel/context.py- Lines
- 264–291
- Parser
- python-ast
- Git blob
0c4a7dd4639651a5c13142d168630e344439f22a- Call sites
- 10 named, 2 resolved, 8 left unlinked
- Outside this subset
- 5 more edges reach code outside the graph shown here
