Closed krusion closed 2 months ago
Can you provide the source code where you're facing this issue?
import blahblah
import numpy as np
def dms_to_decimal(dms):
"""Function to convert degree, minutes, and seconds to
decimal for various DMS input formats.
Args:
dms (str): DMS input in various formats.
Returns:
float: Decimal equivalent rounded to 4 decimal places, or None if input is not in DMS format.
"""
df_scripters = 5
df_scripters["Nominal Value (MT)"] = np.where(
(
df_scripters["BP Upper Limit (AFS)"] - df_scripters["BP Lower Limit (AFS)"] == df_scripters["BP Upper Limit (MT)"] - df_scripters["BP Lower Limit (MT)"]
),
np.where(
round(
df_scripters["BP Upper Limit (AFS)"]
- df_scripters["Nominal Value"],
4,
)
== round(
df_scripters["Nominal Value"]
- df_scripters["BP Lower Limit (AFS)"],
4,
),
round(
(
df_scripters["BP Upper Limit (MT)"]
+ df_scripters["BP Lower Limit (MT)"]
)
* 0.5,
4,
),
"Non Symmetrical",
),
"Range Mismatch",
)
df_scripters.rename(
{
"Nominal Value": "Nominal Value (AFS)",
},
axis="columns",
inplace=True,
)
you can use this. I'd like to also add that it missed "expected 2 blank lines, found 1 (E302)"
- imported but unused (F401)
- Line too long (E501)
- too many blank lines (E303)
- blank line contains whitespace (W293)
Oh never mind, I see the problem. This is happening because from the above rules only F401
is included in the default rule set. You'll need to provide additional rules in the Ruff config because the default ruleset doesn't include them. You can find the default Ruff config at https://github.com/astral-sh/ruff#configuration. You can learn more about rule selection at https://docs.astral.sh/ruff/linter/#rule-selection.
Closing this as it's working as expected.
I see, thanks! I guess it's confusing because it keeps on mentioning how it is a 1 to 1 replacement for flake8 but by default flake8 highlights these errors.
Just to understand better, from these rules, the ones that have a test tube are ones that are not active by default and I need to enable them? How do I do that if I'm using ruff as a VS code extension and not as an installed package. It seems the pyproject.toml and ruff.toml are both files within the installed package.
How do I do that if I'm using ruff as a VS code extension and not as an installed package. It seems the pyproject.toml and ruff.toml are both files within the installed package.
This section mentions on how you can configure Ruff via the config file. You can still create the config file and it should be picked up the Ruff.
Update: I guess I found this setting for VS code:
"ruff.lint.extendSelect": [
"ALL"
],
Also can be accessed under Lint: Extend Select
in the GUI. But I think I have more questions if you don't mind helping me out.
With ALL selected, I'm getting a lot more errors than before obviously. Two of the errors that I'm currently getting are:
The first one should be fixable using the "Fix All" command based on the rules. The second one I would like to disable using the google convention. But again, I'm unsure how to do that using VS code.
Also to double check, for me to have ruff.toml, I need to install ruff, should that be as a pip install in the original python directory (so I can have it for all projects?) or as a standalone installer? I'm running windows without admin privileges.
Thank you.
Also to double check, for me to have ruff.toml, I need to install ruff, should that be as a pip install in the original python directory (so I can have it for all projects?) or as a standalone installer? I'm running windows without admin privileges.
You don't necessarily need to install Ruff to use the VS Code extension as we ship the executable bundled with it. Regarding the config file, the Ruff executable should pickup the config file automatically.
Regarding the config file, the Ruff executable should pickup the config file automatically.
The ruff config file doesn't exist right now. That's why I'm asking. I'll try to create it manually and see. So in general, what is the order that should be respected by ruff assuming conflicting information like line length or conventions and select/ignore lists?
Also can you let me know if you know the answer to the other 2 questions please?
Hello,
I was previously using flake8, black formatter, and isort and wanted to replace these with ruff since I've heard so many good things.
I have black format on save which I plan to have ruff act the same way. I did a quick test with a python file where I did deliberate errors to make sure ruff will work as expected. I turned off the format on save for my old setup and the new ruff profile and did the following:
With Flake 8, all of these are being highlighted. With Ruff only the imported but unused is being highlighted.
The weird thing is when I enabled the format on save, it does actually work and formats them. So it knows the code is wrong but not highlighting everything. I'm unsure what I'm doing wrong, this is a fresh profile on VS code.
Tried playing with different settings but nothing is working, here's a copy of my latest ssettings.json after some experimenting:
Here's a copy of the Ruff output:
Please help me understand what I'm doing wrong and what can I change to make it work.