Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that aren't aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of excessive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource@github.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who don't follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html)

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq)
117 changes: 117 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Contributing to MaskerLogger

Thank you for your interest in contributing to MaskerLogger! We welcome contributions from the community.

## Getting Started

1. Fork the repository
2. Clone your fork: `git clone https://github.com/your-username/MaskerLogger.git`
3. Create a feature branch: `git checkout -b feature-branch`
4. Set up your development environment (see below)

## Development Setup

MaskerLogger uses Poetry for dependency management. We recommend using UV for faster installations.

```bash
# Install dependencies
poetry install

# Activate virtual environment
poetry shell

# Or use uv (if available)
uv pip install -e ".[dev]"
```

### Pre-commit Hooks

We use pre-commit to ensure code quality before commits. Install the hooks:

```bash
# Install pre-commit hooks
poetry run pre-commit install

# Run hooks manually on all files
poetry run pre-commit run --all-files
```

The pre-commit hooks will automatically:
- Run Ruff linting and formatting
- Run mypy type checking
- Check for trailing whitespace
- Validate YAML and TOML files
- Detect potential issues (large files, merge conflicts, private keys)
- Verify Poetry configuration

## Code Style

We use [Ruff](https://github.com/astral-sh/ruff) for linting and formatting, and [mypy](https://mypy.readthedocs.io/) for type checking:

```bash
# Run linting
poetry run ruff check .

# Run formatting
poetry run ruff format .

# Run type checking
poetry run mypy maskerlogger/
```

### Python Style Guidelines

- Use type annotations for all functions and classes
- Add docstrings to all functions and classes (PEP 257 convention)
- Files should be concise (typically < 250 lines)
- Functions should do one thing and be short
- Use meaningful names that reveal intent
- Follow the "return early" pattern instead of nested if/else
- Don't repeat yourself - abstract and reuse code

## Testing

We use pytest for testing. All tests must pass before submitting a PR.

```bash
# Run tests
poetry run pytest tests/

# Run tests with coverage
poetry run pytest tests/ --cov=maskerlogger --cov-report=html
```

### Test Guidelines

- Use pytest (NOT unittest module)
- Add type annotations to test functions
- Test names should be self-explanatory (no docstrings needed)
- All tests should be in the `./tests` directory
- Create `__init__.py` files as needed

## Submitting Changes

1. Ensure all tests pass
2. Pre-commit hooks will automatically run on commit (or run manually: `poetry run pre-commit run --all-files`)
3. If you haven't set up pre-commit, ensure code passes linting: `poetry run ruff check .`
4. Format your code: `poetry run ruff format .`
5. Commit your changes with a descriptive message and push
6. Open a Pull Request

## Pull Request Process

1. Fill out the PR template completely
2. Link any related issues
3. Ensure all CI checks pass
4. Wait for review from maintainers
5. Address any feedback
6. Once approved, a maintainer will merge your PR

## Questions?

If you have questions, feel free to:
- Open an issue for discussion
- Check existing issues and discussions
- Reach out to the maintainers

Thank you for contributing! 🎉
107 changes: 107 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Bug Report
description: Report a bug or unexpected behavior
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report this bug! Please fill out the form below.

- type: textarea
id: description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
placeholder: What happened?
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Steps to reproduce
description: Steps to reproduce the behavior
placeholder: |
1. Initialize MaskerFormatter with...
2. Log a message with...
3. Observe that...
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
placeholder: What should have happened?
validations:
required: true

- type: textarea
id: actual
attributes:
label: Actual behavior
description: What actually happened instead
placeholder: What actually happened?
validations:
required: true

- type: textarea
id: code
attributes:
label: Code example
description: Please provide a minimal code example that reproduces the issue
render: python
placeholder: |
from maskerlogger import MaskerFormatter
import logging

# Your code here

- type: input
id: version
attributes:
label: MaskerLogger version
description: What version of MaskerLogger are you using?
placeholder: "0.4.0"
validations:
required: true

- type: input
id: python-version
attributes:
label: Python version
description: What version of Python are you using?
placeholder: "3.11.0"
validations:
required: true

- type: input
id: os
attributes:
label: Operating System
description: What operating system are you using?
placeholder: "Ubuntu 22.04, macOS 14, Windows 11, etc."
validations:
required: true

- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context about the problem here (logs, screenshots, etc.)
placeholder: Any additional information that might help
validations:
required: false

- type: checkboxes
id: checklist
attributes:
label: Checklist
description: Please confirm the following
options:
- label: I have searched existing issues to ensure this is not a duplicate
required: true
- label: I have provided all requested information
required: true
78 changes: 78 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Feature Request
description: Suggest a new feature or enhancement
title: "[Feature]: "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for suggesting a new feature! Please fill out the form below.

- type: textarea
id: problem
attributes:
label: Is your feature request related to a problem?
description: A clear and concise description of what the problem is.
placeholder: I'm always frustrated when...
validations:
required: true

- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
placeholder: I would like to be able to...
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
placeholder: I've considered...
validations:
required: false

- type: textarea
id: example
attributes:
label: Code example
description: If applicable, provide a code example of how you envision using this feature
render: python
placeholder: |
from maskerlogger import MaskerFormatter

# Example of how the feature would work

- type: dropdown
id: priority
attributes:
label: How important is this feature to you?
options:
- Nice to have
- Important
- Critical
validations:
required: true

- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context, screenshots, or examples about the feature request here.
placeholder: Any additional information
validations:
required: false

- type: checkboxes
id: checklist
attributes:
label: Checklist
description: Please confirm the following
options:
- label: I have searched existing issues to ensure this feature hasn't been requested
required: true
- label: This feature aligns with the project's goals (masking sensitive data in logs)
required: true
Loading