job-dsl-playground icon indicating copy to clipboard operation
job-dsl-playground copied to clipboard

New Feature Request: Command Line Linter for DSL

Open amp5208 opened this issue 8 years ago • 7 comments

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

amp5208 avatar Dec 02 '16 23:12 amp5208

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 avatar Dec 07 '16 15:12 ayr-ton

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

ayr-ton avatar Dec 07 '16 15:12 ayr-ton

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

amp5208 avatar Dec 07 '16 21:12 amp5208

@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

amp5208 avatar Dec 07 '16 22:12 amp5208

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

sheehan avatar Dec 08 '16 18:12 sheehan

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

ayr-ton avatar Dec 08 '16 18:12 ayr-ton

@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.

amp5208 avatar Jun 01 '17 18:06 amp5208