Skip to content

Add script to count symbols from Ruby files#27

Merged
Morriar merged 1 commit intomainfrom
at-utils-metrics
Jul 4, 2025
Merged

Add script to count symbols from Ruby files#27
Morriar merged 1 commit intomainfrom
at-utils-metrics

Conversation

@Morriar
Copy link
Contributor

@Morriar Morriar commented Jul 4, 2025

Useful to get a high level picture of what's in a codebase and how our things scale in comparison.

Usage:

$ ./utils/symbol-metrics <path> [<path>...]

@Morriar Morriar self-assigned this Jul 4, 2025
@Morriar Morriar force-pushed the at-utils-metrics branch 3 times, most recently from 91f254f to 764aef8 Compare July 4, 2025 14:03
def visit_local_variable_write_node(node)
@counters[:local_variables] += 1
super
end
Copy link
Member

Choose a reason for hiding this comment

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

We're missing global variables

Comment on lines +88 to +94
paths = ARGV.map do |path|
if File.directory?(path)
Dir.glob(File.join(path, "**/*.{rb,rbi}")).select { |file| File.file?(file) }
else
[path]
end
end.flatten
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
paths = ARGV.map do |path|
if File.directory?(path)
Dir.glob(File.join(path, "**/*.{rb,rbi}")).select { |file| File.file?(file) }
else
[path]
end
end.flatten
paths = ARGV.flat_map do |path|
if File.directory?(path)
Dir.glob(File.join(path, "**/*.{rb,rbi}")).select { |file| File.file?(file) }
else
[path]
end
end

Useful to get a high level picture of what's in a codebase
and how our things scale in comparison.

Usage:

    $ ./utils/symbol-metrics <path> [<path>...]

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar force-pushed the at-utils-metrics branch from 764aef8 to aad097d Compare July 4, 2025 16:24
@Morriar Morriar enabled auto-merge July 4, 2025 16:25
@Morriar Morriar merged commit 2c03275 into main Jul 4, 2025
22 of 26 checks passed
@Morriar Morriar deleted the at-utils-metrics branch July 4, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants