BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Towhee · Locate the first actionable source-style violation

Combine indentation and line-width diagnostics for a measured source file.

Locate the first actionable source-style violation

A line can have acceptable length but invalid indentation. Preserve both counts and show the earliest actionable row. The second line exceeds its width limit and the third makes an illegal indentation jump. The first problem is zero-based row 1.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-towhee.git
cd blyx-towhee
blyxc native-run project.blyx -- "0,4,12" "60,88,70" 4 80

API and return values

Returns [clean, indentation violations, overlong rows, first problem row]. Supply aligned nonblank physical lines and their display widths. Invalid input returns an empty vector.

ArgumentAccepted input
indentVector of: nonnegative exact integer
widthsVector of: nonnegative exact integer
steppositive exact integer
limitpositive exact integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
0
1
1
1
Open in the full playground →

Practice

Change indent = [0, 4], widths = [8, 12]. Predict the result, then run the program.

Hint

Returns [clean, indentation violations, overlong rows, first problem row]. Supply aligned nonblank physical lines and their display widths.

Worked solution

The result vector is [1, 0, 0, -1]. Compare its fields with the return layout in the API section.

Find

    let indent = [0, 4, 12];

Replace with

    let indent = [0, 4];

Find

    let widths = [60, 88, 70];

Replace with

    let widths = [8, 12];

Output after the change

1
0
0
-1