Skip to content

Commit

Permalink
chore: add script to print lines of code (noir-lang#4991)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

This PR adds a small script to print out the LOC for various sections of
the codebase. Adding weightings will come in a later PR. Note that this
PR relies on my fork of tokei which has support for Noir source code.

cc @Rumata888

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench authored May 10, 2024
1 parent b541e79 commit 7280bad
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .tokeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
docs
scripts

# aztec_macros is explicitly considered OOS for Noir audit
aztec_macros

# config files
*.toml
*.md
*.json
*.txt
*.config.mjs
33 changes: 33 additions & 0 deletions scripts/count_loc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eu

# Run relative to repo root
cd $(dirname "$0")/../

if ! command -v "tokei" >/dev/null 2>&1; then
echo "Error: tokei is required but not installed." >&2
echo "Error: Run \`cargo install --git https://github.com/TomAFrench/tokei --branch tf/add-noir-support tokei\`" >&2

exit 1
fi

echo ""
echo "Total:"

tokei ./ --sort code

echo ""
echo "ACIR/ACVM:"
tokei ./acvm-repo --sort code

echo ""
echo "Compiler:"
tokei ./compiler --sort code

echo ""
echo "Tooling:"
tokei ./tooling --sort code

echo ""
echo "Standard Library:"
tokei ./noir_stdlib --sort code

0 comments on commit 7280bad

Please sign in to comment.