Skip to content

Commit

Permalink
update ruff config and apply latest ruff format style
Browse files Browse the repository at this point in the history
  • Loading branch information
adehad committed Mar 25, 2024
1 parent 9cf1b9e commit 795b91c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 21 deletions.
1 change: 1 addition & 0 deletions examples/auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Some simple authentication examples."""

from __future__ import annotations

from collections import Counter
Expand Down
1 change: 1 addition & 0 deletions jira/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The root of JIRA package namespace."""

from __future__ import annotations

try:
Expand Down
6 changes: 3 additions & 3 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4518,9 +4518,9 @@ def deactivate_user(self, username: str) -> str | int:
raise JIRAError(f"Error Deactivating {username}: {e}")
else:
url = self.server_url + "/secure/admin/user/EditUser.jspa"
self._options["headers"][
"Content-Type"
] = "application/x-www-form-urlencoded; charset=UTF-8"
self._options["headers"]["Content-Type"] = (
"application/x-www-form-urlencoded; charset=UTF-8"
)
user = self.user(username)
userInfo = {
"inline": "true",
Expand Down
1 change: 1 addition & 0 deletions jira/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Also, this simplifies the scripts by not having to write the same initialization code for each script.
"""

from __future__ import annotations

import configparser
Expand Down
1 change: 1 addition & 0 deletions jira/jirashell.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Script arguments support changing the server and a persistent authentication
over HTTP BASIC or Kerberos.
"""

from __future__ import annotations

import argparse
Expand Down
12 changes: 6 additions & 6 deletions jira/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ def update( # type: ignore[override] # incompatible supertype ignored
DashboardItemProperty
"""
options = self._options.copy()
options[
"path"
] = f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
options["path"] = (
f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
)
self.raw["value"].update(value)
self._session.put(self.JIRA_BASE_URL.format(**options), self.raw["value"])

Expand All @@ -628,9 +628,9 @@ def delete(self, dashboard_id: str, item_id: str) -> Response: # type: ignore[o
Response
"""
options = self._options.copy()
options[
"path"
] = f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
options["path"] = (
f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
)

return self._session.delete(self.JIRA_BASE_URL.format(**options))

Expand Down
1 change: 1 addition & 0 deletions make_local_jira_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Attempts to create a test user, as the empty JIRA instance isn't provisioned with one."""

from __future__ import annotations

import sys
Expand Down
25 changes: 13 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ check_untyped_defs = false
disable_error_code = "annotation-unchecked"

[tool.ruff]
# Same as Black.
line-length = 88

# Assume Python 3.8. (minimum supported)
target-version = "py38"

# The source code paths to consider, e.g., when resolving first- vs. third-party imports
src = ["jira", "tests"]

[tool.ruff.lint]
select = [
"E", # pydocstyle
"W", # pydocstyle
Expand All @@ -169,27 +179,18 @@ ignore = [
"D417",
]

# Same as Black.
line-length = 88

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.8. (minimum supported)
target-version = "py38"

# The source code paths to consider, e.g., when resolving first- vs. third-party imports
src = ["jira", "tests"]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["jira", "tests"]
required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"jira/__init__.py" = [
"E402", # ignore import order in this file
]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"
1 change: 1 addition & 0 deletions tests/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extend = "../pyproject.toml"
[lint]
ignore = [
"E501", # We have way too many "line too long" errors at the moment
"D", # Too many undocumented functions at the moment
Expand Down
1 change: 1 addition & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
resources/test_* : For tests related to resources
test_* : For other tests of the non-resource elements of the jira package.
"""

from __future__ import annotations

import logging
Expand Down

0 comments on commit 795b91c

Please sign in to comment.