Welcome Contributors
Thank you for your interest in contributing to List! This guide will help you get started with development and explain our contribution process.List is an open-source project that welcomes contributions from developers of all skill levels. Whether you’re fixing a bug, adding a feature, or improving documentation, your help is appreciated!
Getting Started
Set Up Development Environment
Ensure you have the required tools:
- Swift 6.2 or later
- macOS 13+ (for macOS development) or Linux
- Git
Development Workflow
Creating a Feature Branch
Always create a new branch for your changes:Making Changes
Code Your Changes
Make your changes following the project structure:
- CLI changes: Edit files in
Sources/SwiftListCLI/ - Core logic: Edit files in
Sources/SwiftListCore/ - Tests: Edit or add to
Tests/SwiftListTests.swift
Add or Update Tests
Add tests for your changes in Run tests to ensure they pass:
Tests/SwiftListTests.swift:Code Style Guidelines
Swift Formatting Rules
The project uses.swift-format configuration with these key settings:
- Indentation: 4 spaces (not tabs)
- Line length: 180 characters maximum
- File-scoped declarations: Use private access level
- Documentation: Required for public APIs
Code Organization
Follow the existing module structure:Do
- Follow existing patterns
- Add documentation comments
- Write tests for new features
- Use meaningful variable names
- Keep functions focused and small
Don't
- Mix CLI and core logic
- Use force unwrapping (!)
- Skip error handling
- Ignore compiler warnings
- Submit unformatted code
Documentation Comments
Add documentation for public APIs:Testing Strategy
Writing Tests
List uses the modern Swift Testing framework (0.11.0+):What to Test
Core Functionality
Core Functionality
- File listing with different options
- Sorting (by name, size, time)
- Filtering (hidden files, etc.)
- File type detection
- Symbolic link handling
- Recursive directory traversal
Edge Cases
Edge Cases
- Empty directories
- Permission denied scenarios
- Broken symbolic links
- Very long file names
- Special characters in file names
- Depth limit in recursive mode
Display Options
Display Options
- Long format output
- Color codes applied correctly
- Icon display
- Terminal width wrapping
- Human-readable sizes
Running Tests
Adding New Features
Feature Development Checklist
When adding a new feature:- Create a feature branch
- Design the feature (consider architecture impact)
- Update
DisplayOptionsif needed (new configuration) - Add CLI flags to
ListCommandif needed - Implement core logic in
SwiftListCore - Write comprehensive tests
- Update documentation comments
- Format code with
swift-format - Run full test suite
- Test manually with various scenarios
- Update README if user-facing
- Submit pull request
Example: Adding a New Sort Option
Add CLI Flag
Add the flag to Update the
Sources/SwiftListCLI/ListCommand.swift:run() method to handle it.Implement Sorting Logic
Update
FileManagerHelper.contents() in Sources/SwiftListCore/Utilities/FileManagerHelper.swift:Continuous Integration
The project uses GitHub Actions for CI/CD: Location:.github/workflows/release.yml
CI Pipeline
The CI pipeline automatically:-
Builds the project on multiple platforms:
- macOS (x86_64 and arm64)
- Linux (x86_64 and arm64)
- Runs tests on all platforms
-
Creates releases when tags are pushed:
- Builds release binaries
- Uploads artifacts to GitHub Releases
All pull requests must pass CI checks before they can be merged. This ensures code quality and prevents breaking changes.
Build Matrix
Builds are tested on:- macOS 14 with Swift 6.2 (x86_64 and arm64)
- Ubuntu 22.04 with Swift 6.2 (x86_64 and arm64)
Submitting Changes
Pull Request Process
Commit Your Changes
Make meaningful commits:Use clear, descriptive commit messages that explain what and why.
Create Pull Request
Go to the List repository and create a pull request:
- Describe what your changes do
- Reference any related issues
- Explain your approach if complex
- Include screenshots for UI changes
Pull Request Template
Reporting Issues
Found a bug or have a feature request?Report Bug
Create a bug report with details and reproduction steps
Request Feature
Suggest a new feature or enhancement
Bug Report Template
Include the following information:- Description: Clear description of the bug
- Steps to reproduce: Exact commands to trigger the bug
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Environment:
- OS: (e.g., macOS 14.2, Ubuntu 22.04)
- Swift version: (output of
swift --version) - List version: (output of
sls --version)
- Additional context: Screenshots, logs, etc.
Community Guidelines
Code of Conduct
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Provide constructive feedback
- Focus on what is best for the project
- Accept constructive criticism gracefully
Communication
- Issues: Bug reports and feature requests
- Pull Requests: Code contributions
- Discussions: General questions and ideas
Resources
GitHub Repository
View source code and open issues
Swift Documentation
Learn more about Swift
ArgumentParser
CLI framework documentation
Swift Testing
Testing framework guide
Advanced Topics
Platform-Specific Code
When adding platform-specific features:Performance Considerations
- Use efficient file system APIs
- Avoid unnecessary file attribute queries
- Consider memory usage for large directories
- Profile performance for recursive operations
Security
- Never follow symbolic links without permission
- Handle permission errors gracefully
- Validate file paths
- Be careful with user-provided input
Next Steps
Ready to contribute?- Pick an issue from the GitHub issues page
- Comment on the issue to let others know you’re working on it
- Follow this guide to implement your changes
- Submit a pull request when ready