Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Validate a directory recursively #253

Closed
amimas opened this issue Jan 12, 2021 · 6 comments · Fixed by #266
Closed

Validate a directory recursively #253

amimas opened this issue Jan 12, 2021 · 6 comments · Fixed by #266
Labels
enhancement New feature or request

Comments

@amimas
Copy link

amimas commented Jan 12, 2021

Is it possible to process a directory recursively so that all toml files in a given directory will be validated?

@staticdev
Copy link
Owner

@amimas I am creating another repo for this application with a more broad scope (it will also lint other extensions of files). It will have recursive option. I update this issue afterwards.

@staticdev staticdev added the enhancement New feature or request label Jan 12, 2021
@amimas
Copy link
Author

amimas commented Jan 12, 2021

Thanks for the quick reply @staticdev .

For scanning files recursively in a directory, I'm now using find -name '*.toml' -type f -exec toml-validator {} \;. This will go through every .toml files in current directory and sub-directories and then execute toml-validator on that file.

For me, one of the top benefit of having a linter is to be able to use it in a CI pipeline so that we can catch issues before merging any changes. I like toml-validator. It's simple to setup and use. But I think this is lacking a lot of features. The above is simply a work-around. The linter needs to be able to handle directories on it's own. Otherwise, reporting is going to be on individual files. Speaking which, the linter currently does not have any reporting capabilities (i.e. junit, html, etc.); it simply prints a line in stdout. Also the linter does not quit with a non-zero exit code if it found any issues. That means, if I have a GitHub actions or travis pipeline where I run this for each PR, it won't mark the pipeline as failed. Also, it'd be nice if we could configure the expected schema of toml files (i.e. what keys are valid or invalid). That would make it even more advanced and the linter could be used for advanced validation; not just syntax checking.

I'm listing a lot in this comment. Thought I'd summarize it here.

Thanks for creating it though. It's still useful. 🙏

@staticdev
Copy link
Owner

@amimas I really liked your feedback. I will share the new repo with you and the recursive folder and we can try together these new improvements.

@staticdev
Copy link
Owner

@amimas just a quick heads-up. I created version 1.4.0 with different exit code for errors:

Return status:
* 0: no errors found
* 1: incorrect usage
* 2: invalid path
* 3: errors found

This one was very easy to implement.

@staticdev
Copy link
Owner

@amimas I would able to address most of your suggestions on version 1.5.0. Give it a try.

@amimas
Copy link
Author

amimas commented Jan 19, 2021

Thanks @staticdev . I'll try out the new version as early as I can.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants