Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Ruff not show as many diagnostics as I expect?

I have installed the Ruff extension and enabled it in VS Code, but it doesn't seem to be underlining my code at all and providing suggestions like my previous linters did.

I did a clean install of VS Code, so most of the Python/Ruff extension settings are default. Is there an additional step I need to take to get it to start underlining my code and providing recommendations?

It's highlighting the imports for not being used, but I would expect other things to be highlighted like the line length, the additional spaces at the end of the file, not having 2 spaces before function declaration, etc.

Here is the sample code as requested:

import pandas as pd
import numpy as np

print('kkkkkkkkjlskdjflksdjflsdjflkdsjflksdjflkjdslkfjsdlkjflsdjflsdjfldsjflsdkjflsdjflksdjflksdjflksdjflskdjflsdkjfklsdjkl')
def test_func(x):
    y=x+1
    return y
like image 806
Nick Nelson Avatar asked Nov 28 '25 16:11

Nick Nelson


1 Answers

Take another look at the ruff documentation. You must enable or disable your desired linter rules and/or your formatting rules. For example, if you create a ruff.toml configuration in the root of your project with

[lint]
select = ["ALL"]

the output looks more like what you expect.

enter image description here

like image 126
anit3res Avatar answered Dec 01 '25 04:12

anit3res



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!