|
| 1 | +# Copilot Instructions for TheAlgorithms/R |
| 2 | + |
| 3 | +## General Guidelines |
| 4 | + |
| 5 | +This repository contains implementations of various algorithms in R. All contributions should follow these guidelines to maintain code quality and consistency. |
| 6 | + |
| 7 | +## Code Quality & Functionality |
| 8 | + |
| 9 | +- Ensure that your code is functional and well-structured before submitting |
| 10 | +- The code should run without errors in an R environment and produce the expected output |
| 11 | +- Follow best practices for efficiency, readability, and maintainability |
| 12 | +- Use consistent and meaningful variable names (use `.` or `_` to separate words, e.g., `results.df` for a data frame) |
| 13 | + |
| 14 | +## Adding New Algorithms |
| 15 | + |
| 16 | +When adding a new algorithm: |
| 17 | +- **Verify that the algorithm is not already implemented** in the repository (including under a different name) |
| 18 | +- **Confirm that the proposed algorithm is a recognized computer-science algorithm**, not a problem-specific adaptation of a general technique (e.g., tuned for LeetCode or other competitive-programming problems) |
| 19 | +- Include a brief explanation of the algorithm in the file as comments |
| 20 | +- Add an example showcasing its usage (can be commented within the script) |
| 21 | +- **Update DIRECTORY.md** to include the new algorithm in the appropriate section |
| 22 | + |
| 23 | +## Modifying Existing Algorithms |
| 24 | + |
| 25 | +When modifying existing algorithms: |
| 26 | +- Clearly document the changes in your pull request description |
| 27 | +- Ensure that your modifications do not break existing functionality |
| 28 | +- If applicable, update or add test cases to validate your changes |
| 29 | + |
| 30 | +## File Naming & Structure Conventions |
| 31 | + |
| 32 | +- **All code file names must use lowercase `.r` extension** (not `.R`) |
| 33 | +- Ensure that filenames follow the existing directory structure and naming patterns |
| 34 | +- Files should be placed in the appropriate category directory (e.g., `sorting_algorithms/`, `graph_algorithms/`, `mathematics/`) |
| 35 | + |
| 36 | +## Documentation & Comments |
| 37 | + |
| 38 | +- Provide clear and concise documentation in the form of comments within the code |
| 39 | +- Add a brief docstring at the beginning of the script explaining: |
| 40 | + - What the algorithm does |
| 41 | + - The expected input and output |
| 42 | + - Any dependencies required |
| 43 | + |
| 44 | +## Testing & Verification |
| 45 | + |
| 46 | +Before submitting a pull request, verify that your code: |
| 47 | +- Runs correctly with different test cases |
| 48 | +- Does not produce unnecessary warnings or errors |
| 49 | +- If applicable, add a test file demonstrating the algorithm's correctness |
| 50 | + |
| 51 | +## Pull Request Review Checklist |
| 52 | + |
1 | 53 | When reviewing a pull request: |
2 | | -- Verify that any added algorithms or data structures aren’t already implemented elsewhere in the repository (including under a different name). |
3 | | -- Confirm that the proposed algorithm is a recognized computer-science algorithm, not a problem-specific adaptation of a general technique (e.g., tuned for LeetCode or other competitive-programming problems). |
4 | | -- Check that the extension of all code file names is a lowercase r. |
5 | | -- Check that DIRECTORY.md was updated correctly. |
| 54 | +- Verify that any added algorithms or data structures aren't already implemented elsewhere in the repository (including under a different name) |
| 55 | +- Confirm that the proposed algorithm is a recognized computer-science algorithm, not a problem-specific adaptation of a general technique (e.g., tuned for LeetCode or other competitive-programming problems) |
| 56 | +- Check that the extension of all code file names is a lowercase `.r` |
| 57 | +- Check that DIRECTORY.md was updated correctly |
| 58 | +- Verify that the code includes appropriate documentation and examples |
| 59 | +- Ensure that variable naming follows repository conventions |
0 commit comments