Thank you for your interest in contributing to this project! This document provides guidelines and instructions for contributing.
- Fork the repository
- Clone your fork
git clone https://github.com/your-username/matrikkel-java.git cd matrikkel-java - Set up development environment
- Install Java 17+
- Install Maven 3.9+
- Set up PostgreSQL 15+
- Copy
.env.exampleto.envand configure
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or changes
Follow these guidelines:
- Follow standard Java conventions
- Use Lombok annotations to reduce boilerplate
- Add Javadoc for public methods
- Keep methods focused and small
- Use meaningful variable names
- Write unit tests for new functionality
- Ensure all tests pass:
mvn test - Add integration tests for complex features
- Aim for >80% code coverage
- Update README.md if needed
- Add comments for complex logic
- Update CHANGELOG.md with your changes
- Keep
.copilot-context.mdupdated with new patterns
Use clear, descriptive commit messages:
git commit -m "feat: Add support for Adresse import"
git commit -m "fix: Handle null snapshotVersion in MatrikkelContext"
git commit -m "docs: Update README with new configuration options"Commit message format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Test additions or changeschore:- Maintenance tasks
git push origin feature/your-feature-nameThen create a Pull Request on GitHub with:
- Clear title describing the change
- Detailed description of what and why
- Reference any related issues
- Screenshots if applicable
// Good example
@Service
@RequiredArgsConstructor
@Slf4j
public class MatrikkelenhetImportService {
private final NedlastningClientWrapper nedlastningClient;
private final MatrikkelenhetRepository repository;
/**
* Import matrikkelenheter for a specific kommune.
*
* @param kommunenummer The kommune number (e.g., "4601")
* @return Number of imported matrikkelenheter
* @throws MatrikkelApiException if API call fails
*/
@Transactional
public int importMatrikkelenheterForKommune(String kommunenummer) {
log.info("Starting import for kommune {}", kommunenummer);
// Implementation...
}
}- Use
application.ymlfor configuration - Never commit credentials
- Document all configuration options
- Use type-safe
@ConfigurationProperties
- Always use Flyway migrations
- Never use
ddl-auto: createin production - Add proper indexes for queries
- Document schema changes in migration files
- Create wrapper classes for generated clients
- Handle pagination properly
- Add retry logic for transient failures
- Log all API calls at DEBUG level
@ExtendWith(MockitoExtension.class)
class MatrikkelenhetImportServiceTest {
@Mock
private NedlastningClientWrapper nedlastningClient;
@Mock
private MatrikkelenhetRepository repository;
@InjectMocks
private MatrikkelenhetImportService service;
@Test
void shouldImportMatrikkelenheter() {
// Given
String kommunenummer = "4601";
// ... setup mocks
// When
int result = service.importMatrikkelenheterForKommune(kommunenummer);
// Then
assertEquals(expectedCount, result);
verify(repository).saveAll(anyList());
}
}@SpringBootTest
@Testcontainers
class MatrikkelenhetRepositoryIntegrationTest {
@Container
static PostgreSQLContainer<?> postgres =
new PostgreSQLContainer<>("postgres:15-alpine");
@Test
void shouldSaveAndRetrieveMatrikkelenhet() {
// Test implementation
}
}Before submitting a PR, ensure:
- Code follows project conventions
- All tests pass (
mvn test) - New code has test coverage
- Documentation is updated
- CHANGELOG.md is updated
- No credentials or sensitive data committed
- Commit messages are clear and descriptive
- Branch is up to date with main
- No merge conflicts
When reporting issues, include:
- Description - Clear description of the problem
- Steps to Reproduce - Detailed steps to reproduce the issue
- Expected Behavior - What you expected to happen
- Actual Behavior - What actually happened
- Environment - Java version, OS, database version
- Logs - Relevant log output (sanitize any credentials!)
- Screenshots - If applicable
- Check the JAVA_PROJECT_SETUP_GUIDE.md
- Review .copilot-context.md
- Read the README.md
- Open a discussion on GitHub
By contributing, you agree that your contributions will be licensed under the same license as the project.
Thank you for contributing! 🎉