Add prettier to the pre-commit configuration

Also apply prettier
This commit is contained in:
Pierre Sassoulas 2021-04-07 21:42:36 +02:00
parent 3420964a2e
commit b6ce99bb81
12 changed files with 132 additions and 111 deletions

View File

@ -1 +1,2 @@
Please read the [contribute doc](https://github.com/PyCQA/pylint/blob/master/doc/development_guide/contribute.rst).
Please read the
[contribute doc](https://github.com/PyCQA/pylint/blob/master/doc/development_guide/contribute.rst).

View File

@ -1,7 +1,6 @@
---
name: Bug report
about: Report a bug in pylint
---
<!--
@ -36,6 +35,7 @@ module\
-->
### Current behavior
<!--
Result of `pylint a.py`:
```
@ -45,10 +45,10 @@ Result of `pylint a.py`:
### Expected behavior
### pylint --version output
Result of `pylint --version` output:
```
```

View File

@ -1,7 +1,6 @@
---
name: Feature request
about: Suggest an idea for this project
---
<!--
@ -12,10 +11,13 @@ about: Suggest an idea for this project
-->
### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is.
### Describe the solution you'd like
A clear and concise description of what you want to happen.
### Additional context
Add any other context about the feature request here.

View File

@ -1,7 +1,8 @@
---
name: Support question
about: Questions about pylint that are not covered in the documentation (https://pylint.pycqa.org/en/latest/)
about:
Questions about pylint that are not covered in the documentation
(https://pylint.pycqa.org/en/latest/)
---
## Question

View File

@ -12,20 +12,22 @@ https://github.com/PyCQA/pylint/blob/master/doc/development_guide/contribute.rst
- [ ] Add yourself to CONTRIBUTORS if you are a new contributor.
- [ ] Add a ChangeLog entry describing what your PR does.
- [ ] If it's a new feature or an important bug fix, add a What's New entry in `doc/whatsnew/<current release.rst>`.
- [ ] If it's a new feature or an important bug fix, add a What's New entry in
`doc/whatsnew/<current release.rst>`.
- [ ] Write a good description on what the PR does.
## Description
## Type of Changes
<!-- Leave the corresponding lines for the applicable type of change: -->
| | Type |
| ------------- | ------------- |
| ✓ | :bug: Bug fix |
| ✓ | :sparkles: New feature |
| ✓ | :hammer: Refactoring |
| ✓ | :scroll: Docs |
| | Type |
| --- | ---------------------- |
| ✓ | :bug: Bug fix |
| ✓ | :sparkles: New feature |
| ✓ | :hammer: Refactoring |
| ✓ | :scroll: Docs |
## Related Issue

View File

@ -12,7 +12,6 @@ env:
DEFAULT_PYTHON: 3.6
PRE_COMMIT_CACHE: ~/.cache/pre-commit
jobs:
prepare-base:
name: Prepare base dependencies
@ -88,7 +87,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-base.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
@ -129,7 +129,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-base.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
@ -202,7 +203,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-tests-linux.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
@ -241,7 +243,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-tests-linux.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
@ -283,7 +286,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-tests-linux.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
@ -307,11 +311,11 @@ jobs:
- name: Upload benchmark artifact
uses: actions/upload-artifact@v2.2.2
with:
name: benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{
name:
benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{
steps.artifact-name-suffix.outputs.datetime }}
path: .benchmarks/
prepare-tests-windows:
name: Prepare tests for Python ${{ matrix.python-version }} (Windows)
runs-on: windows-latest
@ -377,7 +381,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-tests-windows.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'
@ -389,7 +394,6 @@ jobs:
. venv\\Scripts\\activate
pytest --benchmark-disable tests/
prepare-tests-pypy:
name: Prepare tests for Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
@ -451,7 +455,8 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
key:
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.prepare-tests-pypy.outputs.python-key }}
- name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true'

View File

@ -1,71 +1,77 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: trailing-whitespace
exclude: "tests/functional/t/trailing_whitespaces.py"
- id: end-of-file-fixer
- id: end-of-file-fixer
exclude: "tests/functional/m/missing/missing_final_newline.py|tests/functional/t/trailing_newlines.py"
- repo: https://github.com/asottile/setup-cfg-fmt
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/myint/autoflake
- id: setup-cfg-fmt
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
- id: autoflake
exclude: &fixtures tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/
args:
- --in-place
- --remove-all-unused-imports
- --expand-star-imports
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/asottile/pyupgrade
- --in-place
- --remove-all-unused-imports
- --expand-star-imports
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/asottile/pyupgrade
rev: v2.11.0
hooks:
- id: pyupgrade
- id: pyupgrade
args: [--py36-plus]
exclude: *fixtures
- repo: https://github.com/PyCQA/isort
- repo: https://github.com/PyCQA/isort
rev: 5.8.0
hooks:
- id: isort
- repo: https://github.com/ambv/black
- id: isort
- repo: https://github.com/ambv/black
rev: 20.8b1
hooks:
- id: black
args: [--safe, --quiet]
exclude: *fixtures
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker/
- id: black
args: [--safe, --quiet]
exclude: *fixtures
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker/
rev: 1.0.0
hooks:
- id: black-disable-checker
- repo: https://gitlab.com/pycqa/flake8
- id: black-disable-checker
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.0
hooks:
- id: flake8
- id: flake8
exclude: *fixtures
- repo: local
- repo: local
hooks:
- id: pylint
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: ["-rn", "-sn", "--rcfile=pylintrc", "--load-plugins=pylint.extensions.docparams"]
args:
[
"-rn",
"-sn",
"--rcfile=pylintrc",
"--load-plugins=pylint.extensions.docparams",
]
# disabled plugins: pylint.extensions.mccabe
exclude: tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/|doc/
- id: fix-documentation
- id: fix-documentation
name: Fix documentation
entry: python3 -m script.fix_documentation
language: system
types: [text]
files: ^(ChangeLog|doc/whatsnew/\d+\.\d+\.rst)
- repo: https://github.com/pre-commit/mirrors-mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
hooks:
- id: mypy
- id: mypy
name: mypy
entry: mypy
language: python
@ -74,3 +80,8 @@ repos:
require_serial: true
additional_dependencies: []
exclude: tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/|doc/|bin/
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]

View File

@ -1,6 +1,6 @@
- id: pylint
name: pylint
entry: pylint
language: python
types: [python]
require_serial: true
- id: pylint
name: pylint
entry: pylint
language: python
types: [python]
require_serial: true

View File

@ -3,9 +3,9 @@
version: 2
sphinx:
configuration: doc/conf.py
configuration: doc/conf.py
python:
version: 3.7
install:
- requirements: doc/requirements.txt
version: 3.7
install:
- requirements: doc/requirements.txt

View File

@ -1,26 +1,26 @@
language: python
stages:
- tests-cpython
- tests-cpython
jobs:
include:
- stage: tests-cpython
python: 3.6
env: TOXENV=py36
- stage: tests-cpython
python: 3.6
env: TOXENV=py36
before_install:
- python --version
- uname -a
- lsb_release -a
- python --version
- uname -a
- lsb_release -a
install:
- pip install -U setuptools
- pip install tox
- virtualenv --version
- pip --version
- tox --version
- pip install -U setuptools
- pip install tox
- virtualenv --version
- pip --version
- tox --version
script:
- pip install .
- pip install .
after_failure:
- more .tox/log/* | cat
- more .tox/*/log/* | cat
- more .tox/log/* | cat
- more .tox/*/log/* | cat
notifications:
email:
on_success: always

View File

@ -1,4 +1,4 @@
version: '{branch}-{build}'
version: "{branch}-{build}"
build: off
test_script:

View File

@ -1,17 +1,16 @@
# Releasing a pylint version
So, you want to release the ``X.Y.Z`` version of pylint ?
So, you want to release the `X.Y.Z` version of pylint ?
## Process
1. Preparation
0. Run the acceptance tests to see if everything is alright with this release.
We don't run them on CI: ``pytest -m acceptance``
1. Preparation 0. Run the acceptance tests to see if everything is alright with this
release. We don't run them on CI: `pytest -m acceptance`
1. Check if the dependencies of the package are correct
2. Update ``__version__`` in ``pylint/__pkginfo__.py``, ``dev_version`` should be ``None`` when you tag,
except if it's an alpha release.
2. Update `__version__` in `pylint/__pkginfo__.py`, `dev_version` should be `None`
when you tag, except if it's an alpha release.
3. Put the version numbers, and the release date into the changelog
4. Put the release date into the ``What's new`` section.
4. Put the release date into the `What's new` section.
5. Generate the new copyright notices for this release:
```bash
@ -22,16 +21,16 @@ git --aliases=.copyrite_aliases . --jobs=8
# automatically
```
6. Submit your changes in a merge request.
6. Submit your changes in a merge request.
2. Make sure the tests are passing on Travis/GithubActions:
7. Make sure the tests are passing on Travis/GithubActions:
https://travis-ci.org/PyCQA/pylint/
3. Do the actual release by tagging the master with ``pylint-X.Y.Z`` (ie ``pylint-1.6.12``
for example). Travis should deal with the release process once the tag is pushed
with `git push origin --tags`
8. Do the actual release by tagging the master with `pylint-X.Y.Z` (ie `pylint-1.6.12`
for example). Travis should deal with the release process once the tag is pushed with
`git push origin --tags`
4. Go to github, click on "Releases" then on the ``pylint-X.Y.Z`` tag, choose edit tag,
9. Go to github, click on "Releases" then on the `pylint-X.Y.Z` tag, choose edit tag,
and copy past the changelog in the description.
## Manual Release
@ -49,16 +48,16 @@ twine upload dist/*
### New branch to create for major releases
The master branch will have all the new features for the ``X.Y+1`` version
The master branch will have all the new features for the `X.Y+1` version
If you're doing a major release, you need to create the ``X.Y`` branch
where we will cherry-pick bugs to release the ``X.Y.Z+1`` minor versions
If you're doing a major release, you need to create the `X.Y` branch where we will
cherry-pick bugs to release the `X.Y.Z+1` minor versions
### Merge tags in master for minor releases
Merge the tag ``X.Y.Z`` in the main branch by doing a history only merge. It's done
in order to signal that this is an official release tag, and for ``pre-commit autoupdate``
to works.
Merge the tag `X.Y.Z` in the main branch by doing a history only merge. It's done in
order to signal that this is an official release tag, and for `pre-commit autoupdate` to
works.
```bash
git checkout master
@ -68,26 +67,26 @@ git push
### Milestone handling
We move issue that were not done in the next milestone and block release only
if it's an issue labelled as blocker.
We move issue that were not done in the next milestone and block release only if it's an
issue labelled as blocker.
### Files to update after releases
#### Changelog
* Create a new section, with the name of the release ``X.Y.Z+1`` on the ``X.Y`` branch.
* If it's a major release, also create a new section for ``X.Y+1.0`` on the master branch
- Create a new section, with the name of the release `X.Y.Z+1` on the `X.Y` branch.
- If it's a major release, also create a new section for `X.Y+1.0` on the master branch
You need to add the estimated date when it is going to be published. If
no date can be known at that time, we should use ``Undefined``.
You need to add the estimated date when it is going to be published. If no date can be
known at that time, we should use `Undefined`.
#### Whatsnew
If it's a major release, create a new ``What's new in Pylint X.Y+1`` document
Take a look at the examples from ``doc/whatsnew``.
If it's a major release, create a new `What's new in Pylint X.Y+1` document Take a look
at the examples from `doc/whatsnew`.
### Versions
Update ``__version__`` to ``X.Y+1.0`` in ``pylint/__pkginfo__.py`` for ``master`` and to
``X.Y.Z+1`` for the ``X.Y`` branch. ``dev_version`` should also be back to an
integer after the tag.
Update `__version__` to `X.Y+1.0` in `pylint/__pkginfo__.py` for `master` and to
`X.Y.Z+1` for the `X.Y` branch. `dev_version` should also be back to an integer after
the tag.