|
1 | 1 | class Codecompass < Formula |
2 | | - desc "A CLI tool that helps you navigate and understand large codebases." |
3 | | - homepage "https://github.com/xeoncross/codecompass" |
4 | | - url "https://github.com/xeon-zolt/codecompass/archive/refs/tags/v0.0.1-beta.3.tar.gz" # Placeholder: Update with each release |
5 | | - sha256 "99e7d4be71d3383faa6d00ead8f94c311b4c57b7f549e51ab2191ca58296e72f" # Placeholder: Update with each release |
| 2 | + desc "Navigate Your Code Quality - A comprehensive code quality analysis tool with advanced analytics" |
| 3 | + homepage "https://github.com/xeon-zolt/codecompass" |
| 4 | + url "https://github.com/xeon-zolt/codecompass/archive/refs/tags/v1.0.0.tar.gz" # Update with each release |
| 5 | + sha256 "PLACEHOLDER_SHA256_HASH" # Calculate with: shasum -a 256 codecompass-v1.0.0.tar.gz |
| 6 | + license "MIT" |
6 | 7 |
|
7 | 8 | depends_on "go" => :build |
| 9 | + depends_on "git" |
| 10 | + |
| 11 | + # Optional dependencies for enhanced functionality |
| 12 | + uses_from_macos "node" => :optional # For ESLint support |
| 13 | + uses_from_macos "python3" => :optional # For Ruff support |
8 | 14 |
|
9 | 15 | def install |
10 | | - system "go", "build", *std_go_args(ldflags: "-s -w") |
| 16 | + # Build with version information |
| 17 | + version_ldflags = "-X main.version=#{version} -X main.buildDate=#{Time.now.strftime('%Y-%m-%d')}" |
| 18 | + system "go", "build", *std_go_args(ldflags: "-s -w #{version_ldflags}") |
| 19 | + |
| 20 | + # Create default config directory |
| 21 | + (etc/"codecompass").mkpath |
| 22 | + |
| 23 | + # Install sample configuration |
| 24 | + system bin/"codecompass", "--generate-config" |
| 25 | + (etc/"codecompass").install ".codecompass.rc" => "codecompass.rc.example" |
| 26 | + end |
| 27 | + |
| 28 | + def caveats |
| 29 | + <<~EOS |
| 30 | + 🧭 CodeCompass is now installed! |
| 31 | +
|
| 32 | + Basic Usage: |
| 33 | + codecompass --help # Show all available options |
| 34 | + codecompass --summary # Quick repository overview |
| 35 | + codecompass --authors # Author leaderboard |
| 36 | + |
| 37 | + Advanced Features: |
| 38 | + codecompass --quality # Comprehensive quality analysis |
| 39 | + codecompass --trends # Trend analysis with charts |
| 40 | + codecompass --hotspots # Detect high-risk code areas |
| 41 | + codecompass --team # Team performance metrics |
| 42 | + |
| 43 | + Configuration: |
| 44 | + Sample config: #{etc}/codecompass/codecompass.rc.example |
| 45 | + Copy to your repo: cp #{etc}/codecompass/codecompass.rc.example .codecompass.rc |
| 46 | + |
| 47 | + Optional Dependencies: |
| 48 | + • Install ESLint for JavaScript analysis: npm install -g eslint |
| 49 | + • Install Ruff for Python analysis: pip install ruff |
| 50 | + EOS |
11 | 51 | end |
12 | 52 |
|
13 | 53 | test do |
14 | | - # Basic test to ensure the binary runs and outputs something |
15 | | - assert_match "CodeCompass", shell_output("#{bin}/codecompass --version") |
| 54 | + # Test version output |
| 55 | + version_output = shell_output("#{bin}/codecompass --version") |
| 56 | + assert_match "CodeCompass", version_output |
| 57 | + assert_match version.to_s, version_output |
| 58 | + |
| 59 | + # Test help output |
| 60 | + help_output = shell_output("#{bin}/codecompass --help") |
| 61 | + assert_match "Navigate Your Code Quality", help_output |
| 62 | + assert_match "--quality", help_output |
| 63 | + assert_match "--trends", help_output |
| 64 | + assert_match "--hotspots", help_output |
| 65 | + assert_match "--team", help_output |
| 66 | + |
| 67 | + # Test config generation |
| 68 | + system bin/"codecompass", "--generate-config" |
| 69 | + assert_predicate testpath/".codecompass.rc", :exist? |
| 70 | + |
| 71 | + # Test that it can run basic analysis (in a git repo) |
| 72 | + system "git", "init" |
| 73 | + system "git", "config", "user.name", "Test User" |
| 74 | + system "git", "config", "user.email", "test@example.com" |
| 75 | + (testpath/"test.go").write "package main\nfunc main() {}\n" |
| 76 | + system "git", "add", "." |
| 77 | + system "git", "commit", "-m", "Initial commit" |
| 78 | + |
| 79 | + # Test summary command |
| 80 | + summary_output = shell_output("#{bin}/codecompass --summary") |
| 81 | + assert_match "Repository Summary", summary_output |
16 | 82 | end |
17 | 83 | end |
0 commit comments