ls-lint
ls-lint copied to clipboard
Lint issues
I have noticed that after modifying the structure and updating the configuration, sometimes ls-lint
behaves weirdly. It looks related to caching (?)
More specifically, the pipeline failed after updating my .ls-lint.yml
and running the pipeline. After a couple of retries, it went green (without any modifications).
I could observe the same behavior under my local repository. We use ls-lint
for linting OpenAPI specifications in a central repository. The following is an example of our config and repository structure (please note I have altered the names of the directories as those are internal).
ls:
v*/schemas/**/*:
models:
.yaml: regex:[a-z\-]+
.dir: regex:[a-z\-]+
.yaml: regex:openapi
v*/common/**/*:
.dir: regex:[a-z\-]+
.yaml: regex:[a-z\-]+
Directory structure:
└── v3
├── common
│ ├── models
│ │ ├── foo.yaml
│ │ ├── bar.yaml
└── schemas
├── someapi
│ ├── models
│ │ ├── billing-address.yaml
│ │ ├── customer-details.yaml
│ │ ├── errors.yaml
│ └── openapi.yaml
Running the command first time:
❯ npx ls-lint ./v3/
2023/06/13 13:35:49 v3/schemas/someapi/models/billing-address.yaml failed for rules: regex (openapi)
2023/06/13 13:35:49 v3/schemas/someapi/models/customer-details.yaml failed for rules: regex (openapi)
2023/06/13 13:35:49 v3/schemas/someapi/models/errors.yaml failed for rules: regex (openapi)
Running the command a second time (no changes) - no errors:
❯ npx ls-lint ./v3/
I cannot pinpoint when this happens, it looks related to the first batch of changes either to the structure or the configuration
I am also attaching the jobs in the pipelines, the successful one was just merely re-triggering the job (no changes pushed)
arrr, this should belongs to #97
- [ ] could you please provide a reproducible example?
- [ ] which ls-lint version are you using?
sidenote: if you want to run ls-lint only for the v3 directory you should use the --workdir v3
option
Hello, @loeffel-io the ls-lint
version is "version": "1.11.2"
(P.S would be nice to add a version flag)
The example structure I have appended above was the one that failed during the initial run, the only difference is the someapi
which obviously is changed but the original followed the same pattern (just alpha characters without spaces or special chars).
thanks @petkostas for the infos!
can you please check if the issue exists with ls-lint v2.0.0
(includes a version flag)
Hello @loeffel-io I tried with v2.0.0
(thanks for the flag :D) it doesn't seem to happen, but I would need to try different scenarios as with the previous version; this would happen only once and the next runs would always come green.
If you feel closing this ticket, you can do so and if this re-occurs I can reopen it.
i leave it open - just please let me know if this still occurs in the next days/weeks
Hello @loeffel-io I was away for vacation, so while working today and testing some things in a repo, I noticed that this behavior is still present and random.
So after running the command ls-lint
the first run a couple of times, it comes clean, and after three or four attempts, I am getting the error. Re-running the command comes clean again till after a few re-runs. Interestingly, it raises the error every sixth time (though I got some times the same effect the first time I tried the command).
❯ ls-lint --version
ls-lint v2.0.1
go go1.20.5 X:nocoverageredesign
❯ ls-lint
❯ ls-lint
❯ ls-lint
❯ ls-lint
❯ ls-lint
❯ ls-lint
2023/08/02 14:27:19 v3/schemas/someapi/models/billing-address.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/customer-details.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/errors.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/order-items.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/order-partial-update.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/order.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/payment-details.yaml failed for rules: regex (openapi)
2023/08/02 14:27:19 v3/schemas/someapi/models/shipping-address.yaml failed for rules: regex (openapi)
❯ ls-lint
❯ ls-lint
❯ ls-lint
❯ ls-lint
❯ ls-lint
❯ ls-lint
2023/08/02 14:29:05 v3/schemas/someapi/models/billing-address.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/customer-details.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/errors.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/order-items.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/order-partial-update.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/order.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/payment-details.yaml failed for rules: regex (openapi)
2023/08/02 14:29:05 v3/schemas/someapi/models/shipping-address.yaml failed for rules: regex (openapi)
I quickly checked the code. Could it be related to concurrency?
@loeffel-io, it seems the issue is no longer present in version 2.1.0
. If you want, we can keep this open for a few days and get back to you as we run ls-lint
in our pipelines so I can monitor if this behavior is no longer present.