MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / extract_env_pair

Method extract_env_pair

src/extraction/dockerfile_extractor.rs:320–370  ·  view source on GitHub ↗

Extract a single `env_pair` as a Const node.

(state: &mut ExtractionState, node: TsNode<'_>)

Source from the content-addressed store, hash-verified

318
319 /// Extract a single `env_pair` as a Const node.
320 fn extract_env_pair(state: &mut ExtractionState, node: TsNode<'_>) {
321 let name = match node.child_by_field_name("name") {
322 Some(n) => state.node_text(n),
323 None => return,
324 };
325
326 let start_line = node.start_position().row as u32;
327 let end_line = node.end_position().row as u32;
328 let start_column = node.start_position().column as u32;
329 let end_column = node.end_position().column as u32;
330 let text = state.node_text(node);
331 let qualified_name = format!("{}::{}", state.qualified_prefix(), name);
332 let id = generate_node_id(&state.file_path, &NodeKind::Const, &name, start_line);
333
334 let graph_node = Node {
335 id: id.clone(),
336 kind: NodeKind::Const,
337 name,
338 qualified_name,
339 file_path: state.file_path.clone(),
340 start_line,
341 attrs_start_line: start_line,
342 end_line,
343 start_column,
344 end_column,
345 signature: Some(format!("ENV {}", text.trim())),
346 docstring: None,
347 visibility: Visibility::Pub,
348 is_async: false,
349 branches: 0,
350 loops: 0,
351 returns: 0,
352 max_nesting: 0,
353 unsafe_blocks: 0,
354 unchecked_calls: 0,
355 assertions: 0,
356 updated_at: state.timestamp,
357 parent_id: None,
358 };
359 state.nodes.push(graph_node);
360
361 // Contains edge from parent.
362 if let Some(parent_id) = state.parent_node_id() {
363 state.edges.push(Edge {
364 source: parent_id.to_string(),
365 target: id,
366 kind: EdgeKind::Contains,
367 line: Some(start_line),
368 });
369 }
370 }
371
372 /// Extract ARG instruction as a Const node.
373 ///

Callers

nothing calls this directly

Calls 4

generate_node_idFunction · 0.85
pushMethod · 0.80
node_textMethod · 0.45
parent_node_idMethod · 0.45

Tested by

no test coverage detected