Skip to content

Commit

Permalink
Release 0.1.1 (#8073)
Browse files Browse the repository at this point in the history
- Add changelog entry for 0.1.1
- Bump version to 0.1.1
- Require preview for fix added in #7967 
- Allow duplicate headings in changelog (markdownlint setting)
  • Loading branch information
zanieb authored Oct 19, 2023
1 parent ec1be60 commit 22cf451
Show file tree
Hide file tree
Showing 19 changed files with 354 additions and 153 deletions.
5 changes: 5 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ MD041: false

# MD013/line-length
MD013: false

# MD024/no-duplicate-heading
MD024:
# Allow when nested under different parents e.g. CHANGELOG.md
allow_different_nesting: true
53 changes: 51 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,60 @@
# Changelog

This is the first release which uses the `CHANGELOG` file. See [GitHub Releases](https://github.com/astral-sh/ruff/releases) for prior changelog entries.
## 0.1.1

Read Ruff's new [versioning policy](https://docs.astral.sh/ruff/versioning/).
### Rule changes

- Add unsafe fix for `escape-sequence-in-docstring` (`D301`) (#7970)

### Configuration

- Respect `#(deprecated)` attribute in configuration options (#8035)
- Add `[format|lint].exclude` options (#8000)
- Respect `tab-size` setting in formatter (#8006)
- Add `lint.preview` (#8002)

## Preview features

- \[`pylint`\] Implement `literal-membership` (`PLR6201`) (#7973)
- \[`pylint`\] Implement `too-many-boolean-expressions` (`PLR0916`) (#7975)
- \[`pylint`\] Implement `misplaced-bare-raise` (`E0704`) (#7961)
- \[`pylint`\] Implement `global-at-module-level` (`W0604`) (#8058)
- \[`pylint`\] Implement `unspecified-encoding` (`PLW1514`) (#7939)
- Add fix for `triple-single-quotes` (`D300`) (#7967)

### Formatter

- New code style badge for `ruff format` (#7878)
- Fix comments outside expression parentheses (#7873)
- Add `--target-version` to `ruff format` (#8055)
- Skip over parentheses when detecting `in` keyword (#8054)
- Add `--diff` option to `ruff format` (#7937)
- Insert newline after nested function or class statements (#7946)
- Use `pass` over ellipsis in non-function/class contexts (#8049)

### Bug fixes

- Lazily evaluate all PEP 695 type alias values (#8033)
- Avoid failed assertion when showing fixes from stdin (#8029)
- Avoid flagging HTTP and HTTPS literals in urllib-open (#8046)
- Avoid flagging `bad-dunder-method-name` for `_` (#8015)
- Remove Python 2-only methods from `URLOpen` audit (#8047)
- Use set bracket replacement for `iteration-over-set` to preserve whitespace and comments (#8001)

### Documentation

- Update tutorial to match revised Ruff defaults (#8066)
- Update rule `B005` docs (#8028)
- Update GitHub actions example in docs to use `--output-format` (#8014)
- Document `lint.preview` and `format.preview` (#8032)
- Clarify that new rules should be added to `RuleGroup::Preview`. (#7989)

## 0.1.0

This is the first release which uses the `CHANGELOG` file. See [GitHub Releases](https://github.com/astral-sh/ruff/releases) for prior changelog entries.

Read Ruff's new [versioning policy](https://docs.astral.sh/ruff/versioning/).

### Breaking changes

- Unsafe fixes are no longer displayed or applied without opt-in ([#7769](https://github.com/astral-sh/ruff/pull/7769))
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com) hook:
```yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.0
rev: v0.1.1
hooks:
- id: ruff
```
Expand Down
2 changes: 1 addition & 1 deletion crates/flake8_to_ruff/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flake8-to-ruff"
version = "0.1.0"
version = "0.1.1"
description = """
Convert Flake8 configuration files to Ruff configuration files.
"""
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ruff_cli"
version = "0.1.0"
version = "0.1.1"
publish = false
authors = { workspace = true }
edition = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_linter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ruff_linter"
version = "0.1.0"
version = "0.1.1"
publish = false
authors = { workspace = true }
edition = { workspace = true }
Expand Down
28 changes: 28 additions & 0 deletions crates/ruff_linter/src/rules/pydocstyle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod tests {
use test_case::test_case;

use crate::registry::Rule;
use crate::settings::types::PreviewMode;
use crate::test::test_path;
use crate::{assert_messages, settings};

Expand Down Expand Up @@ -107,6 +108,33 @@ mod tests {
Ok(())
}

#[test_case(Rule::TripleSingleQuotes, Path::new("D.py"))]
#[test_case(Rule::TripleSingleQuotes, Path::new("D300.py"))]
fn preview_rules(rule_code: Rule, path: &Path) -> Result<()> {
// Tests for rules with preview features
let snapshot = format!(
"preview__{}_{}",
rule_code.noqa_code(),
path.to_string_lossy()
);
let diagnostics = test_path(
Path::new("pydocstyle").join(path).as_path(),
&settings::LinterSettings {
pydocstyle: Settings {
convention: None,
ignore_decorators: BTreeSet::from_iter(["functools.wraps".to_string()]),
property_decorators: BTreeSet::from_iter([
"gi.repository.GObject.Property".to_string()
]),
},
preview: PreviewMode::Enabled,
..settings::LinterSettings::for_rule(rule_code)
},
)?;
assert_messages!(snapshot, diagnostics);
Ok(())
}

#[test]
fn bom() -> Result<()> {
let diagnostics = test_path(
Expand Down
28 changes: 16 additions & 12 deletions crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ pub(crate) fn triple_quotes(checker: &mut Checker, docstring: &Docstring) {
let mut diagnostic =
Diagnostic::new(TripleSingleQuotes { expected_quote }, docstring.range());

let body = docstring.body().as_str();
if !body.ends_with('\'') {
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
format!("{prefixes}'''{body}'''"),
docstring.range(),
)));
if checker.settings.preview.is_enabled() {
let body = docstring.body().as_str();
if !body.ends_with('\'') {
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
format!("{prefixes}'''{body}'''"),
docstring.range(),
)));
}
}

checker.diagnostics.push(diagnostic);
Expand All @@ -94,12 +96,14 @@ pub(crate) fn triple_quotes(checker: &mut Checker, docstring: &Docstring) {
let mut diagnostic =
Diagnostic::new(TripleSingleQuotes { expected_quote }, docstring.range());

let body = docstring.body().as_str();
if !body.ends_with('"') {
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
format!("{prefixes}\"\"\"{body}\"\"\""),
docstring.range(),
)));
if checker.settings.preview.is_enabled() {
let body = docstring.body().as_str();
if !body.ends_with('"') {
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
format!("{prefixes}\"\"\"{body}\"\"\""),
docstring.range(),
)));
}
}

checker.diagnostics.push(diagnostic);
Expand Down
Loading

0 comments on commit 22cf451

Please sign in to comment.