sheehan / job-dsl-playground

An app for debugging Groovy scripts using the Jenkins Job DSL
http://job-dsl.herokuapp.com/
Apache License 2.0
88 stars 33 forks source link

New Feature Request: Command Line Linter for DSL #41

Open amp5208 opened 8 years ago

amp5208 commented 8 years ago

Narrative:

As a Jenkins DSL user, I want to be able to lint my DSL job updates offline, so that I can both script my static code analyses for infrastructure code and evaluate my code from behind company firewall securely.

Acceptance Criteria:

Scenario: Export Linter to command line tool
User: Infrastructure engineer or equivalent automation
GIVEN a DSL script
WHEN I run the DSL Playground linter via command line
THEN I want to validate the physical structure of my DSL job in a way that mimics the results/output of the web application UI

Scenario: Checking Groovy imports for DSL
User: Infrastructure engineer or equivalent automation
GIVEN: a DSL script AND Groovy imports included
WHEN I run the DSL Playground linter via command line OR via UI
THEN I want to validate the physical structure of my DSL job even if it utilizes downstream Groovy dependencies
ayr-ton commented 7 years ago

It would be great, as sometimes we have class definitions that throws errors, as they are not imported during the check since we check only one file at once and not his dependencies.

ayr-ton commented 7 years ago

@amp5208 Could we add an acceptance criteria for checking the imports as well? Let's pair on this? (:

amp5208 commented 7 years ago

yes! I will add that. we can definitely pair.

amp5208 commented 7 years ago

@ayr-ton : Please review my updated Use case and provide changes as necessary before we begin changes.

Also, in terms of a command line tool option, do you have experience or the ability to push the command line tool binary to a public package repository available for distribution? e.g., NPM, Homebrew, apt-get, yum, Maven Central, etc.? This will be key to making this command line feature available for others out-of-the-box

sheehan commented 7 years ago

Are you just wanting to validate syntax? I have a gradle example that provides that https://github.com/sheehan/job-dsl-gradle-example#testing

ayr-ton commented 7 years ago

@sheehan I will review this in a moment and let you know if fit the feature request \o/

amp5208 commented 7 years ago

@sheehan : That might be a fine enough use case. Let me run it against one of my DSLs and let you know if it works; i will close the issue if your gradle task works.