Skip to content

Commit

Permalink
Merge pull request #13 from ynput/enhancement/add-ruff-linter
Browse files Browse the repository at this point in the history
Chore: Add ruff linter
  • Loading branch information
iLLiCiTiT authored Oct 24, 2024
2 parents 2294fbc + 763f918 commit 12a9a8c
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 12 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pr_linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 📇 Code Linting

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number}}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
2 changes: 1 addition & 1 deletion client/ayon_third_party/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ADDON_NAME = "ayon_third_party"
ADDON_NAME = "ayon_third_party"
20 changes: 15 additions & 5 deletions create_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,39 @@
FFMPEG_SOURCES = {
"windows": {
"url": f"{DISTRIBUTE_SOURCE_URL}/ffmpeg-4.4-windows-2.zip",
"checksum": "5f09109c96a3e53beec042e969653716324b467c66788807e69e81c233e19d20",
"checksum": (
"5f09109c96a3e53beec042e969653716324b467c66788807e69e81c233e19d20"
),
"checksum_algorithm": "sha256",
},
"linux": {
"url": f"{DISTRIBUTE_SOURCE_URL}/ffmpeg-4.4-linux.tgz",
"checksum": "10b9beda57cfbb69b9ed0ce896c0c8d99227b26ca8b9f611040c4752e365cbe9",
"checksum": (
"10b9beda57cfbb69b9ed0ce896c0c8d99227b26ca8b9f611040c4752e365cbe9"
),
"checksum_algorithm": "sha256",
},
"darwin": {
"url": f"{DISTRIBUTE_SOURCE_URL}/ffmpeg-4.4-macos.tgz",
"checksum": "95f43568338c275f80dc0cab1e1836a2e2270f856f0e7b204440d881dd74fbdb",
"checksum": (
"95f43568338c275f80dc0cab1e1836a2e2270f856f0e7b204440d881dd74fbdb"
),
"checksum_algorithm": "sha256",
}
}
OIIO_SOURCES = {
"windows": {
"url": f"{DISTRIBUTE_SOURCE_URL}/oiio_tools-2.3.10-windows.zip",
"checksum": "b9950f5d2fa3720b52b8be55bacf5f56d33f9e029d38ee86534995f3d8d253d2",
"checksum": (
"b9950f5d2fa3720b52b8be55bacf5f56d33f9e029d38ee86534995f3d8d253d2"
),
"checksum_algorithm": "sha256",
},
"linux": {
"url": f"{DISTRIBUTE_SOURCE_URL}/oiio_tools-2.2.20-linux-centos7.tgz",
"checksum": "3894dec7e4e521463891a869586850e8605f5fd604858b674c87323bf33e273d",
"checksum": (
"3894dec7e4e521463891a869586850e8605f5fd604858b674c87323bf33e273d"
),
"checksum_algorithm": "sha256",
}
}
Expand Down
74 changes: 74 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 79
indent-width = 4

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E", "F", "W"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

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

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
16 changes: 10 additions & 6 deletions server/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from pydantic import Field, validator
from pydantic import Field

from ayon_server.settings import (
BaseSettingsModel,
task_types_enum,
MultiplatformPathModel,
MultiplatformPathListModel,
)

Expand Down Expand Up @@ -38,7 +36,9 @@ class FFmpegSettings(BaseSettingsModel):
custom_args: CustomFFmpegArgumentsModel = Field(
default_factory=CustomFFmpegArgumentsModel,
title="Custom arguments",
description="Custom arguments that will be used to launch ffmpeg tools",
description=(
"Custom arguments that will be used to launch ffmpeg tools"
),
)


Expand Down Expand Up @@ -82,12 +82,16 @@ class OIIOSettings(BaseSettingsModel):
custom_roots: MultiplatformPathListModel = Field(
default_factory=MultiplatformPathListModel,
title="Custom root",
description="Root to directory where OpenImageIO binaries can be found",
description=(
"Root to directory where OpenImageIO binaries can be found"
),
)
custom_args: CustomOIIOArgumentsModel = Field(
default_factory=CustomOIIOArgumentsModel,
title="Custom arguments",
description="Custom arguments that will be used to launch ffmpeg tools",
description=(
"Custom arguments that will be used to launch ffmpeg tools"
),
)


Expand Down

0 comments on commit 12a9a8c

Please sign in to comment.