From bbbd487064d53a998babafd40ecab00f8571dae6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 11 Oct 2023 21:03:07 +0300 Subject: [PATCH 1/4] CI: add more stict checking --- .editorconfig | 28 ++++++++++++++++++ .github/dependabot.yml | 11 +++++++ .github/workflows/editorconfig.yml | 47 ++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/editorconfig.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..5f4be94ca --- /dev/null +++ b/.editorconfig @@ -0,0 +1,28 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = tab +indent_size = 4 +insert_final_newline = true +tab_width = 4 +trim_trailing_whitespace = true + +[*.md] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = false + +[*.{nix,yml,yaml}] +indent_style = space +indent_size = 2 +tab_width = 2 + +[*.{diff,patch}] +end_of_line = unset +insert_final_newline = unset +trim_trailing_whitespace = unset + +[*.lock] +indent_size = unset diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..162fed056 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 15 + reviewers: + - NotAShelf + assignees: + - NotAShelf diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml new file mode 100644 index 000000000..5b05f8b40 --- /dev/null +++ b/.github/workflows/editorconfig.yml @@ -0,0 +1,47 @@ +name: "Check validity of .editorconfig" + +permissions: read-all + +on: + pull_request: + +jobs: + check-editorconfig: + runs-on: ubuntu-latest + if: "!contains(github.event.pull_request.title, '[skip treewide]')" + steps: + - name: Get list of changed files from PR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api \ + repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \ + | jq '.[] | select(.status != "removed") | .filename' \ + > "$HOME/changed_files" + + - name: Print list of changed files + run: | + cat "$HOME/changed_files" + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge + + - name: Install Nix + uses: cachix/install-nix-action@v23 + with: + # nixpkgs commit is pinned so that it doesn't break + # editorconfig-checker 2.4.0 + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz + + - name: Checking EditorConfig + run: | + cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size' + + - if: ${{ failure() }} + shell: bash + run: | + echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root." + echo "Please make sure your editor properly integrates editorconfig. See https://editorconfig.org/#download for more." + exit 1 From e583a3596eb104226846aefbaf09967cacdea462 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 20 Oct 2023 11:44:13 +0300 Subject: [PATCH 2/4] treewide: remove trailing whitespaces --- .gitignore | 2 -- docs/release-notes/rl-0.2.adoc | 8 ++++---- docs/release-notes/rl-0.3.adoc | 12 ++++++------ docs/release-notes/rl-0.5.adoc | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 8172b9499..972ffd55e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,3 @@ result/ # Ignore log files generated by my debuggers *.log *.log.* - -# diff --git a/docs/release-notes/rl-0.2.adoc b/docs/release-notes/rl-0.2.adoc index c1e86f25c..3b609cce5 100644 --- a/docs/release-notes/rl-0.2.adoc +++ b/docs/release-notes/rl-0.2.adoc @@ -19,7 +19,7 @@ https://github.com/notashelf[notashelf]: * There is now a scrollbar on active buffers, which can highlight errors by hooking to your LSPs. This is on by default, but can be toggled off under `vim.visuals` if seen necessary. -* Discord Rich Presence has been added through `presence.nvim` for those who want to flex that they are using the *superior* text editor. +* Discord Rich Presence has been added through `presence.nvim` for those who want to flex that they are using the *superior* text editor. * An icon picker is now available with telescope integration. You can use `:IconPickerInsert` or `:IconPickerYank` to add icons to your code. @@ -29,7 +29,7 @@ https://github.com/notashelf[notashelf]: * Most UI components of Neovim have been replaced through the help of `noice.nvim`. There are also notifications and custom UI elements available for Neovim messages and prompts. -* A (floating by default) terminal has been added through `toggleterm.nvim`. +* A (floating by default) terminal has been added through `toggleterm.nvim`. * Harness the power of ethical (`tabnine.nvim`) and not-so-ethical (`copilot.lua`) AI by those new assistant plugins. Both are off by default, TabNine needs to be wrapped before it's working. @@ -37,10 +37,10 @@ https://github.com/notashelf[notashelf]: * Re-open last visited buffers via `nvim-session-manager`. Disabled by default as deleting buffers seems to be problematic at the moment. -* Most of NvimTree's configuration options have been changed with some options being toggled to off by default. +* Most of NvimTree's configuration options have been changed with some options being toggled to off by default. * Lualine had its configuration simplified and style toned down. Less color, more info. * Modules where multiple plugin configurations were in the same directory have been simplified. Each plugin inside a single module gets its own directory to be imported. -* Separate config options with the same parent attribute have been merged into one for simplicity. \ No newline at end of file +* Separate config options with the same parent attribute have been merged into one for simplicity. diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index e601e80db..da0f00a5c 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -3,13 +3,13 @@ Release 0.3 had to come out beore I wanted it to due to Neovim 0.9 dropping into nixpkgs-unstable. The treesitter changes have prompted a treesitter rework, which was followed by reworking the languages system. Most of the changes to those are downstreamed -from the original repository. The feature requests that was originally planned for 0.3 have been moved to 0.4, which +from the original repository. The feature requests that was originally planned for 0.3 have been moved to 0.4, which should come out soon. [[sec-release-0.3-changelog]] === Changelog -* We have transitioned to flake-parts, from flake-utils to extend the flexibility of this flake. This means the flake structure +* We have transitioned to flake-parts, from flake-utils to extend the flexibility of this flake. This means the flake structure is different than usual, but the functionality remains the same. * We now provide a home-manager module. Do note that it is still far from perfect, but it works. @@ -24,7 +24,7 @@ display the correct titles instad of `+prefix` * Most of the modules have been refactored to separate `config` and `options` attributes. * Darwin has been deprecated as the zig package is marked as broken. We will attempt to use the zig overlay to return Darwin -support. +support. * `Fidget.nvim` has been added as a neat visual addition for LSP installations. @@ -47,12 +47,12 @@ support. * For <> and <> turning them off should use `null` rather than `""` now. -* Transparency has been made optional and has been disabled by default. <> option can be used to enable or +* Transparency has been made optional and has been disabled by default. <> option can be used to enable or disable transparency for your configuration. * Fixed deprecated configuration method for Tokyonight, and added new style "moon" -* Dart language support as well as extended flutter support has been added. Thanks to @FlafyDev for his contributions towards Dart +* Dart language support as well as extended flutter support has been added. Thanks to @FlafyDev for his contributions towards Dart language support. * Elixir language support has been added through `elixir-tools.nvim`. @@ -61,7 +61,7 @@ language support. * `modes.nvim` has been added to the UI plugins as a minor error highlighter. -* `smartcollumn.nvim` has been added to dynamically display a colorcolumn when the limit has been exceeded, providing +* `smartcollumn.nvim` has been added to dynamically display a colorcolumn when the limit has been exceeded, providing per-buftype column position and more. * `project.nvim` has been added for better project management inside Neovim. diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index 2d02973d4..d74f6db78 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -5,7 +5,7 @@ [[sec-release-0.5-changelog]] === Changelog -https://github.com/vagahbond[vagahbond]: +https://github.com/vagahbond[vagahbond]: * Added phan language server for PHP. * Added phpactor language server for PHP. From a4de8ea0b41625d62125a82797535e59c2dc73f6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 20 Oct 2023 11:48:58 +0300 Subject: [PATCH 3/4] CI: use DetSys Nix installer --- .github/workflows/editorconfig.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml index 5b05f8b40..15ea262a1 100644 --- a/.github/workflows/editorconfig.yml +++ b/.github/workflows/editorconfig.yml @@ -8,14 +8,14 @@ on: jobs: check-editorconfig: runs-on: ubuntu-latest - if: "!contains(github.event.pull_request.title, '[skip treewide]')" + if: "!contains(github.event.pull_request.title, '[skip ci]')" steps: - name: Get list of changed files from PR env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh api \ - repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \ + repos/notashelf/neovim-flake/pulls/${{github.event.number}}/files --paginate \ | jq '.[] | select(.status != "removed") | .filename' \ > "$HOME/changed_files" @@ -29,15 +29,12 @@ jobs: ref: refs/pull/${{ github.event.pull_request.number }}/merge - name: Install Nix - uses: cachix/install-nix-action@v23 - with: - # nixpkgs commit is pinned so that it doesn't break - # editorconfig-checker 2.4.0 - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz + uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main - name: Checking EditorConfig run: | - cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size' + cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indent-size' - if: ${{ failure() }} shell: bash From 1fcdc0b636a7e22976471f8b47bb0ba36a537558 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 20 Oct 2023 11:52:35 +0300 Subject: [PATCH 4/4] CI: name the failure step --- .github/workflows/editorconfig.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml index 15ea262a1..76e684734 100644 --- a/.github/workflows/editorconfig.yml +++ b/.github/workflows/editorconfig.yml @@ -33,10 +33,13 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Checking EditorConfig + shell: bash run: | - cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indent-size' + cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indent-size --verbose' + echo -n "Check status: $?" - - if: ${{ failure() }} + - name: Fail Gracefully + if: ${{ failure() }} shell: bash run: | echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."