This directory contains example plugin implementations for various programming languages that are not yet fully supported in PermitCheck.
- Status: ~80% complete, needs testing
- Features:
- Parses
Gemfilefor dependencies - Fetches licenses from RubyGems.org API
- Fallback to
gem specificationcommand
- Parses
- Usage: Copy to
permitcheck/plugins/and test with a Ruby project
- Status: ~70% complete, needs additional work
- Features:
- Parses
go.modfor module dependencies - GitHub API integration for GitHub-hosted modules
- LICENSE file detection in module cache
- Parses
- Challenges: No unified Go package registry API, requires multiple strategies
- Status: ~75% complete for Maven, Gradle stubbed out
- Features:
- Parses Maven
pom.xmlfiles - Fetches licenses from Maven Central
- Downloads and parses artifact POM files
- Parses Maven
- TODO: Gradle support (build.gradle parsing)
- Copy to plugins directory:
cp examples/for_ruby.py permitcheck/plugins/- Update CLI tool to include new language in
permitcheck/scripts/permitcheck_tool.py:
parser.add_argument(
'-l', '--lang',
choices=['python', 'npm', 'ruby'], # Add your language
# ...
)- Test with sample project:
# Create test project
mkdir test_ruby_project
cd test_ruby_project
# Create Gemfile
cat > Gemfile << EOF
source 'https://rubygems.org'
gem 'rails'
gem 'rspec'
EOF
# Run PermitCheck
permitcheck -l rubyEach plugin can be customized by modifying:
- Dependency Discovery: Update
_discover_*()method to parse your manifest format - License Fetching: Update
_fetch_license_from_*()to query your package registry - Configuration: Implement
load_settings()for language-specific config
When adapting these examples:
- Test dependency discovery with real projects
- Verify license fetching works for common packages
- Add error handling for edge cases
- Write unit tests (see
tests/plugins/test_for_python.py) - Add integration tests
- Update documentation
- Submit PR with your enhancements!
Here are the official APIs for major package registries:
| Language | Registry | API Documentation |
|---|---|---|
| Ruby | RubyGems | https://guides.rubygems.org/rubygems-org-api/ |
| Go | pkg.go.dev | No official API (use GitHub API for GitHub repos) |
| Java | Maven Central | https://search.maven.org/classic/#api |
| Rust | crates.io | https://crates.io/data-access |
| PHP | Packagist | https://packagist.org/apidoc |
| C# | NuGet | https://docs.microsoft.com/nuget/api/overview |
Most registries provide JSON APIs:
response = requests.get(f"{API_URL}/{package_name}")
data = response.json()
license = data.get('license')Use existing package manager tools:
result = subprocess.run(['gem', 'specification', package],
capture_output=True)
# Parse result.stdoutRead LICENSE files from installed packages:
license_files = glob.glob(f"{package_dir}/LICENSE*")
content = open(license_files[0]).read()
licenses = self.matcher.match(content) # Use fuzzy matchingOnce your plugin works well:
-
Polish the code:
- Add comprehensive docstrings
- Handle edge cases
- Add type hints
- Follow code style (run
ruff format)
-
Write tests:
- Unit tests for each method
- Mock external API calls
- Test error conditions
-
Update docs:
- Add to README.md supported languages
- Document any special requirements
- Add usage examples
-
Submit PR:
- Follow CONTRIBUTING.md
- Include test results
- Describe what works and what doesn't
- Open a discussion: https://github.com/kirankotari/permitcheck/discussions
- Check existing issues: https://github.com/kirankotari/permitcheck/issues
- Read the guide: docs/adding-language-support.md
Happy plugin development! 🚀