Skip to content

πŸ“š Add sdd and contributing guidelines to the documentation #1708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ Before you submit your pull request, please make sure you have completed the fol
- [ ] πŸ“‹ I have summarized my changes in the [CHANGELOG](https://github.com/openvinotoolkit/anomalib/blob/main/CHANGELOG.md) and followed the guidelines for my type of change (skip for minor changes, documentation updates, and test enhancements).
- [ ] πŸ“š I have made the necessary updates to the documentation (if applicable).
- [ ] πŸ§ͺ I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).

For more information about code review checklists, see the [Code Review Checklist](../docs/source/markdown/guides/developer/code_review_checklist.md).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions docs/source/markdown/guides/developer/code_review_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Code Review Checklist

This checklist is a guide for reviewing code changes. It can be used as a reference for both authors and reviewers to
ensure that the code meets the project's standards and requirements.

## Code Quality

- Is the code clear and understandable?
- Does the code follow the project's coding conventions and style guide (naming conventions, spacing, indentation, etc.)?
- Are there any redundant or unnecessary parts of the code?
- Is there duplicated code that could be refactored into a reusable function/method?
- Are there any magic numbers or strings that should be constants or configurations?

## Architecture and Design

- Is the code change consistent with the overall architecture of the system?
- Are the classes, modules, and functions well-organized and appropriately sized?
- Are design patterns used appropriately and consistently?
- Does the change introduce any potential scalability issues?
- Is there a clear separation of concerns (e.g., UI, business logic, data access)?

## Functionality

- Does the code do what it's supposed to do?
- Are all edge cases considered and handled?
- Is there any dead or commented-out code that should be removed?
- Are there any debugging or logging statements that need to be removed or adjusted?

## Security

- Are all data inputs validated and sanitized to prevent SQL injection, XSS, etc.?
- Are passwords and sensitive data properly encrypted or secured?
- Are there any potential security vulnerabilities introduced or exposed by the code change?
- Is authentication and authorization handled properly?

## Performance

- Are there any obvious performance issues or bottlenecks?
- Is the code optimized for time and space complexity where necessary?
- Are large data sets or files handled efficiently?
- Is caching implemented appropriately?

## Testing

- Are there unit tests covering the new functionality or changes?
- Do the existing tests need to be updated or extended?
- Is there appropriate error handling and logging in the tests?
- Do all tests pass?
- Is there enough coverage for critical paths in the code?

## Documentation and Comments

- Is the new code adequately commented for clarity?
- Is the documentation (README, API docs, inline comments) updated to reflect the changes?
- Are complex algorithms or decisions well-explained?
- Are there any assumptions or limitations that need to be documented?

## Compatibility

- Is the code compatible with all targeted environments (operating systems, browsers, devices)?
- Does the change maintain backward compatibility or is a migration path provided?
- Are there any dependencies added or updated? If so, are they necessary and properly vetted?

## Reviewer's General Feedback

- Provide any general feedback or suggestions for improvements.
- Highlight any areas of excellence or particularly clever solutions.
97 changes: 97 additions & 0 deletions docs/source/markdown/guides/developer/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Contribution Guidelines

## Β {octicon}`light-bulb` Getting Started

To get started with Anomalib development, follow these steps:

### {octicon}`repo-forked` Fork and Clone the Repository

First, fork the Anomalib repository by following the GitHub documentation on [forking a repo](https://docs.github.com/en/enterprise-cloud@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo). Then, clone your forked repository to your local machine and create a new branch from `main`.

### {octicon}`gear` Set Up Your Development Environment

Set up your development environment to start contributing. This involves installing the required dependencies and setting up pre-commit hooks for code quality checks. Note that this guide assumes you are using [Conda](https://docs.conda.io/en/latest/) for package management. However, the steps are similar for other package managers.

:::{dropdown} Development Environment Setup Instructions
:icon: gear

1. Create and activate a new Conda environment:

```bash
conda create -n anomalib_dev python=3.10
conda activate anomalib_dev
```

Install the base and development requirements:

```bash
pip install -r requirements/base.txt -r requirements/dev.txt
```

Optionally, for a full installation with all dependencies:

```bash
pip install -e .[all]
```

2. Install and configure pre-commit hooks:

```bash
pre-commit install
```

Pre-commit hooks help ensure code quality and consistency. After each commit,
`pre-commit` will automatically run the configured checks for the changed file.
If you would like to manually run the checks for all files, use:

```bash
pre-commit run --all-files
```

To bypass pre-commit hooks temporarily (e.g., for a work-in-progress commit), use:

```bash
git commit -m 'WIP commit' --no-verify
```

However, make sure to address any pre-commit issues before finalizing your pull request.

:::

## {octicon}`diff` Making Changes

1. **Write Code:** Follow the project's coding standards and write your code with clear intent. Ensure your code is well-documented and includes examples where appropriate. For code quality we use ruff, whose configuration is in [`pyproject.toml`](https://github.com/openvinotoolkit/anomalib/blob/main/pyproject.toml) file.

2. **Add Tests:** If your code includes new functionality, add corresponding tests using [pytest](https://docs.pytest.org/en/7.4.x/) to maintain coverage and reliability.

3. **Update Documentation:** If you've changed APIs or added new features, update the documentation accordingly. Ensure your docstrings are clear and follow [Google's docstring guide](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings).

4. **Pass Tests and Quality Checks:** Ensure the test suite passes and that your code meets quality standards by running:

```bash
pre-commit run --all-files
pytest tests/
```

5. **Update the Changelog:** For significant changes, add a summary to the [CHANGELOG](https://github.com/openvinotoolkit/anomalib/blob/main/CHANGELOG.md).

6. **Check Licensing:** Ensure you own the code or have rights to use it, adhering to appropriate licensing.

7. **Sign Your Commits:** Use signed commits to certify that you have the right to submit the code under the project's license:

```bash
git commit -S -m "Your detailed commit message"
```

For more on signing commits, see [GitHub's guide on signing commits](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits).

## {octicon}`git-pull-request` Submitting Pull Requests

Once you've followed the above steps and are satisfied with your changes:

1. Push your changes to your forked repository.
2. Go to the original Anomalib repository you forked and click "New pull request".
3. Choose your fork and the branch with your changes to open a pull request.
4. Fill in the pull request template with the necessary details about your changes.

We look forward to your contributions!
108 changes: 23 additions & 85 deletions docs/source/markdown/guides/developer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,36 @@

This section contains information for developers who want to contribute to Anomalib.

## Β {octicon}`light-bulb` Getting Started
::::{grid} 1

To get started with Anomalib development, follow these steps:

### {octicon}`repo-forked` Fork and Clone the Repository

First, fork the Anomalib repository by following the GitHub documentation on [forking a repo](https://docs.github.com/en/enterprise-cloud@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo). Then, clone your forked repository to your local machine and create a new branch from `main`.

### {octicon}`gear` Set Up Your Development Environment

Set up your development environment to start contributing. This involves installing the required dependencies and setting up pre-commit hooks for code quality checks. Note that this guide assumes you are using [Conda](https://docs.conda.io/en/latest/) for package management. However, the steps are similar for other package managers.

:::{dropdown} Development Environment Setup Instructions
:icon: gear

1. Create and activate a new Conda environment:

```bash
conda create -n anomalib_dev python=3.10
conda activate anomalib_dev
```

Install the base and development requirements:

```bash
pip install -r requirements/base.txt -r requirements/dev.txt
```

Optionally, for a full installation with all dependencies:

```bash
pip install -e .[all]
```

2. Install and configure pre-commit hooks:

```bash
pre-commit install
```

Pre-commit hooks help ensure code quality and consistency. After each commit,
`pre-commit` will automatically run the configured checks for the changed file.
If you would like to manually run the checks for all files, use:

```bash
pre-commit run --all-files
```

To bypass pre-commit hooks temporarily (e.g., for a work-in-progress commit), use:

```bash
git commit -m 'WIP commit' --no-verify
```

However, make sure to address any pre-commit issues before finalizing your pull request.
:::{grid-item-card} {octicon}`book` Anomalib Software Design Document.
:link: ./sdd
:link-type: doc

Learn more about the architecture, components, and design decisions of Anomalib.
:::

## {octicon}`diff` Making Changes

1. **Write Code:** Follow the project's coding standards and write your code with clear intent. Ensure your code is well-documented and includes examples where appropriate. For code quality we use ruff, whose configuration is in [`pyproject.toml`](https://github.com/openvinotoolkit/anomalib/blob/main/pyproject.toml) file.

2. **Add Tests:** If your code includes new functionality, add corresponding tests using [pytest](https://docs.pytest.org/en/7.4.x/) to maintain coverage and reliability.

3. **Update Documentation:** If you've changed APIs or added new features, update the documentation accordingly. Ensure your docstrings are clear and follow [Google's docstring guide](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings).
:::{grid-item-card} {octicon}`repo-forked` Contribution Guidelies.
:link: ./contributing
:link-type: doc

4. **Pass Tests and Quality Checks:** Ensure the test suite passes and that your code meets quality standards by running:

```bash
pre-commit run --all-files
pytest tests/
```

5. **Update the Changelog:** For significant changes, add a summary to the [CHANGELOG](https://github.com/openvinotoolkit/anomalib/blob/main/CHANGELOG.md).

6. **Check Licensing:** Ensure you own the code or have rights to use it, adhering to appropriate licensing.

7. **Sign Your Commits:** Use signed commits to certify that you have the right to submit the code under the project's license:

```bash
git commit -S -m "Your detailed commit message"
```
Learn how to contribute to Anomalib.
:::

For more on signing commits, see [GitHub's guide on signing commits](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits).
:::{grid-item-card} {octicon}`code-review` Code Review Checklist.
:link: ./code_review_checklist
:link-type: doc

## {octicon}`git-pull-request` Submitting Pull Requests
Learn the criteria for reviewing code.
:::

Once you've followed the above steps and are satisfied with your changes:
::::

1. Push your changes to your forked repository.
2. Go to the original Anomalib repository you forked and click "New pull request".
3. Choose your fork and the branch with your changes to open a pull request.
4. Fill in the pull request template with the necessary details about your changes.
```{toctree}
:caption: Data
:hidden:

We look forward to your contributions!
./sdd
./contributing
./code_review_checklist
```
Loading