Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
- Code of Conduct
- Getting Started
- Development Workflow
- Coding Standards
- Testing
- Submitting Changes
- Reporting Bugs
- Suggesting Features
This project follows the principles of respect, collaboration, and inclusivity. Please:
- Be respectful and constructive in all communications
- Welcome newcomers and help them get started
- Focus on what is best for the community
- Show empathy towards other community members
For Frontend Development:
- Modern web browser (Chrome 90+, Firefox 88+, Safari 14+, Edge 90+)
- Basic knowledge of HTML, CSS, and JavaScript
- Text editor or IDE (VS Code, Sublime Text, etc.)
For Backend Development:
- Rust 1.75 or later
- PostgreSQL 16 or later
- Docker (optional, for containerized development)
-
Fork and Clone the Repository
git clone https://github.com/YOUR_USERNAME/standard-diff.git cd standard-diff -
Frontend Setup
# Start a local HTTP server python3 -m http.server 8080 # Open http://localhost:8080 in your browser
-
Backend Setup
cd rust-backend cp .env.example .env # Edit .env with your configuration cargo build cargo run
feature/description- New featuresbugfix/description- Bug fixesdocs/description- Documentation updatesrefactor/description- Code refactoringtest/description- Test additions or modifications
Example:
git checkout -b feature/add-xml-export-
Create a Feature Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Write clear, concise code
- Follow the coding standards (see below)
- Add comments where necessary
- Update documentation if needed
-
Test Your Changes
- Test manually in the browser
- Run automated tests (if available)
- Verify no console errors
- Test in multiple browsers if UI changes
-
Commit Your Changes
git add . git commit -m "feat: add XML export functionality"
Follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, etc.)refactor- Code refactoringtest- Adding or updating testschore- Maintenance tasks
Examples:
feat(diff): add XML export format
fix(validator): resolve schema loading issue
docs(readme): update installation instructions
refactor(api): simplify error handling
-
Use ES6+ syntax (const/let, arrow functions, template literals)
-
Use meaningful variable names
// Good const validationResult = validateMaDMP(data); // Avoid const vr = validateMaDMP(data);
-
Add JSDoc comments for functions
/** * Validates maDMP JSON against schema v1.2 * @param {Object} jsonData - The maDMP JSON to validate * @returns {Promise<{valid: boolean, errors: Array}>} */ async function validateMaDMP(jsonData) { // implementation }
-
Use consistent formatting
- 2 spaces for indentation
- Single quotes for strings
- Semicolons at end of statements
- Max line length: 100 characters
-
Error handling
try { const result = await someAsyncOperation(); return result; } catch (error) { console.error('Operation failed:', error); showToast('An error occurred', 'error'); }
-
Follow Rust naming conventions
snake_casefor functions and variablesPascalCasefor types and structsSCREAMING_SNAKE_CASEfor constants
-
Format code with rustfmt
cargo fmt
-
Check for common issues with clippy
cargo clippy
-
Add documentation comments
/// Validates a DMP against the maDMP schema /// /// # Arguments /// * `dmp_data` - The DMP JSON data to validate /// /// # Returns /// Result indicating whether the DMP is valid pub fn validate_dmp(dmp_data: &Value) -> Result<(), ValidationError> { // implementation }
- Use consistent naming (BEM methodology preferred)
- Group related properties
- Use variables for colors and common values
- Ensure responsive design
Manual Testing Checklist:
- Test in Chrome, Firefox, Safari
- Test file upload (all three methods)
- Test validation with valid/invalid JSON
- Test all diff view modes
- Test all export formats
- Test keyboard shortcuts
- Test dark mode toggle
- Check browser console for errors
- Test on mobile/tablet devices
Automated Testing (when added):
npm testcd rust-backend
cargo test
cargo test -- --nocapture # Show outputTest Coverage:
cargo tarpaulin --out Html-
Update Documentation
- Update README.md if needed
- Update CHANGELOG.md
- Add JSDoc/Rustdoc comments
-
Ensure Tests Pass
- All existing tests pass
- New tests added for new features
- No console errors or warnings
-
Create Pull Request
- Use a clear, descriptive title
- Reference related issues
- Describe what changed and why
- Include screenshots for UI changes
- List any breaking changes
Pull Request Template:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Manual testing completed
- [ ] Automated tests added
- [ ] No console errors
## Screenshots (if applicable)
[Add screenshots here]
## Related Issues
Closes #issue_number-
Review Process
- Address reviewer feedback
- Make requested changes
- Push updates to your branch
-
Merge
- Once approved, your PR will be merged
- Delete your feature branch after merge
- Check existing issues to avoid duplicates
- Test in the latest version
- Try to reproduce in a fresh environment
- Gather relevant information
**Describe the bug**
Clear and concise description
**To Reproduce**
1. Go to '...'
2. Click on '...'
3. See error
**Expected behavior**
What you expected to happen
**Screenshots**
If applicable
**Environment:**
- Browser: [e.g., Chrome 120]
- OS: [e.g., Windows 11]
- Version: [e.g., 2.0.0]
**Additional context**
Any other relevant information**Is your feature request related to a problem?**
Clear description of the problem
**Describe the solution you'd like**
Clear description of what you want to happen
**Describe alternatives you've considered**
Other solutions or features you've considered
**Additional context**
Mockups, examples, or other contextUnderstanding the project structure will help you navigate the codebase:
standard-diff/
├── index.html # Main application file
├── README.md # Project documentation
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # This file
├── css/ # Stylesheets
├── js/ # JavaScript modules
│ ├── main.js # Application entry
│ ├── store.js # State management
│ ├── validator.js # Validation logic
│ ├── diff-renderers/ # Diff visualization
│ └── exporters/ # Export functionality
├── schemas/ # JSON schemas
├── docs/ # Documentation
│ └── reports/ # Test and bug reports
└── rust-backend/ # Backend API
├── src/ # Rust source code
├── tests/ # Integration tests
└── migrations/ # Database migrations
If you have questions:
- Check the README.md
- Review existing issues and pull requests
- Create a new issue with the "question" label
By contributing, you agree that your contributions will be licensed under the same license as the project (Creative Commons Zero - CC0).
Thank you for contributing to the maDMP Validator & Diff Tool! 🎉