rockstor / rockon-registry

hosted registry for Rock-ons
GNU Affero General Public License v3.0
44 stars 97 forks source link

Automatic validaton of PRs #91

Open nfriedly opened 7 years ago

nfriedly commented 7 years ago

Pull Requests should automatically be tested to at least contain valid JSON, and could perhaps be validated against a JSON-Schema to ensure they conform to the expected format.

Initial discussion at https://github.com/rockstor/rockon-registry/pull/81#issuecomment-284015582

CC @magicalyak @phillxnet @schakrava

magicalyak commented 7 years ago

This is from a discussion on a Rock-On to streamline some of the usual suspects around JSON preferences. I'm in full support but need to figure out how to put this together.

phillxnet commented 5 years ago

This JSON validation task may be one well suited to the new GitHub Apps system. Once that has properly rolled out I can take a look. Would be a great addition as we have had several non json additions as initial contributions to the Rock-ons repo.

Anyone up on the new GitHub Apps is more than welcome to chip in here on how we might implement this. Seems like a nice task to start out on using such a system.

phillxnet commented 5 years ago

As per formatting I'm thinking 4 spaces, as per our Python, and no tabs obviously :). We have many existing Rock-ons that have a mix of 2 and 4 spaces and some that also have tabs mixed in. Is there a black equivalent but for json that anyone knows of?

phillxnet commented 2 years ago

@FroggyFlox Re:

This JSON validation task may be one well suited to the new GitHub Apps system.

It would seem we now have GitHub actions for this?

FroggyFlox commented 2 years ago

@FroggyFlox Re:

It would seem we now have GitHub actions for this?

Do we? Now that I'm more familiar with Github actions I think I saw a way to achieve this a little while back but never got to tackling it... It might be worth having another look, indeed. I think the "difficulty" would be to retrieve the json file(s) of the PR and then pass this to a json linter; note that there are documented ways to do that so it would "only" be a matter of retrieving these.

It's definitely something we should implement sooner rather than later, though, so I might as well bite the bullet and get to it.

phillxnet commented 3 months ago

Minor update re @nfriedly original comment:

... validated against a JSON-Schema to ensure they conform to the expected format.

We do now have the in-need-of-attention fledgling repo that may be perfect for this purpose donated by @StephenBrown2:

https://github.com/rockstor/rockon-validator

"... a Rockon validator written in Go."

I.e. a GitHub action, using a Go ready container, pulls that repo and uses it for it's intended purpose.

This would most likely encourage folks to tend-to/extend what @StephenBrown2 started with the donation of that repo.