Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First crack at default config for ruff #254

Open
wants to merge 32 commits into
base: contentctl_5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2a5663d
First crack at default config
ljstella Aug 22, 2024
3f7a585
Adding suggested extension config
ljstella Aug 22, 2024
0a88668
Bumping target_version
ljstella Aug 30, 2024
82b8fa7
Merge branch 'main' into ruff_config
ljstella Aug 30, 2024
5a9af4f
Merge branch 'main' into ruff_config
ljstella Sep 10, 2024
2568f71
Updated pyproject.toml
ljstella Sep 10, 2024
ec40b40
Merge branch 'main' into ruff_config
ljstella Sep 10, 2024
0b4158b
Github CI
ljstella Sep 12, 2024
f99655d
Add precommit hook
ljstella Sep 12, 2024
c1bdfbc
Update gitignore
ljstella Sep 12, 2024
7ed5e02
Updating ruff workflow
ljstella Sep 12, 2024
9aa1607
Adding ruff as dev dependency
ljstella Sep 12, 2024
9a493c6
Merge branch 'main' into ruff_config
ljstella Sep 13, 2024
66ef7fc
Merge branch 'main' into ruff_config
ljstella Sep 13, 2024
9ad0d96
Merge branch 'main' into ruff_config
ljstella Sep 18, 2024
8f1845e
Merge branch 'main' into ruff_config
ljstella Sep 30, 2024
a5cd630
Merge branch 'main' into ruff_config
ljstella Oct 15, 2024
45a6cb0
Merge branch 'main' into ruff_config
ljstella Oct 16, 2024
82d4f16
Merge branch 'main' into ruff_config
ljstella Oct 28, 2024
030ae92
bumped version
ljstella Oct 29, 2024
ae8c9c8
Merge branch 'main' into ruff_config
ljstella Oct 31, 2024
e41e427
Merge branch 'main' into ruff_config
ljstella Nov 12, 2024
f8d31fe
Merge branch 'main' into ruff_config
ljstella Nov 22, 2024
5591952
Ruff version bump
ljstella Nov 22, 2024
ed1c8b0
Version bump
ljstella Dec 11, 2024
c0d440c
other precommit hooks
ljstella Dec 11, 2024
356317f
Merge branch 'contentctl_5' into ruff_config
ljstella Dec 12, 2024
d71674f
version bump
ljstella Dec 19, 2024
6aebe3f
Version bump
ljstella Jan 2, 2025
6f60e75
version update
ljstella Jan 5, 2025
8795e97
bump to 0.9.0
ljstella Jan 9, 2025
633f0d5
version bump to 0.9.1
ljstella Jan 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint & format
on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run lint
run: ruff check --output-format=github contentctl/
- name: Run Formatter
run: ruff format --check contentctl/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ poetry.lock
# usual mac files
.DS_Store
*/.DS_Store
.ruff_cache

# custom
dist/*
Expand Down
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 # Use the ref you want to point at
hooks:
- id: check-json
- id: check-symlinks
- id: check-yaml
- id: detect-aws-credentials
- id: detect-private-key
- id: forbid-submodules
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"charliermarsh.ruff"
]
}
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
"python.testing.cwd": "${workspaceFolder}",
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "strict",
"editor.defaultFormatter": "ms-python.black-formatter"
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff",
},
"ruff.nativeServer": "on"


}
81 changes: 81 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,87 @@ gitpython = "^3.1.43"
setuptools = ">=69.5.1,<76.0.0"
[tool.poetry.dev-dependencies]

[tool.poetry.group.dev.dependencies]
ruff = "^0.9.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
cmcginley-splunk marked this conversation as resolved.
Show resolved Hide resolved
".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 = 88
indent-width = 4

target-version = "py311"

[tool.ruff.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 = ["E4", "E7", "E9", "F"]
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]+?))$"

[tool.ruff.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"
Loading