Commit Graph

34 Commits

Author SHA1 Message Date
Micha Reiser 4e3982cf95
[red-knot] Add `--ignore`, `--warn`, and `--error` CLI arguments (#15689) 2025-01-24 16:20:15 +01:00
Micha Reiser 43160b4c3e
Tidy knot CLI tests (#15685) 2025-01-23 14:06:07 +01:00
Micha Reiser dc6aafecc2
Setup tracing and document tracing usage (#12730) 2024-08-08 06:28:40 +00:00
Hoël Bagard 8619986123
Add `repos/` to the gitignore (#10435)
## Summary

I would like to add `repos/` to the gitignore since it is given as an
example for the cache directory path in [the ecosystem check's
README](https://github.com/astral-sh/ruff/tree/main/python/ruff-ecosystem#development):

```console
ruff-ecosystem check ruff "./target/debug/ruff" --cache ./repos
```
2024-03-17 09:18:29 -05:00
konsti c3774e1255
Fix gitignore to not ignore files that are required (#7538)
It is apparently possible to add files to the git index, even if they
are part of the gitignore (see e.g.
https://stackoverflow.com/questions/45400361/why-is-gitignore-not-ignoring-my-files,
even though it's strange that the gitignore entries existed before the
files were added, i wouldn't know how to get them added in that case). I
ran
```
git rm -r --cached .
```
then change the gitignore not actually ignore those files with the
exception of
`crates/ruff_cli/resources/test/fixtures/cache_mutable/source.py`, which
is actually a generated file.
2023-09-21 21:33:09 +02:00
Charlie Marsh 5849a75223
Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
konsti 7dd30f0270
Read black options in format_dev script (#5827)
## Summary

Comparing repos with black requires that we use the settings as black,
notably line length and magic trailing comma behaviour. Excludes and
preserving quotes (vs. a preference for either quote style) is not yet
implemented because they weren't needed for the test projects.

In the other two commits i fixed the output when the progress bar is
hidden (this way is recommonded in the indicatif docs), added a
`scratch.pyi` file to gitignore because black formats stub files
differently and also updated the ecosystem readme with the projects json
without forks.

## Test Plan

I added a `line-length` vs `line_length` test. Otherwise only my
personal usage atm, a PR to integrate the script into the CI to check
some projects will follow.
2023-07-17 13:29:43 +00:00
Charlie Marsh ea270da289
Move some MkDocs responsibilities around (#5542)
## Summary

Note that I've also changed from `mkdocs serve` to `mkdocs serve -f
mkdocs.generated.yml` to be clearer that this is a generated file.
2023-07-05 22:06:01 +00:00
konstin 5c5d2815af
Document gitignore (#5191)
This docs-only change adds explanations to all custom .gitignore entries
2023-06-20 08:07:30 +02:00
konstin 361d45f2b2
Add `cargo dev repeat` for profiling (#5144)
## Summary

This adds a new subcommand that can be used as

```shell
cargo build --bin ruff_dev --profile=release-debug
perf record -g -F 999 target/release-debug/ruff_dev repeat --repeat 30 --exit-zero --no-cache path/to/cpython > /dev/null
flamegraph --perfdata perf.data
```

## Test Plan

This is a ruff internal script. I successfully used it to profile
cpython with the instructions above
2023-06-19 11:40:09 +02:00
konstin 63d892f1e4
Implement basic module formatting (#4784)
* Add Format for Stmt

* Implement basic module formatting

This implements formatting each statement in a module with a hard line break in between, so that we can start formatting statements.

Basic testing is done by the snapshots
2023-06-01 15:25:50 +02:00
konstin 04d273bcc7
Add a script to update the schemastore (#4574)
* Add a script to update the schemastore

Hacked this together, it clones astral-sh/schemastore, updated the schema and pushes the changes
to a new branch tagged with the ruff git hash. You can see the URL to create the PR
to schemastore in the CLI. The script is separated into three blocks so you can rerun
the schema generation in the middle before committing.

* Use tempdir for schemastore

* Add comments
2023-05-23 10:41:56 +00:00
konstin 550b643e33
Add script for ecosystem wide checks of all rules and fixes (#4326)
* Add script for ecosystem wide checks of all rules and fixes

This adds my personal script for checking an entire checkout of ~2.1k packages for
panics, autofix errors and similar problems. It's not really meant to be used by anybody else but i thought it's better if it lives in the repo than if it doesn't.

For reference, this is the current output of failing autofixes: https://gist.github.com/konstin/c3fada0135af6cacec74f166adf87a00. Trimmed down to the useful information: https://gist.github.com/konstin/c864f4c300c7903a24fdda49635c5da9

* Keep github template intact

* Remove the need for ripgrep

* sort output
2023-05-22 15:23:25 +02:00
konstin 6a52577630
Ecosystem CI: Allow storing checkouts locally (#4192)
* Ecosystem CI: Allow storing checkouts locally

This adds a --checkouts options to (re)use a local directory instead of checkouts into a tempdir

* Fix missing path conversion
2023-05-11 17:36:44 +02:00
konstin 0096938789
Optionally show fixes when using `--features ecosystem_ci` with cargo and `--show-fixes` at runtime (#4191)
* Generate fixes when using --show-fixes

Example command: `cargo run --bin ruff -- --no-cache --select F401
--show-source --show-fixes
crates/ruff/resources/test/fixtures/pyflakes/F401_9.py`

Before, `--show-fixes` was ignored:

```
crates/ruff/resources/test/fixtures/pyflakes/F401_9.py:4:22: F401 [*] `foo.baz` imported but unused
  |
4 | __all__ = ("bar",)
5 | from foo import bar, baz
  |                      ^^^ F401
  |
  = help: Remove unused import: `foo.baz`

Found 1 error.
[*] 1 potentially fixable with the --fix option.
```

After:

```
crates/ruff/resources/test/fixtures/pyflakes/F401_9.py:4:22: F401 [*] `foo.baz` imported but unused
  |
4 | __all__ = ("bar",)
5 | from foo import bar, baz
  |                      ^^^ F401
  |
  = help: Remove unused import: `foo.baz`

ℹ Suggested fix
1 1 | """Test: late-binding of `__all__`."""
2 2 |
3 3 | __all__ = ("bar",)
4   |-from foo import bar, baz
  4 |+from foo import bar

Found 1 error.
[*] 1 potentially fixable with the --fix option.
```

* Add `--format ecosystem-ci`

* cargo dev generate-all

* Put behind cargo feature

* Regenerate docs

* Don't test ecosystem_ci feature on CI

* Use top level flag instead

* Fix

* Simplify code based on #4191

* Remove old TODO comment
2023-05-10 17:45:57 +02:00
konstin 454c6d9c2f
Extended ecosystem check with scraped data (#3858) 2023-04-06 22:39:48 +00:00
Martin Fischer c858804ed4 refactor: Move docs/ gitignores to docs/.gitignore 2023-02-13 19:34:06 -05:00
Florian Best 32520ff07f
ci(gitignore): ignore VIM files (#2856) 2023-02-13 09:29:53 -05:00
trag1c b8835c2e35
Added MkDocs section to CONTRIBUTING.md (#2803) 2023-02-12 16:07:24 +00:00
trag1c e6538a7969
Added logo and favicon for mkdocs (#2757) 2023-02-10 23:34:47 -05:00
Charlie Marsh 271e4fda8c
Create per-rule pages and link from README (#2644) 2023-02-07 18:15:05 -05:00
Micha Reiser cd8be8c0be
refactor: Introduce crates folder (#2088)
This PR introduces a new `crates` directory and moves all "product" crates into that folder. 

Part of #2059.
2023-02-05 16:47:48 -05:00
Charlie Marsh f432ce291a Add Fathom to docs 2023-02-01 18:41:24 -05:00
Simon Brugman 5165b703d9
Add VS Code to gitignore; fix typos (#2333) 2023-01-29 21:14:38 -05:00
Charlie Marsh 071e3fd196
Split MkDocs site into multiple pages (#2296) 2023-01-28 08:31:16 -05:00
Charlie Marsh eaac3cae5e
Add MkDocs version of README (#2287)
Co-authored-by: Justin Flannery <juftin@juftin.com>
2023-01-27 22:57:42 -05:00
Colin Delahunty 4ad8db3d61
Pyupgrade: Turn errors into OSError (#1434) 2022-12-31 16:36:05 -05:00
Charlie Marsh 994f5d452c Update .gitignore 2022-09-01 20:32:32 -04:00
Charlie Marsh c52fdfa748
Rename to ruff (#29) 2022-08-27 18:30:30 -04:00
Charlie Marsh 7359e862c1
Add pyproject.toml support (#17) 2022-08-20 13:00:34 -04:00
Charlie Marsh b7d7c50b2b
Add benchmarking (#16) 2022-08-19 15:38:43 -04:00
Charles Marsh b92e7e664c Add Cargo.lock 2022-08-10 16:37:18 -04:00
Charlie Marsh 36efdfe7b4
Enable Maturin (#1) 2022-08-10 15:42:29 -04:00
Charles Marsh 0d8e4bd6e9 Initial commit for linter prototype 2022-08-09 13:19:19 -04:00