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

pre-commit hook updates #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Use 'x' to check each item: [x] I have ...
* [ ] I have opened this pull request against ``master``
* [ ] I have added or modified the tests when changing logic
* [ ] I have followed [the conventional commits guidelines](https://www.conventionalcommits.org/) to add meaningful information into the changelog
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
[Slack](https://www.django-cms.org/slack) to find a “pr review buddy” who is going to review my pull request.
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
repos:
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the ci config from here please?

https://github.com/django-cms/django-cms/blob/develop/.pre-commit-config.yaml

And you can just remove the black section rather than comment out as we've no plans to use black

Copy link
Author

@bencipher bencipher Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already removed the commented code in my last commit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add the ci now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest commit: 297069d

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like the Django version, this is the minimum supported python version. Python code in a commit is then optimised to match the features in this python version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright Mark, thanks for clarifying

- repo: https://github.com/adamchainz/django-upgrade
rev: '1.4.0'
hooks:
- id: django-upgrade
args: [--target-version, "2.2"]
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is one of the things you asked about on Slack and its a bit easier to respond here.
This version is the minimum supported version. This tool will optimise the Django specific code in a commit, using the features available in Django 2.2.

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/asottile/yesqa
rev: v1.3.0
hooks:
- id: yesqa
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: ["--ignore-words-list", "ist, oder, alle"]
# - repo: https://github.com/psf/black
# rev: 21.12b0
# hooks:
# - id: black
# language_version: python3.7
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 12 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file.

url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pre-commit = "*"

[dev-packages]

[requires]
python_version = "3.10"
146 changes: 146 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ django CMS Transfer
and import plugin data from a page or a placeholder. It does not support foreign
key relations and won't import/export related data, such as `media <https://github.com/django-cms/djangocms-transfer/issues/18>`_.

.. note::
.. note::

This project is endorsed by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_.
That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy.
That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy.
Join us on `Slack <https://www.django-cms.org/slack/>`_.

.. image:: preview.gif
Expand All @@ -23,8 +23,8 @@ Contribute to this project and win rewards

Because this is a an open-source project, we welcome everyone to
`get involved in the project <https://www.django-cms.org/en/contribute/>`_ and
`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.
`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.

We'll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
Expand Down
6 changes: 3 additions & 3 deletions djangocms_transfer/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_plugin_urls(self):
]
return urlpatterns

def get_extra_placeholder_menu_items(self, request, placeholder): # noqa
def get_extra_placeholder_menu_items(self, request, placeholder):
Fixed Show fixed Hide fixed
# django-cms 3.4 compatibility
return self.get_extra_placeholder_menu_items(request, placeholder)

Expand Down Expand Up @@ -65,7 +65,7 @@ def get_extra_plugin_menu_items(cls, request, plugin):
),
]

@classmethod # noqa
@classmethod
def get_extra_placeholder_menu_items(cls, request, placeholder): # noqa
data = urlencode({
'language': get_language_from_request(request),
Expand Down Expand Up @@ -176,7 +176,7 @@ def export_plugins_view(cls, request):
# TODO: Check permissions
filename = form.get_filename()
response = HttpResponse(form.run_export(), content_type='application/json')
response['Content-Disposition'] = 'attachment; filename={}'.format(filename)
response['Content-Disposition'] = f'attachment; filename={filename}'
return response


Expand Down
4 changes: 2 additions & 2 deletions djangocms_transfer/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
# Translators:
# Angelo Dini <angelo.dini@divio.ch>, 2019
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_transfer/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion djangocms_transfer/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ def test_for_missing_migrations(self):
status_code = '0'

if status_code == '1':
self.fail('There are missing migrations:\n {}'.format(output.getvalue()))
self.fail(f'There are missing migrations:\n {output.getvalue()}')