From 002bc37d560fa68ccd50fbee65542c132979a5eb Mon Sep 17 00:00:00 2001 From: pseudometa <73286100+chrisgrieser@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:26:40 +0200 Subject: [PATCH] refactor: udpate-readme --- README.md | 18 +++++++++--------- lua/rulebook/update-readme.lua | 18 +++--------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index bcd8f41..2bd0116 100644 --- a/README.md +++ b/README.md @@ -27,27 +27,27 @@ You easily add a custom source via the [plugin configuration](#configuration). T ### Rule Lookup -- `selene` -- `pylint` -- `yamllint` -- `stylelint` - `Lua Diagnostics` - `eslint` - `shellcheck` - `biome` +- `selene` +- `pylint` +- `yamllint` +- `stylelint` ### Add Ignore Comments -- [selene](https://kampfkarren.github.io/selene/usage/filtering.html#allowingdenying-lints-for-an-entire-file) -- [pylint](https://pylint.readthedocs.io/en/latest/user_guide/messages/message_control.html) -- [yamllint](https://yamllint.readthedocs.io/en/stable/disable_with_comments.html) -- [Pyright](https://microsoft.github.io/pyright/#/comments) -- [stylelint](https://stylelint.io/user-guide/ignore-code/) - [eslint](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1) - [LTeX](https://valentjn.github.io/ltex/advanced-usage.html) - [shellcheck](https://www.shellcheck.net/wiki/Ignore) - [biome](https://biomejs.dev/linter/#ignoring-code) - [vale](https://vale.sh/docs/topics/config/#markup-based-configuration) - [typescript](https://www.typescriptlang.org/) +- [selene](https://kampfkarren.github.io/selene/usage/filtering.html#allowingdenying-lints-for-an-entire-file) +- [pylint](https://pylint.readthedocs.io/en/latest/user_guide/messages/message_control.html) +- [yamllint](https://yamllint.readthedocs.io/en/stable/disable_with_comments.html) +- [Pyright](https://microsoft.github.io/pyright/#/comments) +- [stylelint](https://stylelint.io/user-guide/ignore-code/) ## Installation diff --git a/lua/rulebook/update-readme.lua b/lua/rulebook/update-readme.lua index 82abc22..024a250 100644 --- a/lua/rulebook/update-readme.lua +++ b/lua/rulebook/update-readme.lua @@ -1,5 +1,7 @@ -- INFO has to be run from lua subdirectory when called via `nvim -l` -- `cd lua && nvim -l rulebook/update-readme.lua` +-- (it is not indented to be used for other purposes) +-------------------------------------------------------------------------------- -- CONFIG local readmePath = "../README.md" -- relative to lua directory @@ -18,26 +20,12 @@ local function writeToFile(filePath, str) file:close() end ----read the full file ----@param filePath string ----@nodiscard ----@return string|nil nil on error -local function readFile(filePath) - local file, _ = io.open(filePath, "r") - if not file then return end - local content = file:read("*a") - file:close() - return content -end - -------------------------------------------------------------------------------- -local readmeContent = assert(readFile(readmePath), "README.md not found") - -- remove old lines local beforePart, afterPart = {}, {} local removeActive = nil -for line in readmeContent:gmatch("(.-)[\r\n]") do +for line in io.lines(readmePath) do if removeActive == nil then table.insert(beforePart, line) end if removeActive == false then table.insert(afterPart, line) end if line == markerStart then