cuke_dedup/lib.rs
1//! CukeDedup's reusable static-analysis library.
2//!
3//! The CLI is the primary integration for repository-wide analysis. Embedders can also parse
4//! definitions and feature steps into the shared representation and run the same rules directly:
5//!
6//! ```
7//! use cuke_dedup::analysis::analyze;
8//! use cuke_dedup::config::{Config, ConfigOverrides};
9//! use cuke_dedup::gherkin;
10//! use cuke_dedup::source_adapter::{SourceFile, SourceLanguage};
11//! use cuke_dedup::typescript;
12//! use std::path::Path;
13//!
14//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
15//! let root = std::env::current_dir()?;
16//! let config = Config::load(&root, ConfigOverrides::default())?;
17//! let definition_file = SourceFile {
18//! path: root.join("steps.ts"),
19//! language: SourceLanguage::TypeScript,
20//! };
21//! let definitions = typescript::extract(
22//! r#"import { Given } from "@cucumber/cucumber";
23//! Given("a user exists", async () => { await createUser(); });"#,
24//! &definition_file,
25//! )?;
26//! let feature_steps = gherkin::extract(
27//! "Feature: Users\n Scenario: Existing user\n Given a user exists\n",
28//! Path::new("features/users.feature"),
29//! )?;
30//!
31//! let result = analyze(definitions, feature_steps, &config)?;
32//! assert!(result.findings.is_empty());
33//! # Ok(())
34//! # }
35//! ```
36
37#![warn(missing_docs)]
38#![forbid(unsafe_code)]
39
40pub mod analysis;
41pub mod cli;
42pub mod config;
43pub mod discovery;
44mod framework_config;
45pub mod gherkin;
46pub mod model;
47pub mod modes;
48pub mod reporters;
49pub mod source_adapter;
50pub mod typescript;