Skip to content

Commit d564fc4

Browse files
committed
chore: use ruff pydocstyle instead of docformatter
1 parent d071079 commit d564fc4

17 files changed

+25
-69
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ repos:
1515
- id: end-of-file-fixer
1616
exclude: "\\.svg$|\\.map$|\\.min\\.css$|\\.min\\.js$|\\.po$|\\.pot$"
1717
- id: check-toml
18-
- repo: https://github.com/PyCQA/docformatter
19-
rev: v1.7.5
20-
hooks:
21-
- id: docformatter
2218
- repo: https://github.com/pre-commit/mirrors-mypy
2319
rev: v1.11.2
2420
hooks:

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ exclude_lines = [
8181

8282
[tool.ruff.lint]
8383
select = [
84+
"D", # pydocstyle
8485
"E", # pycodestyle
8586
"F", # pyflakes
8687
"I", # isort
@@ -89,6 +90,16 @@ select = [
8990
ignore = [
9091
"E501", # line-too-long
9192
"E722", # bare-except
93+
"D100", # public module
94+
"D101", # public class
95+
"D102", # public method
96+
"D103", # public function
97+
"D104", # public package
98+
"D105", # magic method
99+
"D106", # nested class
100+
"D107", # public init
101+
"D203", # no-blank-line-before-class
102+
"D213", # multi-line-summary-second-line
92103
]
93104

94105
[tool.ruff.lint.isort]

scim2_cli/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
@click.pass_context
2222
def cli(ctx, url):
2323
"""SCIM application development CLI."""
24-
2524
ctx.ensure_object(dict)
2625
ctx.obj["URL"] = url
2726
client = Client(base_url=ctx.obj["URL"])

scim2_cli/create.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def create_factory(model):
5252
@from_pydantic("obj", model, exclude=exclude)
5353
@click.pass_context
5454
def create_command(ctx, indent, headers, obj: model, *args, **kwargs):
55-
"""Perform a `SCIM POST <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request
56-
on resources endpoint.
55+
r"""Perform a `SCIM POST <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request on resources endpoint.
5756
5857
Input data can be passed through parameters like :code:`--external-id`.
5958
@@ -74,8 +73,8 @@ def create_command(ctx, indent, headers, obj: model, *args, **kwargs):
7473
.. code-block:: bash
7574
7675
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | scim https://scim.example create user
77-
"""
7876
77+
"""
7978
if obj == model():
8079
obj = None
8180

@@ -106,8 +105,7 @@ def create_command(ctx, indent, headers, obj: model, *args, **kwargs):
106105
"-h", "--headers", multiple=True, help="Header to pass in the HTTP requests."
107106
)
108107
def create_cli(ctx, indent, headers):
109-
"""Perform a `SCIM POST <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request
110-
on resources endpoint.
108+
"""Perform a `SCIM POST <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request on resources endpoint.
111109
112110
There are subcommands for all the available models, with dynamic attributes.
113111
See the attributes for :code:`user` with:
@@ -121,8 +119,8 @@ def create_cli(ctx, indent, headers):
121119
.. code-block:: bash
122120
123121
echo '{"userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | scim https://scim.example create
124-
"""
125122
123+
"""
126124
if ctx.invoked_subcommand is not None:
127125
return
128126

scim2_cli/delete.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def delete_cli(ctx, resource_type, id, headers, indent):
3232
3333
scim https://scim.example delete user 1234
3434
"""
35-
3635
try:
3736
resource_type = ctx.obj["resource_types"][resource_type]
3837
except KeyError:

scim2_cli/query.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def query_cli(
6969
headers: list[str],
7070
indent: bool,
7171
):
72-
"""Perform a `SCIM GET <https://www.rfc-editor.org/rfc/rfc7644#section-3.4.1>`_ request
73-
on the :code:`RESOURCE_TYPE` endpoint.
72+
"""Perform a `SCIM GET <https://www.rfc-editor.org/rfc/rfc7644#section-3.4.1>`_ request on the :code:`RESOURCE_TYPE` endpoint.
7473
7574
- If :code:`RESOURCE_TYPE` is :code:`user` and :code:`id` is `1234`, then the request will made on the :code:`/Users/1234` endpoint.
7675
- If :code:`RESOURCE_TYPE` is :code:`user` and :code:`id` is not set, then the request will made on the :code:`/Users` endpoint.
@@ -81,8 +80,8 @@ def query_cli(
8180
.. code-block:: bash
8281
8382
echo '{"startIndex": 50, "count": 10}' | scim https://scim.example query user
84-
"""
8583
84+
"""
8685
if resource_type:
8786
try:
8887
resource_type = ctx.obj["resource_types"][resource_type]

scim2_cli/replace.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ def replace_factory(model):
5353
@from_pydantic("obj", model, exclude=exclude)
5454
@click.pass_context
5555
def replace_command(ctx, indent, headers, obj: model, *args, **kwargs):
56-
"""Perform a `SCIM PUT <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request
57-
on resources endpoint.
56+
r"""Perform a `SCIM PUT <https://www.rfc-editor.org/rfc/rfc7644#section-3.3>`_ request on resources endpoint.
5857
5958
Input data can be passed through parameters like :code:`--external-id`.
6059
@@ -76,8 +75,8 @@ def replace_command(ctx, indent, headers, obj: model, *args, **kwargs):
7675
.. code-block:: bash
7776
7877
echo '{"id": "xxxx-yyyy", "userName": "[email protected]", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]}' | scim https://scim.example replace user
79-
"""
8078
79+
"""
8180
if obj == model():
8281
obj = None
8382

@@ -108,8 +107,7 @@ def replace_command(ctx, indent, headers, obj: model, *args, **kwargs):
108107
help="Indent JSON response payloads.",
109108
)
110109
def replace_cli(ctx, headers, indent):
111-
"""Perform a `SCIM PUT <https://www.rfc-editor.org/rfc/rfc7644#section-3.5.1>`_ request
112-
on the resources endpoint.
110+
"""Perform a `SCIM PUT <https://www.rfc-editor.org/rfc/rfc7644#section-3.5.1>`_ request on the resources endpoint.
113111
114112
There are subcommands for all the available models, with dynamic attributes.
115113
See the attributes for :code:`user` with:

scim2_cli/search.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,15 @@ def search_cli(
6565
headers: list[str],
6666
indent: bool,
6767
):
68-
"""Perform a `SCIM GET <https://www.rfc-editor.org/rfc/rfc7644#section-3.4.1>`_ request
69-
on the :code:`/.search` endpoint.
68+
"""Perform a `SCIM GET <https://www.rfc-editor.org/rfc/rfc7644#section-3.4.1>`_ request on the :code:`/.search` endpoint.
7069
7170
Data passed in JSON format to stdin is sent as request arguments and all the other query arguments are ignored:
7271
7372
.. code-block:: bash
7473
7574
echo '{"startIndex": 50, "count": 10}' | scim https://scim.example search user
76-
"""
7775
76+
"""
7877
if ctx.obj.get("stdin"):
7978
check_request_payload = False
8079
payload = ctx.obj.get("stdin")

scim2_cli/test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
)
1616
@click.option("-v", "--verbose", is_flag=True, help="Enables verbose mode")
1717
def test_cli(ctx, headers, verbose):
18-
"""Perform a server SCIM compliance check using :doc:`scim2-tester
19-
<scim2-tester:index>`.
18+
"""Perform a server SCIM compliance check using :doc:`scim2-tester <scim2-tester:index>`.
2019
2120
.. code-block:: bash
2221
2322
scim https://scim.example test
2423
"""
25-
2624
client = ctx.obj["client"]
2725
client.client.headers.update(split_headers(headers))
2826
results = check_server(client)

scim2_cli/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ def formatted_payload(obj, indent):
3535
def split_headers(headers: list[str]) -> dict[str, str]:
3636
"""Make a dict from header strings.
3737
38-
['Authorization: Bearer token'] → '{"Authorization": "Bearer
39-
token"}'
38+
['Authorization: Bearer token'] → '{"Authorization": "Bearer token"}'
4039
"""
41-
4240
return {
4341
header[: header.index(":")].strip(): header[header.index(":") + 1 :].strip()
4442
for header in headers
@@ -67,9 +65,7 @@ def get_command(self, ctx, cmd_name):
6765

6866

6967
def is_field_acceptable(context, model, field_name) -> bool:
70-
"""Indicate whether a field is acceptable as part of a SCIM payload for a
71-
given context."""
72-
68+
"""Indicate whether a field is acceptable as part of a SCIM payload for a given context."""
7369
from scim2_models import Context
7470
from scim2_models import Mutability
7571

0 commit comments

Comments
 (0)