Skip to content

Commit

Permalink
DX: format notebooks on save with Ruff (#302)
Browse files Browse the repository at this point in the history
* ENH: use (pinned) Ruff from environment
  • Loading branch information
redeboer authored Feb 13, 2024
1 parent f59f181 commit ba5fcb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"multiDiffEditor.experimental.enabled": true,
"mypy-type-checker.args": ["--config-file=${workspaceFolder}/pyproject.toml"],
"mypy-type-checker.importStrategy": "fromEnvironment",
"notebook.codeActionsOnSave": {
"notebook.source.organizeImports": "explicit"
},
"notebook.formatOnSave.enabled": true,
"python.analysis.autoImportCompletions": false,
"python.analysis.inlayHints.pytestParameters": true,
"python.analysis.typeCheckingMode": "strict",
Expand All @@ -54,6 +58,7 @@
"redhat.telemetry.enabled": false,
"rewrap.wrappingColumn": 88,
"ruff.enable": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": true,
"search.exclude": {
"**/tests/**/__init__.py": true,
Expand Down
5 changes: 5 additions & 0 deletions src/compwa_policy/check_dev_files/ruff.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,18 @@ def _update_vscode_settings() -> None:
executor(
vscode.update_settings,
{
"notebook.codeActionsOnSave": {
"notebook.source.organizeImports": "explicit"
},
"notebook.formatOnSave.enabled": True,
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
},
"editor.defaultFormatter": "charliermarsh.ruff",
},
"ruff.enable": True,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": True,
},
)
Expand Down

0 comments on commit ba5fcb9

Please sign in to comment.