From b6ce99bb8158c4ac05ae7f0bd6fd12c6cdbeaa11 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Wed, 7 Apr 2021 21:42:36 +0200 Subject: [PATCH] Add prettier to the pre-commit configuration Also apply prettier --- .github/CONTRIBUTING.md | 3 +- .github/ISSUE_TEMPLATE/1_Bug_report.md | 4 +- .github/ISSUE_TEMPLATE/2_Feature_request.md | 4 +- .github/ISSUE_TEMPLATE/3_Question.md | 5 +- .github/PULL_REQUEST_TEMPLATE.md | 18 +++--- .github/workflows/ci.yaml | 27 ++++---- .pre-commit-config.yaml | 71 ++++++++++++--------- .pre-commit-hooks.yaml | 12 ++-- .readthedocs.yaml | 8 +-- .travis.yml | 30 ++++----- appveyor.yml | 2 +- doc/release.md | 59 +++++++++-------- 12 files changed, 132 insertions(+), 111 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e3a9ff424..e3c97eb96 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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). diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md index b4c2e1ddc..88a20e0c0 100644 --- a/.github/ISSUE_TEMPLATE/1_Bug_report.md +++ b/.github/ISSUE_TEMPLATE/1_Bug_report.md @@ -1,7 +1,6 @@ --- name: Bug report about: Report a bug in pylint - --- ### Current behavior + ### 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. diff --git a/.github/ISSUE_TEMPLATE/3_Question.md b/.github/ISSUE_TEMPLATE/3_Question.md index 5787c384b..7e9187d85 100644 --- a/.github/ISSUE_TEMPLATE/3_Question.md +++ b/.github/ISSUE_TEMPLATE/3_Question.md @@ -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 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d0eb306c7..05a2447d4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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/`. +- [ ] If it's a new feature or an important bug fix, add a What's New entry in + `doc/whatsnew/`. - [ ] Write a good description on what the PR does. ## Description - ## Type of Changes + -| | Type | -| ------------- | ------------- | -| ✓ | :bug: Bug fix | -| ✓ | :sparkles: New feature | -| ✓ | :hammer: Refactoring | -| ✓ | :scroll: Docs | + +| | Type | +| --- | ---------------------- | +| ✓ | :bug: Bug fix | +| ✓ | :sparkles: New feature | +| ✓ | :hammer: Refactoring | +| ✓ | :scroll: Docs | ## Related Issue diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 082c3d094..fd4ec0c5f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c5bef03f..99cbcd198 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 66d447127..1bec0790e 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -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 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 28611d43d..f3e25df5f 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -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 diff --git a/.travis.yml b/.travis.yml index 44bb57d78..fe596f331 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/appveyor.yml b/appveyor.yml index 304030697..ad1d9a1f7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '{branch}-{build}' +version: "{branch}-{build}" build: off test_script: diff --git a/doc/release.md b/doc/release.md index ed4346713..994a4f2b0 100644 --- a/doc/release.md +++ b/doc/release.md @@ -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.