You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
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
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
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?
The text was updated successfully, but these errors were encountered:
Absolutely, we would love to accept PRs that provide this functionality! If
they cause a semver major bump then we can deal with that when the time
comes.
--
Rob Nelson
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:
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 methodThe output from
parse
is always viaputs
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 failuresThe linting options are only settable in the
run
method however this again means I need a file on disk. It seems therun
method is conflating setting lint options and linting text contentMinor 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?
The text was updated successfully, but these errors were encountered: