Skip to content

Commit

Permalink
Update violation docs for yield from violation. (#1062)
Browse files Browse the repository at this point in the history
* Update violation docs for yield from violation.

Address issue #1057. Update violation docs to make it easier for developers to understand how to refactor more complex yield statements.

* Fix error message for WPS349

Fix issue #1044.

* Update CHANGELOG.md

* Update refactoring.py
  • Loading branch information
andreaestrada authored and sobolevn committed Dec 9, 2019
1 parent c7ecde3 commit a00d479
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ It features a lot of new rules from different categories.
- Adds local Github Action that uses itself for testing
- Adds official Docker image and docs about it


## 0.12.4

### Bugfixes

- Fixes bug with `nitpick` colors and new files API
- Updates `flake8-docstrings`


## 0.12.3

### Bugfixes
Expand All @@ -132,6 +134,7 @@ It features a lot of new rules from different categories.
- Fixes that `1 / number` was not allowed
- Fixes that `%` operator was allowed for `0` and `1`


## 0.12.2

### Features
Expand All @@ -144,6 +147,7 @@ It features a lot of new rules from different categories.

- Fixes that `{**a, **b}` was reported as duplicate hash items


## 0.12.1

### Features
Expand All @@ -160,6 +164,7 @@ It features a lot of new rules from different categories.
- Improves `README.md` with `flakehell` and `nitpick` mentions
- Improves docs all accross the project


## 0.12.0

In this release we had a little focus on:
Expand Down Expand Up @@ -291,12 +296,14 @@ In this release we had a little focus on:
- Updates docs about `snake_case` in `Enum` fields
- Updates docs about `WPS400` and incorrect line number


## 0.11.1

### Bugfixes

- Now using `pygments` as a direct dependency


## 0.11.0 aka The New Violation Codes

We had a really big problem: all violations inside `best_practices`
Expand Down Expand Up @@ -336,6 +343,7 @@ for you to rename your violations with a script.
- Renames `IncorrectlyNestedTernaryViolation` to `NestedTernaryViolation`
- Renames `IncorectLoopIterTypeViolation` to `WrongLoopIterTypeViolation`


## 0.10.0 aka The Great Compare

This release is mostly targeted at writing better compares and conditions.
Expand Down Expand Up @@ -393,12 +401,14 @@ big cudos to the developers of this wonderful tool.
- Adds `Makefile`
- A lot of minor dependency updates


## 0.9.1

### Bugfixes

- Fixes issue with `pydocstyle>=4` by glueing its version to `pydocstyle<4`


## 0.9.0

This is mostly a supporting release with several new features
Expand Down Expand Up @@ -435,12 +445,14 @@ and lots of bug fixes.
- Better `exclude` rule for `flake8` check
- Removed warnings from `pytest`


## 0.8.1

### Bugfixes

- Fixes how `wps_context` is calculated, so `super()` calls are now working


## 0.8.0

### Features
Expand Down Expand Up @@ -471,6 +483,7 @@ and lots of bug fixes.
- Improves docs for `ProtectedAttributeViolation`
- Adds docs about `.pyi` files


## 0.7.1

### Bugfixes
Expand All @@ -482,6 +495,7 @@ and lots of bug fixes.

- Improves docs about using `# type: some` comment in `for` loops


## 0.7.0

### Features
Expand Down Expand Up @@ -545,24 +559,28 @@ and lots of bug fixes.
- Refactoring: moves `presets` package to the root
- Improves tests: we now lint our layered architecure with `layer-lint`


## Version 0.6.3

### Bugfixes

- Fixes an [issue-450](https://github.com/wemake-services/wemake-python-styleguide/issues/450) with `dict`s with just values and no keys


## Version 0.6.2

### Bugfixes

- Fixes a [crash](https://github.com/wemake-services/wemake-python-styleguide/issues/423) with class attributes assignment


## Version 0.6.1

### Bugfixes

- Fixes a conflict between our plugin and `pyflakes`


## Version 0.6.0

### Features
Expand Down Expand Up @@ -599,13 +617,15 @@ and lots of bug fixes.
- Improves docs: making contributing section in the `README` more friendly
- Improves build: changes how CI installs `poetry`


## 0.5.1

### Bugfixes

- Fixes all possible errors that happen
because of unset `parent` and `function_type` properties


## 0.5.0

### Features
Expand Down Expand Up @@ -686,6 +706,7 @@ for tests. We also now covering more cases and testing violation texts.
- Improves tests: now all common patters live in related `conftest.py`
- Improves docs: now all configuration options are listed in the violations


## 0.3.0 aka The Hacktoberfest Feast

This release was made possible by awesome people who contributed
Expand Down Expand Up @@ -754,6 +775,7 @@ to the project during `#hactoberfest`. List of awesome people:
- Improves types: now we use `final` to indicate what should not be changed
- Improves types: now we do not have any ugly import hacks


## 0.2.0 aka Revenge of the Async

This release was made possible by awesome people who contributed
Expand Down Expand Up @@ -786,6 +808,7 @@ to the project during `#hactoberfest`. List of awesome people:
- Improves docs: multiple typos, bugs, and issues fixes
- Improves tests: now we are testing `async` comprehensions


## Version 0.1.0

### Features
Expand Down Expand Up @@ -825,6 +848,7 @@ to the project during `#hactoberfest`. List of awesome people:
- Improves docs: now error pages are split
- Improves docs: now all `flake8` plugin dependencies are documented


## Version 0.0.15

### Features
Expand All @@ -837,6 +861,8 @@ to the project during `#hactoberfest`. List of awesome people:

- Improves `CONTRIBUTING.md`
- Moves issues templates to `.github/` folder
- Update error thrown on `RedundantSubscriptViolation`


## Version 0.0.14

Expand All @@ -861,6 +887,7 @@ to the project during `#hactoberfest`. List of awesome people:
- Adds `flake8-print` plugin for development
- Removes `delegate` concept from the codebase


## Version 0.0.13 aka The Jones Complexity

### Features
Expand All @@ -873,6 +900,7 @@ to the project during `#hactoberfest`. List of awesome people:
- Improves docs: adds detailed installation instructions
- Removes `flake8-blind-except` plugin


## Version 0.0.12

This is just a supporting release.
Expand All @@ -895,6 +923,7 @@ We have **changed** the error codes for general checks.
- Improves docs: now we have templates for `bug` and `rule-request`
- Replaced `pytest-isort` with `flake8-isort`


## Version 0.0.11

This is just a supporting release.
Expand Down Expand Up @@ -936,6 +965,7 @@ There are no new features introduced.
- Now each error has a link to the corresponding constant (if any)
- Improved docs with links to the corresponding configuration flags


## Version 0.0.9

This is just a supporting release.
Expand All @@ -951,6 +981,7 @@ There are no new features introduced.
- Errors are now tested
- Complexity tests are refactored


## Version 0.0.8 aka The Complex Complexity

### Features
Expand All @@ -974,6 +1005,7 @@ There are no new features introduced.

- Improved type support for options parsing


## Version 0.0.7

### Features
Expand All @@ -993,6 +1025,7 @@ There are no new features introduced.
- Tests now cover nested classes' explicit bases
- Tests now cover nested classes and functions `noqa` comment


## Version 0.0.6

### Features
Expand All @@ -1010,6 +1043,7 @@ There are no new features introduced.
- Improved typing support
- Added new documentation sections


## Version 0.0.5

### Features
Expand All @@ -1022,6 +1056,7 @@ There are no new features introduced.

- We have added a `CONTRIBUTING.md` file to help new contributors


## Version 0.0.4

### Features
Expand All @@ -1037,6 +1072,7 @@ There are no new features introduced.
- Imports are now have its own subgroup `Z10`
- General rules now start from `Z11`


## Version 0.0.3

### Features
Expand All @@ -1056,6 +1092,7 @@ There are no new features introduced.
- Fixes issue with missing `parent`s :batman:
- Fixes issue with `_$NAME` patterns being ignored


## Version 0.0.2

### Features
Expand All @@ -1076,6 +1113,7 @@ There are no new features introduced.
- Adds `poetry` as the main project tool
- Adds `shpinx` as a documentation tool


## Version 0.0.1

- Initial release
2 changes: 1 addition & 1 deletion wemake_python_styleguide/violations/consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ class RedundantSubscriptViolation(ASTViolation):
"""

error_template = 'Found redundant subscript slice: {0}'
error_template = 'Found redundant subscript slice'
code = 349


Expand Down
9 changes: 7 additions & 2 deletions wemake_python_styleguide/violations/refactoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,14 @@ class ImplicitYieldFromViolation(ASTViolation):
# Correct:
yield from some()
yield from (
value[index:index + chunk_size]
for index in range(0, len(value), chunk_size)
)
# Wrong:
for item in some():
yield item
for index in chunk:
yield index
.. versionadded:: 0.13.0
Expand Down

0 comments on commit a00d479

Please sign in to comment.