Skip to content

Commit a5658e4

Browse files
authored
Merge pull request #63 from collective/ale/pre-commit
Ale/pre commit
2 parents d1736ad + bd55930 commit a5658e4

32 files changed

Lines changed: 574 additions & 260 deletions

.editorconfig

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Generated from:
2+
# https://github.com/plone/meta/tree/2.x/src/plone/meta/default
3+
# See the inline comments on how to expand/tweak this configuration file
4+
#
5+
# EditorConfig Configuration file, for more details see:
6+
# http://EditorConfig.org
7+
# EditorConfig is a convention description, that could be interpreted
8+
# by multiple editors to enforce common coding conventions for specific
9+
# file types
10+
11+
# top-most EditorConfig file:
12+
# Will ignore other EditorConfig files in Home directory or upper tree level.
13+
root = true
14+
15+
16+
[*]
17+
# Default settings for all files.
18+
# Unix-style newlines with a newline ending every file
19+
end_of_line = lf
20+
insert_final_newline = true
21+
trim_trailing_whitespace = true
22+
# Set default charset
23+
charset = utf-8
24+
# Indent style default
25+
indent_style = space
26+
# Max Line Length - a hard line wrap, should be disabled
27+
max_line_length = off
28+
29+
[*.{py,cfg,ini}]
30+
# 4 space indentation
31+
indent_size = 4
32+
33+
[*.{yml,zpt,pt,dtml,zcml,html,xml}]
34+
# 2 space indentation
35+
indent_size = 2
36+
37+
[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}]
38+
# Frontend development
39+
# 2 space indentation
40+
indent_size = 2
41+
max_line_length = 80
42+
43+
[{Makefile,.gitmodules}]
44+
# Tab indentation (no size specified, but view as 4 spaces)
45+
indent_style = tab
46+
indent_size = unset
47+
tab_width = unset
48+
49+
50+
##
51+
# Add extra configuration options in .meta.toml:
52+
# [editorconfig]
53+
# extra_lines = """
54+
# _your own configuration lines_
55+
# """
56+
##

.flake8

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated from:
2+
# https://github.com/plone/meta/tree/2.x/src/plone/meta/default
3+
# See the inline comments on how to expand/tweak this configuration file
4+
[flake8]
5+
doctests = 1
6+
ignore =
7+
# black takes care of line length
8+
E501,
9+
# black takes care of where to break lines
10+
W503,
11+
# black takes care of spaces within slicing (list[:])
12+
E203,
13+
# black takes care of spaces after commas
14+
E231,
15+
16+
##
17+
# Add extra configuration options in .meta.toml:
18+
# [flake8]
19+
# extra_lines = """
20+
# _your own configuration lines_
21+
# """
22+
##

.pre-commit-config.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Generated from:
2+
# https://github.com/plone/meta/tree/2.x/src/plone/meta/default
3+
# See the inline comments on how to expand/tweak this configuration file
4+
ci:
5+
autofix_prs: false
6+
autoupdate_schedule: monthly
7+
8+
repos:
9+
- repo: https://github.com/asottile/pyupgrade
10+
rev: v3.21.2
11+
hooks:
12+
- id: pyupgrade
13+
args: [--py310-plus]
14+
- repo: https://github.com/pycqa/isort
15+
rev: 8.0.1
16+
hooks:
17+
- id: isort
18+
- repo: https://github.com/psf/black-pre-commit-mirror
19+
rev: 26.3.1
20+
hooks:
21+
- id: black
22+
- repo: https://github.com/collective/zpretty
23+
rev: 3.1.1
24+
hooks:
25+
- id: zpretty
26+
27+
##
28+
# Add extra configuration options in .meta.toml:
29+
# [pre_commit]
30+
# zpretty_extra_lines = """
31+
# _your own configuration lines_
32+
# """
33+
##
34+
- repo: https://github.com/PyCQA/flake8
35+
rev: 7.3.0
36+
hooks:
37+
- id: flake8
38+
39+
##
40+
# Add extra configuration options in .meta.toml:
41+
# [pre_commit]
42+
# flake8_extra_lines = """
43+
# _your own configuration lines_
44+
# """
45+
##
46+
- repo: https://github.com/codespell-project/codespell
47+
rev: v2.4.2
48+
hooks:
49+
- id: codespell
50+
additional_dependencies:
51+
- tomli
52+
53+
##
54+
# Add extra configuration options in .meta.toml:
55+
# [pre_commit]
56+
# codespell_extra_lines = """
57+
# _your own configuration lines_
58+
# """
59+
##
60+
- repo: https://github.com/mgedmin/check-manifest
61+
rev: "0.51"
62+
hooks:
63+
- id: check-manifest
64+
- repo: https://github.com/regebro/pyroma
65+
rev: "5.0.1"
66+
hooks:
67+
- id: pyroma
68+
- repo: https://github.com/mgedmin/check-python-versions
69+
rev: "0.24.0"
70+
hooks:
71+
- id: check-python-versions
72+
args: ['--only', 'setup.py,tox.ini']
73+
74+
##
75+
# Add extra configuration options in .meta.toml:
76+
# [pre_commit]
77+
# extra_lines = """
78+
# _your own configuration lines_
79+
# """
80+
##

pyproject.toml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Generated from:
2+
# https://github.com/plone/meta/tree/2.x/src/plone/meta/default
3+
# See the inline comments on how to expand/tweak this configuration file
4+
[build-system]
5+
requires = ["setuptools>=68.2,<82", "wheel"]
6+
7+
##
8+
# Add extra configuration options in .meta.toml:
9+
# [pyproject]
10+
# towncrier_extra_lines = """
11+
# extra_configuration
12+
# """
13+
##
14+
15+
[tool.isort]
16+
profile = "plone"
17+
18+
##
19+
# Add extra configuration options in .meta.toml:
20+
# [pyproject]
21+
# isort_extra_lines = """
22+
# extra_configuration
23+
# """
24+
##
25+
26+
[tool.black]
27+
target-version = ["py310"]
28+
29+
##
30+
# Add extra configuration options in .meta.toml:
31+
# [pyproject]
32+
# black_extra_lines = """
33+
# extra_configuration
34+
# """
35+
##
36+
37+
[tool.codespell]
38+
ignore-words-list = "discreet,assertin,thet,thirdparty"
39+
skip = "*.po,"
40+
##
41+
# Add extra configuration options in .meta.toml:
42+
# [pyproject]
43+
# codespell_ignores = "foo,bar"
44+
# codespell_skip = "*.po,*.map,package-lock.json"
45+
##
46+
47+
[tool.check-manifest]
48+
ignore = [
49+
".editorconfig",
50+
".flake8",
51+
".meta.toml",
52+
".pre-commit-config.yaml",
53+
"dependabot.yml",
54+
"mx.ini",
55+
"tox.ini",
56+
".gha.cfg",
57+
"base.cfg",
58+
"plone-6.0.x.cfg",
59+
"plone-6.1.x.cfg",
60+
"plone-6.2.x.cfg",
61+
]
62+
63+
##
64+
# Add extra configuration options in .meta.toml:
65+
# [pyproject]
66+
# check_manifest_ignores = """
67+
# "*.map.js",
68+
# "*.pyc",
69+
# """
70+
# check_manifest_extra_lines = """
71+
# ignore-bad-ideas = [
72+
# "some/test/file/PKG-INFO",
73+
# ]
74+
# """
75+
##
76+
77+
78+
##
79+
# Add extra configuration options in .meta.toml:
80+
# [pyproject]
81+
# extra_lines = """
82+
# _your own configuration lines_
83+
# """
84+
##

setup.cfg

Lines changed: 0 additions & 17 deletions
This file was deleted.

setup.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import find_packages
2+
from setuptools import setup
23

34
version = "4.0.0.dev0"
45

@@ -20,6 +21,7 @@
2021
# Get more strings from
2122
# https://pypi.org/classifiers/
2223
classifiers=[
24+
"Development Status :: 5 - Production/Stable",
2325
"Environment :: Web Environment",
2426
"Framework :: Plone",
2527
"Framework :: Plone :: Addon",
@@ -38,12 +40,13 @@
3840
],
3941
keywords="plone workspace collaboration",
4042
author="David Glick",
41-
author_email="",
43+
author_email="collective@plone.org",
4244
url="https://github.com/collective/collective.workspace",
4345
license="gpl",
4446
packages=find_packages("src"),
4547
package_dir={"": "src"},
46-
namespace_packages=["collective",],
48+
python_requires=">=3.9",
49+
namespace_packages=["collective"],
4750
include_package_data=True,
4851
zip_safe=False,
4952
install_requires=[
@@ -53,8 +56,13 @@
5356
# -*- Extra requirements: -*-
5457
],
5558
extras_require={
56-
"test": ["plone.app.robotframework[debug,reload]", "plone.app.testing",],
57-
"develop": ["zest.releaser",],
59+
"test": [
60+
"plone.app.robotframework[debug,reload]",
61+
"plone.app.testing",
62+
],
63+
"develop": [
64+
"zest.releaser",
65+
],
5866
},
5967
entry_points="""
6068
# -*- Entry points: -*-

src/collective/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# coding=utf-8
21
__import__("pkg_resources").declare_namespace(__name__)

src/collective/workspace/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# -*- coding: utf-8 -*-
21
from AccessControl.Permissions import add_user_folders
32
from collective.workspace import pas
43
from Products.PluggableAuthService import registerMultiPlugin
54
from zope.i18nmessageid import MessageFactory
65

7-
86
workspaceMessageFactory = MessageFactory("collective.workspace")
97

108

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding=utf-8
21
from collective.workspace.interfaces import IHasWorkspace
32
from plone import api
43
from plone.app.dexterity.permissions import DXFieldPermissionChecker
@@ -8,7 +7,7 @@
87
@adapter(IHasWorkspace)
98
class WorkspaceFieldPermissionChecker(DXFieldPermissionChecker):
109
def validate(self, field_name, vocabulary_name=None):
11-
""" Override the permission checker to allow querying the users
10+
"""Override the permission checker to allow querying the users
1211
vocabulary even if there is no user field in this context
1312
"""
1413
if (
@@ -19,6 +18,4 @@ def validate(self, field_name, vocabulary_name=None):
1918
)
2019
):
2120
return True
22-
return super(WorkspaceFieldPermissionChecker, self).validate(
23-
field_name, vocabulary_name
24-
)
21+
return super().validate(field_name, vocabulary_name)

0 commit comments

Comments
 (0)