Thank you for your interest in contributing! StackLens is a beginner-friendly project and we welcome all contributions — from new error detectors to documentation improvements.
- Getting Started
- Project Structure
- Adding a New Error Detector
- Running Tests
- Code Style
- Submitting a Pull Request
- Java 17 or higher
- Maven 3.8 or higher
- Git
git clone https://github.com/AbaSheger/stacklens.git
cd stacklens
mvn clean packagejava -jar target/stacklens.jar analyze samples/sample-npe.logsrc/main/java/com/stacklens/
├── cli/ # CLI commands (Main.java, AnalyzeCommand.java)
├── analyzer/ # Reads files and text, drives analysis
├── classifier/ # Applies all detectors to each log line
├── detector/ # One class per error type (IssueDetector implementations)
├── model/ # Data classes (Issue, AnalysisResult)
└── output/ # Formats results (human-readable, JSON)
Adding a new detector is the most common contribution. Here's how:
Create a new file in src/main/java/com/stacklens/detector/.
package com.stacklens.detector;
import com.stacklens.model.Issue;
import java.util.List;
import java.util.Optional;
public class MyNewErrorDetector implements IssueDetector {
@Override
public String getIssueType() {
return "MyNewError"; // Short, descriptive name
}
@Override
public Optional<Issue> detect(String line) {
if (line == null) return Optional.empty();
if (line.contains("my error pattern")) {
return Optional.of(new Issue(
getIssueType(),
"Clear explanation of what this error means.",
List.of(
"First actionable fix",
"Second actionable fix"
),
line.trim()
));
}
return Optional.empty();
}
}Open src/main/java/com/stacklens/classifier/IssueClassifier.java and add your detector to the list:
detectors.add(new MyNewErrorDetector());Add a test in src/test/java/com/stacklens/detector/ that:
- Verifies your detector matches the expected log lines
- Verifies it does NOT match unrelated lines
- Verifies it handles
nullinput
Add a sample log containing your error to samples/sample-your-error.log.
mvn testTo run a specific test class:
mvn test -Dtest=NullPointerDetectorTest- Follow standard Java naming conventions
- Keep classes focused on a single responsibility
- Write comments where logic is not immediately obvious
- Prefer readability over cleverness
- Don't use complex patterns when simple ones work
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-new-detector - Make your changes and commit with a clear message
- Ensure all tests pass:
mvn test - Push your branch and open a Pull Request
- Fill in the PR template
We'll review your PR and may ask for changes. We aim to respond within a few days.
Open a GitHub Issue and we'll be happy to help.