diff --git a/.github/ISSUE_TEMPLATE/bug_repport.yaml b/.github/ISSUE_TEMPLATE/bug_repport.yaml index 804441c..6d709d3 100644 --- a/.github/ISSUE_TEMPLATE/bug_repport.yaml +++ b/.github/ISSUE_TEMPLATE/bug_repport.yaml @@ -1,17 +1,20 @@ name: Bug Report description: File a bug report. -title: 'Enter a short title that describes the issue' # Placeholder for the user to edit +title: 'Enter a short title that describes the issue' labels: [bug] body: - type: dropdown attributes: - label: Severity + label: Type options: - - ๐Ÿ”ฅ Blocker - - ๐Ÿ›‘ Major - - โš ๏ธ Minor - - โ“ Not sure + - ๐Ÿงฎ Algorithm Implementation + - ๐Ÿ›  CI/Tooling Issue + - ๐Ÿ“˜ Algorithm Documentation + - ๐Ÿ–‹ General Documentation + - ๐Ÿงช Test Failure or Adding Testcase + - โ“ Other / Not Sure + default: 0 validations: required: true diff --git a/.github/workflows/auto-fill-algo-name.yaml b/.github/workflows/auto-fill-algo-name.yaml deleted file mode 100644 index 1d2614f..0000000 --- a/.github/workflows/auto-fill-algo-name.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Auto-fill Algorithm Title - -on: - issues: - types: [opened] - -permissions: - issues: write - -jobs: - update-issue-title: - runs-on: ubuntu-latest - steps: - - name: Parse markdown and update title - uses: actions/github-script@v7 - with: - script: | - const issueBody = context.payload.issue.body; - console.log("Issue Body:\n", issueBody); - - // Match the content under the "### Algo_Name" section - const match = /### Algo_Name\s*\n+(.+?)(\n+###|\n*$)/s.exec(issueBody); - if (!match) { - console.log("๐Ÿšซ Could not find algo name in Markdown."); - return; - } - - const algoName = match[1].trim(); - const issueNumber = context.issue.number; - const newTitle = `โœจ Implement ${algoName}`; - - console.log(`โœ… Extracted algo name: ${algoName}`); - console.log(`๐Ÿ”ง Updating issue title to: ${newTitle}`); - - await github.rest.issues.update({ - ...context.repo, - issue_number: issueNumber, - title: newTitle - }); diff --git a/.github/workflows/auto-fill-bug-title.yaml b/.github/workflows/auto-fill-bug-title.yaml deleted file mode 100644 index 04c8b48..0000000 --- a/.github/workflows/auto-fill-bug-title.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: Auto-fill Bug Title - -on: - issues: - types: [opened] - -permissions: - issues: write - -jobs: - update-issue-title: - runs-on: ubuntu-latest - steps: - - name: Extract severity and bug title from Markdown - uses: actions/github-script@v7 - with: - script: | - const body = context.payload.issue.body; - console.log("Issue Body:\n", body); - - const severityMatch = /### Severity\s+(.+?)\s+(###|$)/s.exec(body); - const severity = severityMatch ? severityMatch[1].trim() : null; - - const rawTitle = context.payload.issue.title; - - if (!severityMatch) { - console.log("๐Ÿšซ Could not find severity in Markdown."); - return; - } - - const severityMap = { - "๐Ÿ”ฅ Blocker": "๐Ÿ”ฅ", - "๐Ÿ›‘ Major": "๐Ÿ›‘", - "โš ๏ธ Minor": "โš ๏ธ", - "โ“ Not sure": "โ“" - }; - const severityIcon = severityMap[severity] || "โ“"; - - if (rawTitle.startsWith("๐Ÿ”ฅ") || rawTitle.startsWith("๐Ÿ›‘") || rawTitle.startsWith("โš ๏ธ") || rawTitle.startsWith("โ“")) { - console.log("โœ… Title already formatted correctly."); - return; - } - - const issueNumber = context.issue.number; - const updatedTitle = `${severityIcon} [Bug]: ${rawTitle}`; - - console.log(`โœ… Updating title to: ${updatedTitle}`); - - await github.rest.issues.update({ - ...context.repo, - issue_number: issueNumber, - title: updatedTitle - }); diff --git a/.github/workflows/code-tester.yaml b/.github/workflows/code-tester.yaml new file mode 100644 index 0000000..04dbacc --- /dev/null +++ b/.github/workflows/code-tester.yaml @@ -0,0 +1,27 @@ +name: Code Tester + +on: + pull_request: + branches: #[ master ] + - ** + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Download Repo In Docker + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run tests + run: pytest tests --collect-only diff --git a/.github/workflows/issue-Automatic-renaming.yaml b/.github/workflows/issue-Automatic-renaming.yaml new file mode 100644 index 0000000..a7ae476 --- /dev/null +++ b/.github/workflows/issue-Automatic-renaming.yaml @@ -0,0 +1,81 @@ +name: Issue Automatic Renaming + +on: + issues: + types: [opened, edited] + +permissions: + issues: write + +jobs: + rename-issue: + runs-on: ubuntu-latest + steps: + - name: Rename for New Algo Issues + uses: actions/github-script@v7 + if: contains(github.event.issue.body, '### Algo_Name') + with: + script: | + const issueBody = context.payload.issue.body; + console.log("Issue Body:\n", issueBody); + + const match = /### Algo_Name\s*\n+(.+?)(\n+###|\n*$)/s.exec(issueBody); + if (!match) { + console.log("๐Ÿšซ Could not find algo name in Markdown."); + return; + } + + const algoName = match[1].trim(); + const issueNumber = context.issue.number; + const newTitle = `โœจ Implement ${algoName}`; + + console.log(`๐Ÿ”ง Updating issue title to: ${newTitle}`); + + await github.rest.issues.update({ + ...context.repo, + issue_number: issueNumber, + title: newTitle + }); + + - name: Rename for Bug Report Issues + uses: actions/github-script@v7 + if: contains(github.event.issue.body, '### Type') + with: + script: | + const body = context.payload.issue.body; + console.log("Issue Body:\n", body); + + const typeMatch = /### Type\s+(.+?)\s*(###|$)/s.exec(body); + const Type = typeMatch ? typeMatch[1].trim() : null; + + if (!Type) { + console.log("๐Ÿšซ Could not find Type in Markdown."); + return; + } + + const typeMap = { + "๐Ÿงฎ Algorithm Implementation": "๐Ÿงฎ", + "๐Ÿ›  CI/Tooling Issue": "๐Ÿ› ", + "๐Ÿ“˜ Algorithm Documentation": "๐Ÿ“˜", + "๐Ÿ–‹ General Documentation": "๐Ÿ–‹", + "๐Ÿงช Test Failure or Adding Testcase": "๐Ÿงช", + "โ“ Other / Not Sure": "โ“", + }; + const typeIcon = typeMap[Type] || "โ“"; + + const rawTitle = context.payload.issue.title; + if (rawTitle.startsWith("๐Ÿ”ฅ") || rawTitle.startsWith("๐Ÿ›‘") || rawTitle.startsWith("โš ๏ธ") || rawTitle.startsWith("โ“")) { + console.log("โœ… Title already formatted correctly."); + return; + } + + const issueNumber = context.issue.number; + const updatedTitle = `โš ๏ธ - ${typeIcon} [Bug]: ${rawTitle}`; + + console.log(`๐Ÿ”ง Updating issue title to: ${updatedTitle}`); + + await github.rest.issues.update({ + ...context.repo, + issue_number: issueNumber, + title: updatedTitle + }); diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 19526db..2ffa561 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -6,29 +6,18 @@ We welcome all kinds of contributionsโ€”whether you're fixing bugs, improving do ## โœ… What you can contribute +- Report bug - Add a new algorithm or data structure - Improve or correct existing implementations - Write or update documentation - Add test cases or enhance test coverage -- Fix typos or bugs +- Fix typos -## Guidelines +## How to contribut -- **Coding Standards:** - Follow clean and consistent coding practices. Use meaningful variable and function names. +Every change in the repository should be merged throught [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests). All commit execute [Ruff](https://docs.astral.sh/ruff/) to insure the some level of coding standart. -- **Document Your Code:** - Ensure all functions have clear and concise comments/description. - -- **Test Your Changes:** - While we understand that fully testing this library may be challenging, ensure your code works as intended before submitting. Focus on edge cases and confirm that your changes integrate smoothly with existing functionality. - -- **Be Respectful**: - Engage in discussions respectfully and constructively. - -- **Follow The File Structure Templates**: Each Algorithm should have its own file in **scr** with: A README based on the template and the python file. Parallel to that you should create another file inside tests with a python file torun the tests and a YAML file to store the tests cases. - -## Before Contributing +### Before Contributing Before making the first commit of the session, you should set up the **pre-commit** framework and activate the **virtual environment**. This has to be done for each new session. @@ -43,6 +32,52 @@ Before making the first commit of the session, you should set up the **pre-commi pre-commit install ``` +### Implementing a new algorithm + +Before implementing a new algorithm. The Python virtual environment should include [rich](https://pypi.org/project/rich/) and [pytest](https://pypi.org/project/pytest/). In order to do it, run the commend below. + +```bash +pip install -r requirements.txt +``` + +Every algorithm implementation should have a dedicated **issue**. This issue should be build with the **Implement Algorithm** issue form. If no issue exist for the specific algorithm to be implemented create one. Every file inside the new repository and the **test file** should follow the file structure inside [File Structure](#๐Ÿ“-file-structure) section. + +All algorithm should be accompanied with a **README.md** file. This file should follow the template in the [Algorithm README.md](#algorithm-readme) section. + +Every algorithm should be tested using [pytest](https://docs.pytest.org/en/stable/). + +## ๐Ÿ› Bug Report + +To report a bug, simply create a new issue using the **Bug Report** form and fill out all sections. +The form is straightforward, but if youโ€™d like a bit more guidance, follow the steps below. ๐Ÿ‘‡ + +### ๐Ÿ“ Steps to Report a Bug + +1. **Enter a clear, short title** + Use a short, clear title that describes the issue. + + > Example: `Crash when clicking the login button` + +2. **What type of issue is this? (Bug Type)** +- ๐Ÿงฎ Algorithm Implementation - The logic or output of an algorithm is incorrect. +- ๐Ÿ›  CI/Tooling Issue - Problems with continuous integration or scripts. +- ๐Ÿ“˜ Algorithm Documentation - Missing or incorrect explanations/comments for an algorithm. +- ๐Ÿ–‹ General Documentation - Typos, formatting, or missing information inside documentation that is not related to an algorithm. +- ๐Ÿงช Test Failure or Adding Testcase - Broken tests or missing edge case coverage. +- โ“ Other / Not Sure - Youโ€™re unsure how bad it is or some other kind of issue. + +3. **In the Steps to Reproduce & What Happens section:** + +- List step-by-step instructions to trigger the bug +- Describe what actually happens + +4. **Describe what you expected to happen(Expected Behavior):** + In the Expected Behavior section, explain what you thought would happen instead. + +5. **Create the issue:** + Once you create the issue, our system will automatically format the title. + This formatting takes about 4 seconds. + ## ๐Ÿ“ File Structure When adding a new algorithm, follow this structure: @@ -75,7 +110,7 @@ AlgoHub/ ``` -### Algorithm README.md +### Algorithm README The README.md inside the **New_Algorithm** folder should follow the following template. @@ -153,34 +188,3 @@ The README.md inside the **New_Data_Structure** folder should follow the followi - **Search**: ``` - -## ๐Ÿ› Bug Report - -To report a bug, simply create a new issue using the **Bug Report** form and fill out all sections. -The form is straightforward, but if youโ€™d like a bit more guidance, follow the steps below. ๐Ÿ‘‡ - -### ๐Ÿ“ Steps to Report a Bug - -1. **Enter a clear, short title** - Use a short, clear title that describes the issue. - - > Example: `Crash when clicking the login button` - -2. **Choose how serious the issue is (severity):** - -- ๐Ÿ”ฅ Blocker โ€“ Completely breaks core functionality -- ๐Ÿ›‘ Major โ€“ Important features arenโ€™t working -- โš ๏ธ Minor โ€“ Small issues or annoyances -- โ“ Not sure โ€“ Youโ€™re unsure how bad it is - -3. **In the Steps to Reproduce & What Happens section:** - -- List step-by-step instructions to trigger the bug -- Describe what actually happens - -4. **Describe what you expected to happen(Expected Behavior):** - In the Expected Behavior section, explain what you thought would happen instead. - -5. **Create the issue:** - Once you create the issue, our system will automatically format the title. - This formatting takes about 4 seconds. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e885f2f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +numpy +rich +pytest diff --git a/tests/datastructures/stack/test_stack.py b/tests/datastructures/stack/test_stack.py index 6f22ede..bdb9d81 100644 --- a/tests/datastructures/stack/test_stack.py +++ b/tests/datastructures/stack/test_stack.py @@ -122,4 +122,4 @@ def test_string_representation() -> None: assert "Stack" in rep assert "3" in rep assert "2" in rep - assert "1" in rep + assert "1" in rep \ No newline at end of file