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

Automatic code fix stops working due to vscode update #460

Open
pleirb opened this issue Apr 4, 2024 · 14 comments
Open

Automatic code fix stops working due to vscode update #460

pleirb opened this issue Apr 4, 2024 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@pleirb
Copy link

pleirb commented Apr 4, 2024

When starting vscode in a doodba copier template project, this appears in the lower right corner:

image
Translation: You have stopped using linting or formatting settings for Python. See logs for more details.
And it directs us to this link: https://github.com/microsoft/vscode-python/wiki/Migration-to-Python-Tools-Extensions

Removing these two lines from doodba.XXX.code-workspace:

"python.linting.flake8Enabled": true,
"python.linting.pylintEnabled": true

The message disappears, but continues without the useful correction functionality

@pleirb pleirb added the bug Something isn't working label Apr 4, 2024
@yajo
Copy link
Contributor

yajo commented Apr 4, 2024

Probably it will have to integrate with https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff now and remove those old linters.

@pleirb
Copy link
Author

pleirb commented Apr 4, 2024

Probablemente tendrá que integrarse con https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff ahora y eliminar esos viejos linters.

If I find a solution I will publish it, but studying vscode in depth is another of my pending subjects.

@pleirb
Copy link
Author

pleirb commented Apr 9, 2024

Probablemente tendrá que integrarse con https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff ahora y eliminar esos viejos linters.

If I find a solution I will publish it, but studying vscode in depth is another of my pending subjects.

I found a temporary solution, but it would be nice to have some expert confirm if it is the right way to go.
First, add "charliermarsh.ruff" to the extensions list in ./vscode/extensions.json
Second, install Ruff on the system. In my case, Ubuntu is in version 23.10, and I must do it with:
sudo snap install ruff
Although I have seen that it is possible in other distributions to do it with pip
Third, remove all the obsolete lines (the ones that are marked off) in the file: doodba.xxx.code-workspace

    "python.formatting.provider": "none",
    "python.linting.flake8Enabled": true,
    "python.linting.ignorePatterns": [
      "/path/to/your/project/odoo/custom/src/odoo/**/*.py"
    ],
    "python.linting.pylintArgs": [
      "--init-hook=\"import sys;sys.path.append('/path/to/your/project/odoo/custom/src/odoo')\"",
      "--load-plugins=pylint_odoo"
    ],
    "python.linting.pylintEnabled": true,

Fourth, uninstall the extensions
ms-python.pylint and ms-python.flake8
Fifth, update your template to get the .ruff.toml configuration file
copier copy gh:Tecnativa/doodba-copier-template ./ --trust

@pleirb
Copy link
Author

pleirb commented Jun 14, 2024

Hello community! Question, is there any intention to repair the code-workspace extension file to fix the problems that appear with the latest version of Visual Studio Code (1.90.1)?

imagen

Currently it does not correct my code as it should and I am not being able to debug correctly

@pedrobaeza
Copy link
Member

We haven't dug on that for now, but feel free to propose the corresponding patch.

@pleirb
Copy link
Author

pleirb commented Jun 14, 2024

Thanks, at the moment what version of Visual Studio Code is recommended to use without problems?

@pedrobaeza
Copy link
Member

I'm using with the latest and I have warnings and errors. Which ones do you mean?

imagen

@pleirb
Copy link
Author

pleirb commented Jun 14, 2024

The problems that appear are from library imports and therefore the correction is wrong. I guess it has to do with the linting problem

imagen

@pedrobaeza
Copy link
Member

But if I'm not wrong, this wasn't working before either.

@pleirb
Copy link
Author

pleirb commented Jun 14, 2024

Pero si no me equivoy, esto tampoco estaba funcionando antes.

And what advantage of use could Visual Studio Code have if it is integrated into the code-workspace file generated by dodba copier template if ruff is integrated and the old linters are eliminated as suggested by @yajo

@pedrobaeza
Copy link
Member

ruff is one thing, and import sentences another different one.

@pleirb
Copy link
Author

pleirb commented Jun 14, 2024

Ruff es una cosa, y importoro a otra diferente.

Sorry for my ignorance, yes, it is a code formatter, the thing is that I assumed that this tool works well if it manages to import all the libraries and maybe it had some automatic way to do it or based on the configuration file (code-workspace)

@pedrobaeza
Copy link
Member

ruff is run when you run manually pre-commit or automatic if you configure the repository, but it's not directly attached to VSCode IDE. You may want to do it on IDE file save, but it's not put (it was not either when using previous linter + formatter, as having pre-commit is enough).

@pleirb
Copy link
Author

pleirb commented Jun 14, 2024

ruffse ejecuta cuando se ejecuta manualmente pre-commito o automático si configura el repositorio, pero no está conectado directamente a VSCode IDE. Usted puede querer hacerlo en el archivo IDE guardado, pero no se pone (no fue ni cuando se usaba linter anterior formatter, ya que tener pre-comprometer es suficiente).

Thanks, for the moment then I guess I won't miss anything if I remove the flake8Enabled, pylintEnabled lines from the code-workspace file and the chrome extension from .vscode/extensiions.json
These two things are what were bothering me with warnings when launching Visual Studio Code every day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants