From f7c77a9c8f391dc959ed6008e88e6dd6abdd49dc Mon Sep 17 00:00:00 2001 From: Aaron Dill Date: Mon, 22 Jul 2024 15:26:35 -0500 Subject: [PATCH 1/5] chore: add comments on pr suggesting formatting This commit adds a step to the lua-format-check-pr job that will leave a comment with "suggested changes" when formatting needs to be applied. This can then be applied with one click (per file). Alternatively, I could change it to automattically add a commit that formats the code. Several PRs have gotten through without proper formatting, which makes all future PRs fail the checks. --- .github/workflows/lua-format-check-pr.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/lua-format-check-pr.yml b/.github/workflows/lua-format-check-pr.yml index dcf2e17..91af71f 100644 --- a/.github/workflows/lua-format-check-pr.yml +++ b/.github/workflows/lua-format-check-pr.yml @@ -3,6 +3,11 @@ on: pull_request: paths: - "**.lua" +permissions: + contents: read + checks: write + issues: write + pull-requests: write jobs: format_code: runs-on: ubuntu-latest @@ -13,3 +18,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} version: latest args: --check . + - name: suggester + uses: reviewdog/action-suggester@v1 + with: + tool_name: stylua From 6aa401a7081b3964ba248a53e20f8b886d8b3f4e Mon Sep 17 00:00:00 2001 From: Aaron Dill Date: Mon, 22 Jul 2024 15:35:57 -0500 Subject: [PATCH 2/5] fix: add styluaignore to protect third_party submodule --- .github/workflows/lua-format-check-pr.yml | 2 +- .styluaignore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .styluaignore diff --git a/.github/workflows/lua-format-check-pr.yml b/.github/workflows/lua-format-check-pr.yml index 91af71f..8db3e0f 100644 --- a/.github/workflows/lua-format-check-pr.yml +++ b/.github/workflows/lua-format-check-pr.yml @@ -17,7 +17,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} version: latest - args: --check . + args: . - name: suggester uses: reviewdog/action-suggester@v1 with: diff --git a/.styluaignore b/.styluaignore new file mode 100644 index 0000000..4fb17e9 --- /dev/null +++ b/.styluaignore @@ -0,0 +1 @@ +lua/tabnine/third_party/ From 8bd8a97716b46e4794c8335c63a1f5f1b5edf5b8 Mon Sep 17 00:00:00 2001 From: Aaron Dill Date: Mon, 22 Jul 2024 15:40:21 -0500 Subject: [PATCH 3/5] fix: permissions in workflow --- .github/workflows/lua-format-check-pr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lua-format-check-pr.yml b/.github/workflows/lua-format-check-pr.yml index 8db3e0f..8cf5ce3 100644 --- a/.github/workflows/lua-format-check-pr.yml +++ b/.github/workflows/lua-format-check-pr.yml @@ -3,14 +3,14 @@ on: pull_request: paths: - "**.lua" -permissions: - contents: read - checks: write - issues: write - pull-requests: write jobs: format_code: runs-on: ubuntu-latest + permissions: + contents: read + checks: write + issues: write + pull-requests: write steps: - uses: actions/checkout@v4 - uses: JohnnyMorganz/stylua-action@v4 From 6a7d67d3051e53e71243ccc08cbe0cdea0d40e6d Mon Sep 17 00:00:00 2001 From: Aaron Dill Date: Mon, 22 Jul 2024 16:05:30 -0500 Subject: [PATCH 4/5] fix: fail_on_error --- .github/workflows/lua-format-check-pr.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lua-format-check-pr.yml b/.github/workflows/lua-format-check-pr.yml index 8cf5ce3..b67a873 100644 --- a/.github/workflows/lua-format-check-pr.yml +++ b/.github/workflows/lua-format-check-pr.yml @@ -3,14 +3,14 @@ on: pull_request: paths: - "**.lua" +permissions: + contents: read + checks: write + issues: write + pull-requests: write jobs: format_code: runs-on: ubuntu-latest - permissions: - contents: read - checks: write - issues: write - pull-requests: write steps: - uses: actions/checkout@v4 - uses: JohnnyMorganz/stylua-action@v4 @@ -22,3 +22,4 @@ jobs: uses: reviewdog/action-suggester@v1 with: tool_name: stylua + fail_on_error: true From d555d89bc510eb71a0de928b7a1806dcd626bfea Mon Sep 17 00:00:00 2001 From: Aaron Dill Date: Mon, 22 Jul 2024 16:05:51 -0500 Subject: [PATCH 5/5] chore: apply formatting --- lua/tabnine/binary.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/tabnine/binary.lua b/lua/tabnine/binary.lua index 703b058..20a5b44 100644 --- a/lua/tabnine/binary.lua +++ b/lua/tabnine/binary.lua @@ -72,7 +72,7 @@ function TabnineBinary:start() "ide-restart-counter=" .. self.restart_counter, "pluginVersion=" .. consts.plugin_version, "--tls_config", - "insecure=" .. tostring(config.ignore_certificate_errors) + "insecure=" .. tostring(config.ignore_certificate_errors), }, optional_args()), stdio = { self.stdin, self.stdout, self.stderr }, }, function()