From 695a24ed1dfee9e84bf6dbd5228dbc74a7fe203d Mon Sep 17 00:00:00 2001 From: Liliane Constantino Date: Mon, 3 Jan 2022 16:02:17 -0300 Subject: [PATCH] Fix: web app example sinatra --- README.md | 4 ++-- core/plugins/stack/ruby/mod.ts | 9 +++++++++ tests/default_test.ts | 9 +++++++++ .../{ => .github/workflows}/pipelinit.ruby.format.yaml | 6 ++++-- .../{ => .github/workflows}/pipelinit.ruby.lint.yaml | 6 ++++-- .../{ => .github/workflows}/pipelinit.ruby.sast.yaml | 0 6 files changed, 28 insertions(+), 6 deletions(-) rename tests/fixtures/ruby/sinatra/expected/{ => .github/workflows}/pipelinit.ruby.format.yaml (69%) rename tests/fixtures/ruby/sinatra/expected/{ => .github/workflows}/pipelinit.ruby.lint.yaml (70%) rename tests/fixtures/ruby/sinatra/expected/{ => .github/workflows}/pipelinit.ruby.sast.yaml (100%) diff --git a/README.md b/README.md index f2a1c23..0db4fcc 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ pipelinit Shell script Lint ✔️ - Coming soon + Coming soon Java @@ -170,7 +170,7 @@ pipelinit ✔️ - Ruby + Ruby Lint ✔️ diff --git a/core/plugins/stack/ruby/mod.ts b/core/plugins/stack/ruby/mod.ts index dd35d14..f220126 100644 --- a/core/plugins/stack/ruby/mod.ts +++ b/core/plugins/stack/ruby/mod.ts @@ -5,6 +5,7 @@ import { Formatters, introspect as introspectFormatters, } from "./formatters.ts"; +import { introspect as introspectType } from "./types.ts"; /** * Introspected information about a project with Ruby @@ -19,6 +20,10 @@ export default interface RubyProject { */ linters: Linters; formatters: Formatters; + /** + * Identified type of project + */ + type?: string | null; } export const introspector: Introspector = { @@ -42,10 +47,14 @@ export const introspector: Introspector = { const linters = await introspectLinters(context); const formatters = await introspectFormatters(context); + //Project type + const projectType = await introspectType(context); + return { version: version, linters: linters, formatters: formatters, + type: projectType, }; }, }; diff --git a/tests/default_test.ts b/tests/default_test.ts index a38c849..7f2aa20 100644 --- a/tests/default_test.ts +++ b/tests/default_test.ts @@ -104,6 +104,15 @@ test( }, ); +test( + { fixture: "ruby/sinatra", args: ["--no-strict"] }, + async (stdout, _stderr, code, assertExpectedFiles) => { + assertStringIncludes(stdout, "Detected stack: ruby"); + assertEquals(code, 0); + await assertExpectedFiles(); + }, +); + test( { fixture: "docker/docker-lint-build", args: ["--no-strict"] }, async (stdout, _stderr, code, assertExpectedFiles) => { diff --git a/tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.format.yaml b/tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.format.yaml similarity index 69% rename from tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.format.yaml rename to tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.format.yaml index a994b22..b9825c0 100644 --- a/tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.format.yaml +++ b/tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.format.yaml @@ -13,6 +13,8 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "2.3.0" + ruby-version: "3.0.2" bundler-cache: true - - run: bundle exec sinatra --format . + - run: gem install + - run: gem install rubocop + - run: bundle exec rubocop --format . diff --git a/tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.lint.yaml b/tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.lint.yaml similarity index 70% rename from tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.lint.yaml rename to tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.lint.yaml index 43b3cbf..5c64d41 100644 --- a/tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.lint.yaml +++ b/tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.lint.yaml @@ -13,6 +13,8 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "2.3.0" + ruby-version: "3.0.2" bundler-cache: true - - run: bundle exec sinatra --lint . + - run: gem install + - run: gem install rubocop + - run: bundle exec rubocop --lint . diff --git a/tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.sast.yaml b/tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.sast.yaml similarity index 100% rename from tests/fixtures/ruby/sinatra/expected/pipelinit.ruby.sast.yaml rename to tests/fixtures/ruby/sinatra/expected/.github/workflows/pipelinit.ruby.sast.yaml