Skip to content

Commit

Permalink
Merge branch 'web-analyzers-page'
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Dec 15, 2024
2 parents a3dd84d + d03d2dd commit 9b3a661
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 14 deletions.
184 changes: 184 additions & 0 deletions website/docs/analyzers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
While Bacon was initially developped for the Rust language, it covers more and more tools and language.

For most of them, a dedicated `analyzer` must be specified in the [job settings](../config#jobs).

This page is na overview of the supported tools and how bacon can be configured for them.

# Summary

Analyzer | Languages | Tool
-|-|-
[standard](#rust) (*default*) | Rust | [cargo](https://doc.rust-lang.org/cargo/) `check`, `build`, `test`, `clippy`, `doc`, `run`, `miri`
[nextest](#nextest)| Rust | [cargo-nextest](https://nexte.st/)
[cargo_json](#cargojson)| Rust | cargo with `--message-format json-diagnostic-rendered-ansi`
[python_unittest](#unittest) | Python | [Unittest](https://docs.python.org/3/library/unittest.html)
[python_pytest](#pytest)| Python | [pytest](https://docs.pytest.org/)
[python_ruff](#ruff)| Python | [ruff](https://docs.astral.sh/ruff/)
[eslint](#eslint)| JS/TS/CSS | [ESLint](https://eslint.org/)
[biome](#biome)| JS/TS/CSS | [Biome](https://biomejs.dev/)
[cpp](#gcc-clang)| C++ | Clang and GCC
cpp_doctest| C++ | [doctest](https://github.com/doctest/doctest).

# Rust

Rust specific support of bacon includes reading Cargo.toml files to identify all source directories, and help managing cargo features.

## Cargo build, clippy, test, doc, run

**Status: <span style="background-color:green;color:white;padding:3px">mature</span>**

These tools are quite different but produce warnings, errors, test failures, with the same representation.

Bacon comes preconfigured for those tools.

## Cargo/JSON

**Status: <span style="background-color:orange;color:white;padding:3px">young</span>**

Cargo can be configured to output JSON.

With the `cargo_json` analyzer, the visible result in bacon is the same, but using this analyzer makes it possible to export from bacon more detailed data to use in other tools, eg [bacon-ls](https://github.com/crisidev/bacon-ls).

## Miri

**Status: <span style="background-color:green;color:white;padding:3px">mature</span>**

[miri](https://github.com/rust-lang/miri) is supported with the default analyzer.

Bacon isn't preconfigured for miri but you can add a job with

```TOML
[jobs.miri]
command = ["cargo", "+nightly", "miri", "run"]
need_stdout = true
```

## Nextest

**Status: <span style="background-color:green;color:white;padding:3px">mature</span>**

[nextest](https://nexte.st/)

It doesn't use the standard analyzer but bacon comes preconfigured with a nextest job so that you can launch `bacon nextest` or simply hit <kbd>n</kbd> while in bacon.


# Python

Support of Python is just starting, and Python developpers should raise their hand if they want to see progress here.

## Unittest

**Status: <span style="background-color:orange;color:white;padding:3px">young</span>**

Support for the [Unittest](https://docs.python.org/3/library/unittest.html) framework seems to work, but lacks testers and users.

Exemple configuration:

```TOML
[jobs.unittest]
command = [
"python3", "unitest_runner.py",
]
need_stdout = true
analyzer = "python_unittest"
watch = ["."]
```

## Pytest

**Status: <span style="background-color:orange;color:white;padding:3px">young</span>**

[pytest](https://docs.pytest.org/en/stable/)

It's configured with

```TOML
[jobs.pytest]
command = [
"pytest"
]
need_stdout = true
analyzer = "python_pytest"
watch = ["."]
```

## Ruff

**Status: <span style="background-color:orange;color:white;padding:3px">young</span>**

[ruff](https://docs.astral.sh/ruff/)

Exemple configuration:

```TOML
[jobs.ruff]
env.FORCE_COLOR = "1"
command = [
"ruff", "check",
]
need_stdout = true
analyzer = "python_ruff"
watch = ["."]
```

# JavaScript / TypeScript

## Eslint

**Status: <span style="background-color:orange;color:white;padding:3px">young</span>**

[ESLint](https://eslint.org/)

```TOML
[jobs.lint]
command = ["npx", "eslint", "--color", "libs/*"]
need_stdout = true
analyzer = "eslint"
watch = ["libs"]
```

## Biome

**Status: <span style="background-color:green;color:white;padding:3px">mature</span>**

[Biome](https://biomejs.dev/)

Example configuration (for a `./libs` folder) with some lint rules skipped:

```TOML
[jobs.biome-libs]
env.RAYON_NUM_THREADS = "1" # for constant ordering of items
command = [
"npx", "@biomejs/biome", "lint",
"--colors", "force",
"./libs",
"--skip", "complexity/useArrowFunction",
"--skip", "style/useTemplate",
]
need_stdout = true
analyzer = "biome"
watch = ["libs"]
```

# C++

## GCC / Clang

**Status: <span style="background-color:orange;color:white;padding:3px">young</span>**

```TOML
[jobs.gcc]
command = [
"g++", "-Wall", "src/main.cpp",
]
watch = ["src"]
need_stdout = true
analyzer = "cpp"
```

##

# Other tools

What's not here, you should probably ask for it, either on [GitHub](https://github.com/Canop/bacon) or on [the Miaou chat](https://miaou.dystroy.org/4683).

14 changes: 1 addition & 13 deletions website/docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,7 @@ The output of the standard cargo tools is understood by bacon's standard analyze

For other tools, a specific analyzer may be configured with, eg, `analyzer = "nextest"`.

Available analyzers:

* `standard` (default, for most cargo tools and compatible outputs)
* `nextest` for [cargo-nextest](https://nexte.st/)
* `eslint` for [ESLint](https://eslint.org/)
* `biome` for [Biome](https://biomejs.dev/)
* `python_unittest` for [Unittest](https://docs.python.org/3/library/unittest.html)
* `python_pytest` for [pytest](https://docs.pytest.org/)
* `python_ruff` for [ruff](https://docs.astral.sh/ruff/)
* `cpp` for Clang and GCC
* `cpp_doctest` for [doctest](https://github.com/doctest/doctest).

For information on the support and configuration of bacon for non-cargo tools, refer to **[Are they bacon yet?](https://dystroy.org/blog/are-they-bacon-yet/)**.
For the list of analyzers and configuration examples, see [Analyzers](../analyzers).

## Default Job

Expand Down
3 changes: 2 additions & 1 deletion website/docs/css/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pre {
color: var(--code-fg);
background: var(--code-bg);
border: solid 1px var(--code-bg);
font-weight: normal;
padding: 6px 0 4px 6px;
}

Expand Down Expand Up @@ -203,7 +204,7 @@ kbd.b {
}
.col-md-9 img {
max-width: 100%;
display: inline-block;
display: block;
padding: 0;
line-height: 1.428571429;
background-color: #fff;
Expand Down
Binary file added website/docs/img/bacon-biome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/docs/img/bacon-broot-clippy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/docs/img/bacon-cpp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/docs/img/bacon-eslint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/docs/img/bacon-pytest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/docs/img/bacon-ruff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions website/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edit_uri: ''
nav:
- Overview: index.md
- Config: config.md
- Analyzers: analyzers.md
- Cookbook: cookbook.md
- Community: community.md

Expand Down

0 comments on commit 9b3a661

Please sign in to comment.