Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.8.0 #133

Merged
merged 9 commits into from Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions .bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.7.0
current_version = 2.8.0
commit = False

[bumpversion:file:pyproject.toml]
Expand All @@ -9,7 +9,3 @@ replace = version = "{new_version}"
[bumpversion:file:flake8_annotations/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[bumpversion:file:README.md]
search = flake8-annotations: {current_version}
replace = flake8-annotations: {new_version}
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

56 changes: 32 additions & 24 deletions CHANGELOG.md
@@ -1,6 +1,14 @@
# Changelog
Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<major>`.`<minor>`.`<patch>`)

## [v2.8.0]
### Added
* #131 Add the `ANN4xx` error level for opinionated warnings that are disabled by default.
* #131 Add `ANN401` for use of `typing.Any` as an argument annotation.

### Changed
* Python 3.7 is now the minimum supported version

## [v2.7.0]
### Added
* #122 Add support for Flake8 v4.x
Expand Down Expand Up @@ -59,8 +67,8 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<ma

## [v2.0.1]
### Added
* #71 Add `pep8-naming` to linting toolchain
* Expand pre-commit hooks
* (Internal) #71 Add `pep8-naming` to linting toolchain
* (Internal) Expand pre-commit hooks
* Add `black`
* Add `check-merge-conflict`
* Add `check-toml`
Expand All @@ -70,7 +78,7 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<ma
* Add `python-check-blanket-noqa`

### Changed
* Add argument names to `Argument` and `Function` `__repr__` methods to make the string more helpful to read
* (Internal) Add argument names to `Argument` and `Function` `__repr__` methods to make the string more helpful to read

### Fixed
* #70 Fix incorrect column index for missing return annotations when other annotations are present on the same line of source
Expand All @@ -83,57 +91,57 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<ma

## [v1.2.0]
### Added
* Add test case for checking whether flake8 invokes our plugin
* #41 Add `--suppress-none-returning` configuration option to suppress TYP200 level errors for functions that either lack a `return` statement or only explicitly return `None`.
* Add `black` as an explicit developer requirement (codebase already adheres to `black` formatting)
* (Internal) Add test case for checking whether flake8 invokes our plugin
* #41 Add `--suppress-none-returning` configuration option to suppress `TYP200` level errors for functions that either lack a `return` statement or only explicitly return `None`.
* (Internal) Add `black` as an explicit developer requirement (codebase already adheres to `black` formatting)

### Changed
* #61 Migrate from Pipenv to Poetry for developer environment setup
* (Internal) #61 Migrate from Pipenv to Poetry for developer environment setup

## [v1.1.3]
### Fixed
* Add missing classifier test cases for POSONLYARGS
* (Internal) Add missing classifier test cases for POSONLYARGS
* Re-add the `tree` argument to the checker so flake8 identifies the plugin as needing to run

## [v1.1.2]
### Changed
* Request source from `flake8` as lines of code rather than parsing it from the requested filename ourselves, allowing for proper parsing of `stdin` inputs
* Remove `flake8-string-format` from dev dependencies, as `str.format()` isn't used anywhere
* (Internal) Remove `flake8-string-format` from dev dependencies, as `str.format()` isn't used anywhere

### Fixed
* #52 Fix error when invoking with `stdin` source code instead of a filename

## [v1.1.1]
### Added
* Add [`pipenv-setup`](https://github.com/Madoshakalaka/pipenv-setup) as a dev dependency & CI check to ensure synchronization between `Pipfile` and `setup.py`
* Add [tox](https://github.com/tox-dev/tox) configuration for local testing across Python versions
* Add test for checking a single yield of TYP301 per function
* Add coverage reporting to test suite
* Add testing for positional only arguments
* (Internal) Add [`pipenv-setup`](https://github.com/Madoshakalaka/pipenv-setup) as a dev dependency & CI check to ensure synchronization between `Pipfile` and `setup.py`
* (Internal) Add [tox](https://github.com/tox-dev/tox) configuration for local testing across Python versions
* (Internal) Add test for checking a single yield of TYP301 per function
* (Internal) Add coverage reporting to test suite
* (Internal) Add testing for positional only arguments

### Changed
* [`typed_ast`](https://github.com/python/typed_ast) is now required only for Python versions `< 3.8`
* Update flake8 minimum version to `3.7.9` for Python 3.8 compatibility
* #50 Completely refactor test suite for maintainability
* (Internal) [`typed_ast`](https://github.com/python/typed_ast) is now required only for Python versions `< 3.8`
* (Internal) Update flake8 minimum version to `3.7.9` for Python 3.8 compatibility
* (Internal) #50 Completely refactor test suite for maintainability

### Fixed
* Fix mixed type hint tests not being run due to misnamed test class
* (Internal) Fix mixed type hint tests not being run due to misnamed test class
* Fix `TYP301` classification issue where error is not yielded if the first argument is type annotated and the remaining arguments have type comments

## [v1.1.0]
### Added
* #35: Issue templates
* (Internal) #35: Issue templates
* #36: Support for PEP 484-style type comments
* #36: Add `TYP301` for presence of type comment & type annotation for same entity
* #36: Add `error_code.from_function` class method to generate argument for an entire function
* #18: PyPI release via GitHub Action
* #38: Improve `setup.py` metadata
* (Internal) #36: Add `error_code.from_function` class method to generate argument for an entire function
* (Internal) #18: PyPI release via GitHub Action
* (Internal) #38: Improve `setup.py` metadata

### Fixed
* #32: Incorrect line number for return values in the presence of multiline docstrings
* #33: Improper handling of nested functions in class methods
* `setup.py` dev dependencies out of sync with Pipfile
* Incorrect order of arguments in `Argument` and `Function` `__repr__` methods
* (Internal) `setup.py` dev dependencies out of sync with Pipfile
* (Internal) Incorrect order of arguments in `Argument` and `Function` `__repr__` methods

## [v1.0.0] - 2019-09-09
Initial release
24 changes: 19 additions & 5 deletions README.md
Expand Up @@ -33,12 +33,12 @@ cog.out(
]]] -->
```bash
$ flake8 --version
4.0.1 (flake8-annotations: 2.7.0, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes:2.4.0) CPython 3.10.2 on Darwin
4.0.1 (flake8-annotations: 2.8.0, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes:2.4.0) CPython 3.10.2 on Darwin
```
<!-- [[[end]]] -->

## Table of Warnings
All warnings are enabled by default.
With the exception of `ANN4xx`-level warnings, all warnings are enabled by default.

### Function Annotations
| ID | Description |
Expand Down Expand Up @@ -68,8 +68,15 @@ All warnings are enabled by default.
|----------|-----------------------------------------------------------|
| `ANN301` | PEP 484 disallows both type annotations and type comments |

### Opinionated Warnings
These warnings are disabled by default.
| ID | Description |
|----------|------------------------------------------------------------|
| `ANN401` | Dynamically typed expressions (typing.Any) are disallowed.<sup>2</sup> |

**Notes:**
1. See: [PEP 484](https://www.python.org/dev/peps/pep-0484/#annotating-instance-and-class-methods) and [PEP 563](https://www.python.org/dev/peps/pep-0563/) for suggestions on annotating `self` and `cls` arguments.
2. See: [Dynamic Typing Caveats](#dynamic-typing-caveats)

## Configuration Options
Some opinionated flags are provided to tailor the linting errors emitted.
Expand Down Expand Up @@ -106,7 +113,7 @@ Comma-separated list of decorators flake8-annotations should consider as dispatc

Decorators are matched based on their attribute name. For example, `"singledispatch"` will match any of the following:
* `import functools; @functools.singledispatch`
* `import functools as fnctls; @fnctls.singledispatch`
* `import functools as <alias>; @<alias>.singledispatch`
* `from functools import singledispatch; @singledispatch`

**NOTE:** Deeper imports, such as `a.b.singledispatch` are not supported.
Expand All @@ -120,7 +127,7 @@ Comma-separated list of decorators flake8-annotations should consider as [`typin

Decorators are matched based on their attribute name. For example, `"overload"` will match any of the following:
* `import typing; @typing.overload`
* `import typing as t; @t.overload`
* `import typing as <alias>; @<alias>.overload`
* `from typing import overload; @overload`

**NOTE:** Deeper imports, such as `a.b.overload` are not supported.
Expand Down Expand Up @@ -182,7 +189,6 @@ Will not raise linting errors for missing annotations for the arguments & return
Decorator(s) to treat as `typing.overload` may be specified by the [`--overload-decorators`](#--overload-decorators-liststr) configuration option.

## Caveats for PEP 484-style Type Comments

### Mixing argument-level and function-level type comments
Support is provided for mixing argument-level and function-level type comments.

Expand Down Expand Up @@ -231,6 +237,14 @@ Will show `arg1` as missing a type hint.

**Deprecation notice**: Explicit support for utilization of ellipses as placeholders will be removed in version `3.0`. See [this issue](https://github.com/sco1/flake8-annotations/issues/95) for more information.

## Dynamic Typing Caveats
Support is only provided for the following patterns:
* `from typing import any; foo: Any`
* `import typing; foo: typing.Any`
* `import typing as <alias>; foo: <alias>.Any`

Nested dynamic types (e.g. `typing.Tuple[typing.Any]`) and redefinition (e.g. `from typing import Any as Foo`) will not be identified.

## Contributing

### Development Environment
Expand Down
7 changes: 1 addition & 6 deletions flake8_annotations/__init__.py
Expand Up @@ -5,9 +5,4 @@
else:
PY_GTE_38 = False

if sys.version_info >= (3, 11):
PY_GTE_311 = True
else:
PY_GTE_311 = False

__version__ = "2.7.0"
__version__ = "2.8.0"