Module: Fluence::Ci::Tools::Steps

Included in:
Runner
Defined in:
lib/fluence/ci/tools/steps.rb

Overview

Mixin that adds the curated check groups to anything exposing a step(label, command) method. Mirrors the centralised CI workflows in fluence-eu/ci-workflows.

Each group method takes a report: boolean kwarg. With report: false (the default) the underlying tools print human-readable output to the console — what devs want for local pre-push runs. With report: true the same tools are invoked with their machine-output flags and write to a standardised path under the project root, so the centralised CI workflows can pick the artefact up for baseline diffs:

* lint        → tmp/fluence-report/rubocop.json
* security    → tmp/fluence-report/{brakeman.json,audit.txt,ruby_audit.txt}
* codequality → tmp/fluence-report/{reek.json,flog.txt,flay.txt}
* docs        → doc/yardstick_report.txt (via the in-process
{Fluence::Ci::Tools::YardstickRunner} — no consumer Rakefile
dependency; honours `.yardstick.yml`)

tests does not take report: — coverage is captured as a side effect by SimpleCov's spec_helper integration, the same coverage/coverage.json file is produced regardless of mode.

Constant Summary collapse

REPORT_DIR =

Path under the project root where every machine-readable report lands when report: true. Conventionally gitignored (Ruby projects already gitignore tmp/).

'tmp/fluence-report'

Instance Method Summary collapse

Instance Method Details

#all(report: false, **overrides) ⇒ void

This method returns an undefined value.

Run every step group in the catalog. Adding a new group method makes it appear automatically. Override per-group kwargs via a hash keyed by method name.

Examples:

Report mode for the whole catalog

all(report: true)

Mix global report mode + a specific override

all(report: true, codequality: { paths: 'app lib' })

Parameters:

  • report (Boolean) (defaults to: false)

    when true, propagate report: true to every group method that accepts it (lint, security, codequality, docs)

  • overrides (Hash{Symbol => Hash})

    per-group keyword args that take precedence over the propagated report: flag

#codequality(paths: nil, report: false) ⇒ void

This method returns an undefined value.

Run the code-smell suite (reek, flog, flay).

Defaults paths to lib, or app lib if an app/ directory exists (Rails app / engine). Override explicitly otherwise.

Parameters:

  • paths (String, nil) (defaults to: nil)

    space-separated source paths to scan

  • report (Boolean) (defaults to: false)

    when true, write reports under tmp/fluence-report/

#docs(build: false, report: false) ⇒ void

This method returns an undefined value.

Validate, build, or measure documentation. Three orthogonal modes (report: wins over build:, default is the smoke parse):

* default          — `yard doc --no-output --no-stats`, a
parse-only smoke check that the docstrings compile. No
HTML, no stats, no threshold gate. Used by local pre-push
and the consumer's main matrix.
* `build: true`    — `yard doc`, produces the HTML site
under `doc/`. Used by `ruby-gem-docs-deploy.yml`.
* `report: true`   — invokes the in-process
{Fluence::Ci::Tools::YardstickRunner} which reads
`.yardstick.yml`, writes `doc/yardstick_report.txt`, and
exits 1 below threshold. Used by
`ruby-gem-docs-measure.yml`.

Parameters:

  • build (Boolean) (defaults to: false)

    when true, build the HTML site (ignored when report: is true)

  • report (Boolean) (defaults to: false)

    when true, run yardstick measurement + verify

#lint(report: false) ⇒ void

This method returns an undefined value.

Run the rubocop lint step.

Parameters:

  • report (Boolean) (defaults to: false)

    when true, write JSON report to tmp/fluence-report/rubocop.json

#security(report: false) ⇒ void

This method returns an undefined value.

Run the security audit suite (brakeman, bundler-audit, ruby_audit).

Parameters:

  • report (Boolean) (defaults to: false)

    when true, write reports under tmp/fluence-report/

#tests(command: nil) ⇒ void

This method returns an undefined value.

Run the project's test suite(s). Detects rspec / minitest presence via spec/spec_helper.rb / test/test_helper.rb. Coverage (coverage/coverage.json) is captured automatically by SimpleCov when configured in the consumer's spec_helper.

Pass command: explicitly to bypass detection.

Parameters:

  • command (String, nil) (defaults to: nil)

    explicit test command; bypasses detection