Skip to content

remove failed #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Create a lint file `hello.jsonnet`.
This simple rule checks if data has a field `description`.

```jsonnet
function(param) {
name: 'description is required',
failed: !std.objectHas(param.data.value, 'description'),
}
function(param)
if std.objectHas(param.data.value, 'description') then [] else [{
name: 'description is required',
}]
```

## Edit the configuration file
Expand Down Expand Up @@ -71,6 +71,8 @@ Then the command would fail because `hello.json` violates the lint rule of `hell
```console
$ lintnet lint
{
"lintnet_version": "",
"env": "darwin/arm64",
"errors": [
{
"rule": "description is required",
Expand Down
14 changes: 4 additions & 10 deletions docs/lint-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ lintnet uses Jsonnet to write lint rules.
e.g.

```jsonnet
function(param) if param.data.file_type != 'csv' then null else std.mapWithIndex(function(idx, line) {
message: 'age must be greater or equal than 18',
failed: std.parseInt(line[1]) < 18,
level: 'warn',
location: {
index: idx,
line: std.join(',', line),
},
}, param.data.value)
function(param)
if std.objectHas(param.data.value, 'description') then [] else [{
name: 'description is required',
}]
```

## Top level arguments
Expand All @@ -44,7 +39,6 @@ The format of `param` is
JSONPath | type | description
--- | --- | ---
`.name` (required) | string | Rule name
`.failed` (required) | bool | If this is true, this means the file violates the rule
`.message` | string | Error message
`.level` | string | Error level
`.location` | `string` or `any` | Location where errors occur
Expand Down
1 change: 0 additions & 1 deletion docs/test-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function(param) [
result: [ // expected return value of the lint file
{
message: 'age must be greater or equal than 18',
failed: true,
level: 'error',
location: {
index: 0,
Expand Down