Commit Graph

51 Commits

Author SHA1 Message Date
Zanie 2a14b94995 Explicitly cast checkout directory to string 2023-10-27 12:23:51 -05:00
Zanie c4bddb88c9 Use `cls` in `DiagnosticLine.try_from_string` 2023-10-27 12:23:04 -05:00
Zanie 8441db69ae Fix `total_changes_by_rule` type annotation 2023-10-27 12:22:25 -05:00
Zanie e304d46637 Add mutability note for `RuleChanges` 2023-10-27 12:21:03 -05:00
Zanie 23050b3653 Guard against dataclass types in jsonable implementation 2023-10-27 12:15:59 -05:00
Zanie Blue 7dc97fd358 Improve readme description.
Co-authored-by: konsti <konstin@mailbox.org>
2023-10-27 12:08:50 -05:00
Zanie 3936bc119a Drop coloring 2023-10-27 12:08:50 -05:00
Zanie a1bec32a7b Fix error rendering 2023-10-27 12:08:50 -05:00
Zanie 6f593cac68 in files -> across files 2023-10-27 12:08:50 -05:00
Zanie 823ec4cf88 Strip all newlines from error reports 2023-10-27 12:08:50 -05:00
Zanie 087d9c705e Test adding color to diff; fix newline in error report 2023-10-27 12:08:50 -05:00
Zanie 06f71f5235 Remove comma for consistency 2023-10-27 12:08:50 -05:00
Zanie 2270485c09 Display errors in code fences 2023-10-27 12:08:50 -05:00
Zanie 1bbe88f0a0 Fix project truncation 2023-10-27 12:08:50 -05:00
Zanie e0def9ef95 Truncate more aggressively 2023-10-27 12:08:50 -05:00
Zanie 85de1e97e2 Add completed project count to summary title 2023-10-27 12:08:50 -05:00
Zanie 9cdf864043 Enable all projects again 2023-10-27 12:08:50 -05:00
Zanie 9a8bd09ae6 Fix table 2023-10-27 12:08:50 -05:00
Zanie 2e36781a8a Add more truncation? 2023-10-27 12:08:50 -05:00
Zanie 615e56906e Fix added / removed counts for `format` 2023-10-27 12:08:50 -05:00
Zanie ce290076b8 Restore display of fixes 2023-10-27 12:08:50 -05:00
Zanie 1f6b28c29c Fix table 2023-10-27 12:08:50 -05:00
Zanie d4e9418825 Fix calculation to ignore fixes 2023-10-27 12:08:50 -05:00
Zanie 89f9803f4a Restructuring parsing 2023-10-27 12:08:50 -05:00
Zanie 25bda80e48 Improve limits per rule code 2023-10-27 12:08:50 -05:00
Zanie 88e3663dbe Fix affected rules total 2023-10-27 12:08:50 -05:00
Zanie 5a055aadb0 Fix titles 2023-10-27 12:08:50 -05:00
Zanie 333aedc903 Refactor fixable detection 2023-10-27 12:08:50 -05:00
Zanie 6025081825 Add messy fixable detection to reduce rule changes 2023-10-27 12:08:44 -05:00
Zanie c806b4a35a Sort imports 2023-10-27 12:07:51 -05:00
Zanie 1c820b0200 Clean up Python implementation; enable all projects 2023-10-27 12:07:51 -05:00
Zanie 1f4e87f043 Use `set` instead of `sorted` in `RuleChanges.from_diff` 2023-10-27 12:07:51 -05:00
Zanie db5dfd4eff Loosen linked ranges for format diffs since they are not correct 2023-10-27 12:07:51 -05:00
Zanie c2cae71247 Improve rule table title 2023-10-27 12:07:51 -05:00
Zanie 11e99655b8 Fix formatting of command 2023-10-27 12:07:51 -05:00
Zanie 8898906ef4 Update options display 2023-10-27 12:07:51 -05:00
Zanie 9c63d80257 Change table title 2023-10-27 12:07:51 -05:00
Zanie d6e35f72a9 Move rule change table into details block 2023-10-27 12:07:51 -05:00
Zanie 89501451d9 Remove file links (only do line links) 2023-10-27 12:07:51 -05:00
Zanie 368cb3ee95 Add max lines per project to `ruff check` 2023-10-27 12:07:51 -05:00
Zanie cbc24a3de2 Use `<pre>` for check output 2023-10-27 12:07:51 -05:00
Zanie 071c54e89b Add unidiff dep 2023-10-27 12:07:51 -05:00
Zanie d6aa117949 Lint 2023-10-27 12:07:51 -05:00
Zanie ab49eaae61 Add formatter ecosystem checks 2023-10-27 12:07:51 -05:00
Zanie 4b79f57872 Refactor ecosystem checks into module 2023-10-27 12:07:51 -05:00
konstin acb23dce3c
Fix subprocess.run on Windows Python 3.7 (#5220)
## Summary

From the [subprocess
docs](https://docs.python.org/3/library/subprocess.html#subprocess.Popen):

> Changed in version 3.6: args parameter accepts a path-like object if
shell is False and a sequence containing path-like objects on POSIX.
>
> Changed in version 3.8: args parameter accepts a path-like object if
shell is False and a sequence containing bytes and path-like objects on
Windows.

We want to support python 3.7 on windows, so we need to convert the
`Path` into a `str`
2023-06-20 13:53:32 -04:00
konstin c811213302
Allow space in filename for powershell + windows + python module (#5115)
Fixes #5077

## Summary

Previously, in a powershell on windows when using `python -m ruff`
instead of `ruff` a call such as `python -m ruff "a b.py"` would fail
because the space would be split into two arguments.

The python docs
[recommend](https://docs.python.org/3/library/os.html#os.spawnv) using
subprocess instead of os.spawn variants, which does fix the problem.

## Test Plan

I manually confirmed that the problem previously occurred and now
doesn't anymore. This only happens in a very specific environment
(maturin build, windows, powershell), so i could try adding a step on CI
for it but i don't think it's worth it.

```
(.venv) PS C:\Users\Konstantin\PycharmProjects\ruff> python -m ruff "a b.py"
warning: Detected debug build without --no-cache.
error: Failed to lint a: The system cannot find the file specified. (os error 2)
error: Failed to lint b.py: The system cannot find the file specified. (os error 2)
a:1:1: E902 The system cannot find the file specified. (os error 2)
b.py:1:1: E902 The system cannot find the file specified. (os error 2)
Found 2 errors.
(.venv) PS C:\Users\Konstantin\PycharmProjects\ruff> python -m ruff "a b.py"
warning: Detected debug build without --no-cache.
a b.py:2:5: F841 [*] Local variable `x` is assigned to but never used
Found 1 error.
[*] 1 potentially fixable with the --fix option.
```
2023-06-15 20:57:00 +02:00
Anders Kaseorg 6683ed49bc
Portably find ruff binary path from Python (#2574)
Prefer the version from a currently active virtualenv over a version
from `pip install --user`.  Add the .exe extension on Windows, and
find the path for `pip install --user` correctly on Windows.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-02-04 17:19:27 -05:00
Matteo Vitali 5a9258327b
Fix python module invocation (#2563) 2023-02-04 08:23:13 -05:00
Jonathan Plasse bdcab87d2f
Add `markdownlint` and dev Ruff to `pre-commit` (#2303) 2023-02-02 16:29:07 -05:00