Testing¶
Test your changes using example projects and debug mode.
Testing with Example Projects¶
Feluda includes example projects for all supported languages in the examples/ directory. These projects are designed to test Feluda’s license analysis capabilities with real-world dependencies that have transient (indirect) dependencies.
Available Example Projects¶
Rust Example (
examples/rust-example/): Uses serde, tokio, reqwest, and clapNode.js Example (
examples/node-example/): Uses express, axios, lodash, and momentGo Example (
examples/go-example/): Uses gin, cobra, testify, and zapPython Example (
examples/python-example/): Uses flask, requests, numpy, and pytestJava/Maven Example (
examples/java-example/maven-example/): Uses guava, commons-lang3, jackson-databind, slf4j, logback, and spring-coreJava/Gradle Example (
examples/java-example/gradle-example/): Uses guava, commons-lang3, jackson-databind, slf4j, logback, httpclient5, spring-boot-starter, and h2C Example (
examples/c-example/): Uses openssl, libcurl, and zlibC++ Example (
examples/cpp-example/): Uses boost, fmt, nlohmann-json, and spdlogR Example (
examples/r-example/): Uses dplyr, ggplot2, and tidyr
Running Example Projects¶
Use the just command to run and test examples:
# Show available example commands
just examples
# Test Feluda on all example projects
just test-examples
# Test Feluda on a specific example
feluda --path examples/rust-example
feluda --path examples/node-example
feluda --path examples/go-example
feluda --path examples/python-example
feluda --path examples/java-example/maven-example
feluda --path examples/java-example/gradle-example
feluda --path examples/c-example
feluda --path examples/cpp-example
feluda --path examples/r-example
# Test SBOM generation on an example project
feluda sbom --path examples/rust-example
feluda sbom spdx --path examples/rust-example
feluda sbom cyclonedx --path examples/rust-example
Using Examples for Development¶
When developing new features or fixing bugs, use these example projects to:
Test language-specific parsers: Each example project tests a different language parser
Verify transient dependency resolution: All examples include dependencies with indirect dependencies
Test license detection accuracy: Examples use common libraries with well-known licenses
Validate output formats: Test JSON, YAML, verbose, and TUI modes on examples
Example workflow:
# Make your changes to the codebase
cargo build
# Test on all examples
just test-examples
# Test specific output formats
./target/debug/feluda --path examples/rust-example --json
./target/debug/feluda --path examples/node-example --verbose
./target/debug/feluda --path examples/go-example --gui
# Test SBOM generation
./target/debug/feluda sbom --path examples/rust-example
./target/debug/feluda sbom spdx --path examples/rust-example
./target/debug/feluda sbom cyclonedx --path examples/node-example
Debug Mode¶
Feluda has a comprehensive debug system that helps with troubleshooting and development. To enable debug mode, run Feluda with the --debug or -d flag:
feluda --debug
Debug Features¶
The debug mode provides the following features:
Detailed Logging: Log messages are printed with different levels:
INFO: General information about operationsWARN: Potential issues that don’t stop executionERROR: Problems that caused an operation to failTRACE: Detailed debugging information about data structures
Performance Metrics: Debug mode automatically times key operations and reports their duration.
Data Inspection: Complex data structures are printed in debug format for inspection.
Error Context: Errors include detailed context to help identify root causes.
Logging in Your Code¶
When adding new features, include appropriate logging using the debug module:
// Import debug utilities
use crate::debug::{log, LogLevel, log_debug, log_error};
// Log informational messages
log(LogLevel::Info, "Starting important operation");
// Log warnings
log(LogLevel::Warn, "Resource XYZ not found, using default");
// Log errors with context
if let Err(err) = some_operation() {
log_error("Failed to complete operation", &err);
}
// Log complex data structures for debugging
log_debug("Retrieved configuration", &config);
// Time operations
let result = with_debug("Complex calculation", || {
// Your code here
perform_complex_calculation()
});