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

Please use a formatter like Ruff or Pylint and post your config to GitLab #653

Open
jtele2 opened this issue Aug 2, 2024 · 0 comments
Open
Assignees

Comments

@jtele2
Copy link

jtele2 commented Aug 2, 2024

I'm having to reformat your python code on every pull. I'd highly recommend the ruff formatter, its fast and has a great vs code plugin. Just install it and set some settings (example below):

EXAMPLE RUFF CONFIG

# REFERENCE: https://docs.astral.sh/ruff/settings/#settings

# The native server supports Jupyter Notebooks out of the box. Unlike ruff-lsp, the 
# native server requires the user to explicitly include Jupyter Notebooks in the set of 
# files to lint and format. This can be done by updating the extend-include setting in 
# the Ruff configuration file.
extend-include = ["*.ipynb"]

[lint.isort]
force-single-line = true
lines-after-imports = 1

EXAMPLE VS CODE CONFIG

    // ########################NOTEBOOKS#########################
    "notebook.formatOnSave.enabled": true,
    "notebook.codeActionsOnSave": {
        "notebook.source.organizeImports": "explicit",
        "source.fixAll": "explicit"
    },
    //     "jupyter.stopOnFirstLineWhileDebugging": true, // Does not seem to work? 
    "jupyter.askForKernelRestart": false,
    "notebook.markup.fontSize": 14,
    "jupyter.notebookFileRoot": "${workspaceFolder}",
    // ##########################PYTHON##########################
    //     "python.analysis.autoImportCompletions": true,
    //     "python.analysis.autoFormatStrings": true,
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit",
            "source.fixAll": "explicit"
        },
    },
    // ##################### RUFF #####################
    "ruff.organizeImports": true,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants