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
4 changes: 2 additions & 2 deletions crates/ruff_ruby_spo/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ fn rails_kind(decl: &Declaration) -> RailsKind {
Declaration::Validation(_) => RailsKind::Validation,
Declaration::Callback(_) => RailsKind::Callback,
Declaration::Concern(_) => RailsKind::Concern,
Declaration::Attribute(_) => RailsKind::Attribute,
Declaration::Attribute(_) | Declaration::EnumForm(_) => RailsKind::Attribute,
Declaration::Delegation(_) => RailsKind::Delegation,
Declaration::Scope(_) => RailsKind::Scope,
Declaration::ActsAs(_) => RailsKind::ActsAs,
Expand Down Expand Up @@ -1343,7 +1343,7 @@ fn rails_arm(body: &Node) -> Vec<RailsEvent> {
for stmt in stmts {
let at = anchor(stmt);
let mut decls = Vec::new();
crate::walk::walk_class_body(stmt, &mut decls);
crate::walk::walk_class_body(stmt, None, &mut decls);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 1. Thread source text through the Rails event arm

For callers of events::source_ore, an enum such as enum :status, STATUSES.merge(extra) still produces EnumVariants::Unresolved("<expr>"), and hash values containing method calls likewise become "<expr>". Unlike the corrected model-extraction path, this newly updated event call explicitly passes None, forcing source_text to use the lossy renderer even though source_ore has the original source. Consequently, the new EnumForm payloads in ClassOre::declarations lose expressions and can disagree with the model extracted from the same file. Thread the source through the event collection path and pass it to this walker.

Useful? React with 👍 / 👎.

for decl in decls {
let seq = u32::try_from(out.len()).unwrap_or(u32::MAX);
out.push(RailsEvent {
Expand Down
Loading
Loading