ruff/crates
Zanie Blue 860ffb9549
Add ruff version with long version display (#8034)
Adds a new `ruff version` sub-command which displays long version
information in the style of `cargo` and `rustc`. We include the number
of commits since the last release tag if its a development build, in the
style of Python's versioneer.

```
❯ ruff version
ruff 0.1.0+14 (947940e91 2023-10-18)
```

```
❯ ruff version --output-format json
{
  "version": "0.1.0",
  "commit_info": {
    "short_commit_hash": "947940e91",
    "commit_hash": "947940e91269f20f6b3f8f8c7c63f8e914680e80",
    "commit_date": "2023-10-18",
    "last_tag": "v0.1.0",
    "commits_since_last_tag": 14
  }
}%
```

```
❯ cargo version
cargo 1.72.1 (103a7ff2e 2023-08-15)
```
## Test plan

I've tested this manually locally, but want to at least add unit tests
for the message formatting. We'd also want to check the next release to
ensure the information is correct.

I checked build behavior with a detached head and branches.

## Future work

We could include rustc and cargo versions from the build, the current
Python version, and other diagnostic information for bug reports.

The `--version` and `-V` output is unchanged. However, we could update
it to display the long ruff version without the rust and cargo versions
(this is what cargo does). We'll need to be careful to ensure this does
not break downstream packages which parse our version string.

```
❯ ruff --version
ruff 0.1.0
```

The LSP should be updated to use `ruff version --output-format json`
instead of parsing `ruff --version`.
2023-10-20 14:07:41 -05:00
..
flake8_to_ruff Release 0.1.1 (#8073) 2023-10-19 20:49:53 +00:00
ruff_benchmark Bump ureq from 2.7.1 to 2.8.0 (#7756) 2023-10-02 09:49:59 -04:00
ruff_cache Introduce FormatterSettings (#7545) 2023-09-21 08:01:24 +02:00
ruff_cli Add ruff version with long version display (#8034) 2023-10-20 14:07:41 -05:00
ruff_dev Respect #(deprecated) attribute in configuration options (#8035) 2023-10-19 01:07:36 +00:00
ruff_diagnostics Add settings for promoting and demoting fixes (#7841) 2023-10-10 20:04:21 +00:00
ruff_formatter Comments outside expression parentheses (#7873) 2023-10-19 09:24:11 +00:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_linter [pylint] - implement non-ascii-name (C2401) (#8038) 2023-10-20 18:53:51 +00:00
ruff_macros Add #[automatically_derived] to derived impls (#8080) 2023-10-20 00:12:27 +00:00
ruff_notebook Add cell field to JSON output format (#7664) 2023-10-13 01:06:02 +00:00
ruff_python_ast Remove leftover constant tuple reference (#8062) 2023-10-19 17:50:45 +00:00
ruff_python_codegen Add support for PEP 701 (#7376) 2023-09-29 02:55:39 +00:00
ruff_python_formatter Comments outside expression parentheses (#7873) 2023-10-19 09:24:11 +00:00
ruff_python_index Add support for PEP 701 (#7376) 2023-09-29 02:55:39 +00:00
ruff_python_literal Implement our own small-integer optimization (#7584) 2023-09-25 15:13:21 +00:00
ruff_python_parser Disallow f-strings in match pattern literal (#7857) 2023-10-09 10:11:08 +00:00
ruff_python_resolver Replace .map_or(false, $closure) with .is_some_and(closure) (#6244) 2023-08-01 19:29:42 +02:00
ruff_python_semantic Avoid if-else simplification for TYPE_CHECKING blocks (#8072) 2023-10-19 19:15:54 -04:00
ruff_python_stdlib Improvements to RUF015 (#7848) 2023-10-08 14:49:45 +00:00
ruff_python_trivia Extend pragma comment cases (#7687) 2023-09-28 18:55:19 +00:00
ruff_shrinking Release 0.1.1 (#8073) 2023-10-19 20:49:53 +00:00
ruff_source_file Add cell field to JSON output format (#7664) 2023-10-13 01:06:02 +00:00
ruff_text_size Unify line size settings between ruff and the formatter (#6873) 2023-08-28 06:44:56 +00:00
ruff_wasm Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
ruff_workspace Fix Options JSON schema description (#8081) 2023-10-20 00:25:32 +00:00