Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AlxHnr committed May 27, 2022
0 parents commit eee243b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2022 Alexander Heinrich

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Provides a [bean-check](https://github.com/beancount/beancount) diagnostic source for
[null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim). This source will lint your
beancount files every time you save them.

## Dependencies

* [vim-beancount](https://github.com/nathangrigg/vim-beancount) for filetype detection

## Setup

```lua
require('null-ls').register(require('null-ls-bean-check'))
```
22 changes: 22 additions & 0 deletions lua/null-ls-bean-check.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
local helpers = require('null-ls.helpers')
return {
name = 'bean-check',
meta = {
url = 'https://github.com/beancount/beancount',
description = 'Beancount: text-based double-entry accounting tool',
},
method = require('null-ls.methods').internal.DIAGNOSTICS_ON_SAVE,
filetypes = { 'beancount' },
generator = helpers.generator_factory{
command = 'bean-check',
args = { '$FILENAME' },
from_stderr = true,
to_stdin = true,
format = 'line',
check_exit_code = function(exit_code) return exit_code == 0 end,
on_output = helpers.diagnostics.from_patterns{{
pattern = [[(.+):(%d+):%s*(.+)]],
groups = { 'filename', 'row', 'message' },
}},
},
}

0 comments on commit eee243b

Please sign in to comment.