From c26eea874d5fc20c0df8f784729979566a228620 Mon Sep 17 00:00:00 2001 From: realstealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Mon, 19 May 2025 11:36:54 +0000 Subject: [PATCH 1/2] Revert "chore: use annotations instead of in house linter (#2905)" (#2944) This reverts commit 41653de7183f12d5eab9fc4077125836f42e6c96. --- .github/workflows/approved-label.yml | 14 ++++---- .github/workflows/awesome_workflow.yml | 50 ++++++++++++++++++-------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/.github/workflows/approved-label.yml b/.github/workflows/approved-label.yml index 1d6a02abb25..9fbc5ed0ae8 100644 --- a/.github/workflows/approved-label.yml +++ b/.github/workflows/approved-label.yml @@ -5,10 +5,10 @@ jobs: name: Add "approved" label when approved runs-on: ubuntu-latest steps: - - name: Add "approved" label when approved - uses: abinoda/label-when-approved-action@v1.0.7 - env: - APPROVALS: "1" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ADD_LABEL: "approved" - REMOVE_LABEL: "" + - name: Add "approved" label when approved + uses: pullreminders/label-when-approved-action@master + env: + APPROVALS: "1" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ADD_LABEL: "approved" + REMOVE_LABEL: "" diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index 8a58d146766..70dd717fa33 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -1,28 +1,50 @@ name: Awesome CI Workflow on: [push, pull_request] permissions: - pull-requests: write contents: write - issues: write jobs: MainSequence: name: Code Formatter runs-on: ubuntu-latest - permissions: - pull-requests: write - contents: write - issues: write steps: - uses: actions/checkout@v4 - - uses: cpp-linter/cpp-linter-action@v2 - id: linter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - style: "file" - tidy-checks: ".clang-tidy" - thread-comments: ${{ github.event_name == 'pull_request' && 'update' }} + fetch-depth: 0 + - uses: actions/setup-python@v4 + - name: requirements + run: | + sudo apt-get -qq update + sudo apt-get -qq install clang-tidy clang-format + # checks are passing with less errors when used with this version. + # The default installs v6.0 which did not work out well in my tests + - name: Setup Git Specs + run: | + git config --global user.name github-actions[bot] + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Filename Formatter + run: | + wget https://raw.githubusercontent.com/TheAlgorithms/scripts/main/filename_formatter.sh + chmod +x filename_formatter.sh + ./filename_formatter.sh . .cpp,.hpp + - name: Get file changes + run: | + git branch + git diff --diff-filter=dr --name-only origin/master > git_diff.txt + echo "Files changed-- `cat git_diff.txt`" + - name: Configure for static lint checks + # compiling first gives clang-tidy access to all the header files and settings used to compile the programs. + # This will check for macros, if any, on linux and not for Windows. But the use of portability checks should + # be able to catch any errors for other platforms. + run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: Lint modified files + shell: bash + run: python3 scripts/file_linter.py + - name: Commit and push changes + run: | + git diff DIRECTORY.md + git commit -am "clang-format and clang-tidy fixes for ${GITHUB_SHA::8}" || true + git push origin HEAD:$GITHUB_REF || true build: name: Compile checks @@ -37,8 +59,6 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: GCC problem matcher - uses: ammaraskar/gcc-problem-matcher@0.3.0 - run: | cmake -B ./build -S . cmake --build build --parallel 4 From 3f6876f03fd8dbe62f59c64e499c0d8b2ee7427b Mon Sep 17 00:00:00 2001 From: jiya <122276932+jiya10208@users.noreply.github.com> Date: Mon, 19 May 2025 17:13:50 +0530 Subject: [PATCH 2/2] Update merge_sort.cpp (#2818) Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com> --- sorting/merge_sort.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sorting/merge_sort.cpp b/sorting/merge_sort.cpp index 74087491bef..c2a9fde7c19 100644 --- a/sorting/merge_sort.cpp +++ b/sorting/merge_sort.cpp @@ -11,7 +11,10 @@ * Merge Sort is an efficient, general purpose, comparison * based sorting algorithm. * Merge Sort is a divide and conquer algorithm - * + * Time Complexity: O(n log n) + * It is same for all best case, worst case or average case + * Merge Sort is very efficient when for the small data. + * In built-in sort function merge sort along with quick sort is used. */ #include