Contributing to Sidef

Thank you for your interest in contributing to Sidef! We appreciate your support in making this modern programming language better for everyone.

Table of Contents

Code of Conduct

By participating in this project, you agree to maintain a respectful and inclusive environment. We expect all contributors to:

Getting Started

  1. Familiarize yourself with Sidef:

  2. Set up your environment:

    • Fork the repository on GitHub
    • Clone your fork locally
    • Install dependencies (see Development Setup)
  3. Find something to work on:

    • Check the Issues page
    • Look for issues labeled good first issue or help wanted
    • Review the TODO file

How Can I Contribute?

Reporting Bugs

Before creating a bug report, please check existing issues to avoid duplicates. When filing a bug report, include:

Required Information:

Example:

## Bug: Division by zero not properly caught

**Version:** Sidef 25.12
**OS:** Ubuntu 22.04
**Perl:** 5.34.0

**Code:**

```ruby
say (10 / 0)
```

**Expected:** Error message about division by zero
**Actual:** [paste actual output]

Suggesting Enhancements

We welcome suggestions for new features! Please include:

Code Contributions

We accept contributions in several areas:

Core Language Features:

Standard Library:

Tools and Utilities:

Documentation

Documentation contributions are highly valued:

Examples and Scripts

Share your Sidef code:

Development Setup

Prerequisites

Installation for Development

# Clone your fork
git clone https://github.com/YOUR_USERNAME/sidef.git
cd sidef

# Add upstream remote
git remote add upstream https://github.com/trizen/sidef.git

# Install dependencies
perl Build.PL
./Build installdeps

# Build
./Build

# Run tests
./Build test

# Install locally (optional)
./Build install

Running Sidef from Source

# Run directly from the bin directory
./bin/sidef your_script.sf

# Or add to your PATH
export PATH="$PWD/bin:$PATH"
sidef your_script.sf

Style Guidelines

Sidef Code Style

When writing Sidef code examples:

# Good
func fibonacci(n) {
    n < 2 ? n : (__FUNC__(n-1) + __FUNC__(n-2))
}

# Also good with clear formatting
func factorial(n) {
    n == 0 ? 1
           : (n * __FUNC__(n - 1))
}

Perl Code Style (for core development)

Commit Messages

Write clear, descriptive commit messages:

Brief summary (50 chars or less)

More detailed explanation if needed. Wrap at 72 characters.
Explain what changed and why, not just what was done.

- Bullet points are okay
- Use present tense: "Add feature" not "Added feature"
- Reference issues: "Fixes #123" or "Relates to #456"

Examples:

Testing

Running Tests

# Run all tests
./Build test

# Run specific test file
prove -v t/specific_test.t

# Run tests verbosely
./Build test verbose=1

Writing Tests

When adding new features:

  1. Add tests in the t/ directory
  2. Follow existing test file patterns
  3. Test both success and failure cases
  4. Include edge cases
  5. Ensure tests are reproducible

Example test structure:

#!/usr/bin/perl

use 5.016;
use strict;
use warnings;

use Test::More tests => 3;

# Your tests here
is($result, $expected, "Test description");

Test Coverage

Pull Request Process

Before Submitting

  1. Create a feature branch:

    git checkout -b feature/your-feature-name
    
  2. Make your changes:

    • Follow the style guidelines
    • Add tests for new features
    • Update documentation as needed
  3. Test thoroughly:

    ./Build test
    
  4. Commit with clear messages:

    git commit -m "Add feature: description"
    
  5. Update your branch:

    git fetch upstream
    git rebase upstream/master
    

Submitting the Pull Request

  1. Push to your fork:

    git push origin feature/your-feature-name
    
  2. Create the PR:

    • Go to the repository on GitHub
    • Click "New Pull Request"
    • Select your branch
    • Fill out the PR template
  3. PR Description should include:

    • What changes were made
    • Why these changes are needed
    • How to test the changes
    • References to related issues
    • Screenshots (if UI changes)

PR Template Example

## Description
Brief description of changes

## Motivation
Why is this change needed?

## Changes Made
- Change 1
- Change 2
- Change 3

## Testing
How to test these changes

## Related Issues
Fixes #123
Relates to #456

## Checklist
- [ ] Tests pass locally
- [ ] Documentation updated
- [ ] CHANGES file updated (if applicable)
- [ ] Code follows style guidelines

Review Process

After Merging

Community

Getting Help

Staying Updated

Recognition

Contributors are recognized in:

Resources

Questions?

If you have questions about contributing, feel free to:

Thank you for contributing to Sidef! Your efforts help make Sidef better for everyone.

License: By contributing to Sidef, you agree that your contributions will be licensed under the Artistic License 2.0.