Skip to content

Commit 6060485

Browse files
authored
Merge pull request #636 from opsmill/pog-upgrade-ruff
Upgrade ruff
2 parents 5819312 + 2470982 commit 6060485

File tree

10 files changed

+43
-41
lines changed

10 files changed

+43
-41
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
- name: "Check out repository code"
7979
uses: "actions/checkout@v5"
8080
- name: "Setup environment"
81-
run: "pip install ruff==0.11.0"
81+
run: "pip install ruff==0.14.5"
8282
- name: "Linting: ruff check"
8383
run: "ruff check ."
8484
- name: "Linting: ruff format"

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ cd docs && npm start
164164

165165
### Code Quality
166166

167-
- **Ruff**: Comprehensive linting and formatting (0.11.0)
167+
- **Ruff**: Comprehensive linting and formatting (0.14.5)
168168
- **mypy**: Type checking with strict configuration
169169
- **yamllint**: YAML file validation
170170
- **markdownlint**: Documentation consistency

infrahub_sdk/ctl/graphql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def export_schema(
108108
schema_text = await client.schema.get_graphql_schema()
109109

110110
destination.parent.mkdir(parents=True, exist_ok=True)
111-
destination.write_text(schema_text)
111+
destination.write_text(schema_text, encoding="utf-8")
112112
console.print(f"[green]Schema exported to {destination}")
113113

114114

infrahub_sdk/node/attribute.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ def __init__(self, name: str, schema: AttributeSchemaAPI, data: Any | dict) -> N
3535

3636
self._read_only = ["updated_at", "is_inherited"]
3737

38-
self.id: str | None = data.get("id", None)
38+
self.id: str | None = data.get("id")
3939

40-
self._value: Any | None = data.get("value", None)
40+
self._value: Any | None = data.get("value")
4141
self.value_has_been_mutated = False
42-
self.is_default: bool | None = data.get("is_default", None)
43-
self.is_from_profile: bool | None = data.get("is_from_profile", None)
42+
self.is_default: bool | None = data.get("is_default")
43+
self.is_from_profile: bool | None = data.get("is_from_profile")
4444

4545
if self._value:
4646
value_mapper: dict[str, Callable] = {
@@ -50,11 +50,11 @@ def __init__(self, name: str, schema: AttributeSchemaAPI, data: Any | dict) -> N
5050
mapper = value_mapper.get(schema.kind, lambda value: value)
5151
self._value = mapper(data.get("value"))
5252

53-
self.is_inherited: bool | None = data.get("is_inherited", None)
54-
self.updated_at: str | None = data.get("updated_at", None)
53+
self.is_inherited: bool | None = data.get("is_inherited")
54+
self.updated_at: str | None = data.get("updated_at")
5555

56-
self.is_visible: bool | None = data.get("is_visible", None)
57-
self.is_protected: bool | None = data.get("is_protected", None)
56+
self.is_visible: bool | None = data.get("is_visible")
57+
self.is_protected: bool | None = data.get("is_protected")
5858

5959
self.source: NodeProperty | None = None
6060
self.owner: NodeProperty | None = None

infrahub_sdk/node/related_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, branch: str, schema: RelationshipSchemaAPI, data: Any | dict,
6464
self._display_label = node_data.get("display_label", None)
6565
self._typename = node_data.get("__typename", None)
6666

67-
self.updated_at: str | None = data.get("updated_at", data.get("_relation__updated_at", None))
67+
self.updated_at: str | None = data.get("updated_at", data.get("_relation__updated_at"))
6868

6969
# FIXME, we won't need that once we are only supporting paginated results
7070
if self._typename and self._typename.startswith("Related"):

infrahub_sdk/pytest_plugin/items/jinja2_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def repr_failure(self, excinfo: ExceptionInfo, style: str | None = None) -> str:
8383
class InfrahubJinja2TransformSmokeItem(InfrahubJinja2Item):
8484
def runtest(self) -> None:
8585
file_path: Path = self.session.infrahub_config_path.parent / self.resource_config.template_path # type: ignore[attr-defined]
86-
self.get_jinja2_environment().parse(file_path.read_text(), filename=file_path.name)
86+
self.get_jinja2_environment().parse(file_path.read_text(encoding="utf-8"), filename=file_path.name)
8787

8888

8989
class InfrahubJinja2TransformUnitRenderItem(InfrahubJinja2Item):

infrahub_sdk/transfer/importer/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ async def update_optional_relationships(self) -> None:
144144
await self.execute_batches([update_batch], "Adding optional relationships to nodes")
145145

146146
async def update_many_to_many_relationships(self, file: Path) -> None:
147-
relationships = ujson.loads(file.read_text())
147+
relationships = ujson.loads(file.read_text(encoding="utf-8"))
148148
update_batch = await self.client.create_batch(return_exceptions=True)
149149

150150
for relationship in relationships:

infrahub_sdk/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def write_to_file(path: Path, value: Any) -> bool:
318318
raise FileExistsError(f"{path} is a directory")
319319

320320
to_write = str(value)
321-
written = path.write_text(to_write)
321+
written = path.write_text(to_write, encoding="utf-8")
322322

323323
return written is not None
324324

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ tests = [
8181
lint = [
8282
"yamllint",
8383
"mypy==1.11.2",
84-
"ruff==0.11.0",
84+
"ruff==0.14.5",
8585
"astroid>=3.1,<4.0",
8686
]
8787
types = [
@@ -246,8 +246,9 @@ max-complexity = 17
246246
##################################################################################################
247247
# Review and change the below later #
248248
##################################################################################################
249-
"ANN202", # Missing return type annotation for private function
250-
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
249+
"ANN202", # Missing return type annotation for private function
250+
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
251+
"ASYNC240", # Async functions should not use pathlib.Path methods, use trio.Path or anyio.path
251252
]
252253

253254
"infrahub_sdk/client.py" = [

uv.lock

Lines changed: 24 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)