Skip to content
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

metadata-json-lint should be easier to consume as a gem, not always via CLI #85

Open
glennsarti opened this issue Jul 20, 2017 · 1 comment

Comments

@glennsarti
Copy link

glennsarti commented Jul 20, 2017

I am one of the developers of the Visual Studio Code Puppet Extension (https://github.com/jpogran/puppet-vscode) and I started to add metadata lint support to the extension using this gem. Currently the metadata-json-lint is somewhat impossible to consume in a programmatic form, and assumes it will always be invoked from a command line:

  1. The parse method assumes that the metadata string is a file on disk whereas I already have the string content, and it may not actually be on disk. This method seems to conflate loading a file and parsing a file into the same method

  2. The output from parse is always via puts and the instance variables for warnings and errors are not exposed on the public API. This means even if I could parse a text string (from point 1) I wouldn't have access to any lint failures

  3. The linting options are only settable in the run method however this again means I need a file on disk. It seems the run method is conflating setting lint options and linting text content

  4. Minor nit, but the failures just say the file failed linting but doesn't give a line/char offset, but granted this is difficult to do with the current JSON parser

I will probably end up forking the gem source and adding the ability to consume the gem in a programmatic way. Would you be interesting in accepting PRs for this assume I'm not breaking any public APIs?

@rnelson0
Copy link
Member

rnelson0 commented Jul 22, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants