Skip to content

Commit

Permalink
Fix formatting. Add docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
spier committed Feb 15, 2025
1 parent 883352c commit 7d340e6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions meta/scripts/find_upgradeable_patterns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
def count_known_instances(file)
section_nodes = collect_section_nodes(file, "Known Instances")
list_nodes = []

# pick the first list in the "Known Instances" section, and return the number of elements in that list.
# CAUTION: this assumes a certain structure across all patterns. Therefore fairly brittle.
list_nodes = section_nodes.select {|n| n.type == :list}
Expand All @@ -32,6 +33,7 @@ def count_known_instances(file)
return known_instances_count
end

# Extract all nodes below a given headline
def collect_section_nodes(file, section_title)
markdown = open(file).readlines().join
doc = Commonmarker.parse(markdown)
Expand Down

0 comments on commit 7d340e6

Please sign in to comment.