ruff icon indicating copy to clipboard operation
ruff copied to clipboard

[`pycodestyle`] Implement `missing-or-outdented-indentation` (`E122`)

Open augustelalande opened this issue 1 year ago • 3 comments

Summary

Following the discussion in #8557, and since no more work has been done since then, I thought I would take a stab at E122.

Part of #2402.

Test Plan

Test fixtures added.

I also validated the output against pycodestyle on some of the ecosystem repos.

augustelalande avatar May 09 '24 01:05 augustelalande

CodSpeed Performance Report

Merging #11349 will not alter performance

Comparing augustelalande:E122 (c12d4b2) with main (5806bc9)

Summary

✅ 30 untouched benchmarks

codspeed-hq[bot] avatar May 09 '24 02:05 codspeed-hq[bot]

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+13 -0 violations, +0 -0 fixes in 3 projects; 47 projects unchanged)

bokeh/bokeh (+8 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ src/bokeh/models/ui/ui_element.py:81:1: E122 Continuation line missing indentation or outdented.
+ src/bokeh/util/compiler.py:329:1: E122 Continuation line missing indentation or outdented.
+ src/bokeh/util/compiler.py:340:1: E122 Continuation line missing indentation or outdented.
+ src/bokeh/util/compiler.py:351:1: E122 Continuation line missing indentation or outdented.
+ src/bokeh/util/compiler.py:366:1: E122 Continuation line missing indentation or outdented.
+ src/bokeh/util/compiler.py:382:1: E122 Continuation line missing indentation or outdented.
+ src/bokeh/util/compiler.py:385:1: E122 Continuation line missing indentation or outdented.
+ tests/unit/bokeh/command/subcommands/test_serve.py:403:1: E122 Continuation line missing indentation or outdented.
milvus-io/pymilvus (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ examples/example_tls1.py:70:1: E122 Continuation line missing indentation or outdented.
+ examples/example_tls1.py:71:1: E122 Continuation line missing indentation or outdented.
+ examples/example_tls2.py:72:1: E122 Continuation line missing indentation or outdented.
+ examples/example_tls2.py:73:1: E122 Continuation line missing indentation or outdented.
pandas-dev/pandas (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ pandas/tests/extension/test_arrow.py:929:1: E122 Continuation line missing indentation or outdented.
Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
E122 13 13 0 0 0

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

github-actions[bot] avatar May 09 '24 02:05 github-actions[bot]

@MichaReiser Could you review this when you get the chance? Thanks.

Note when reviewing: pycodestyle allows two types of indentation: hanging indent and visual indent. However, it does not enforce a single style. Which is to say that even if one style is violated, if the other is followed then no error is reported. Therefore even though this rule doesn't check for visual indentation, it still needs to establish if visual indentation is present in order to match the pycodestyle behavior.

augustelalande avatar May 19 '24 06:05 augustelalande