Skip to content

fix: Change ruff errors to warnings and fix config saving#2246

Merged
mattrunyon merged 1 commit intodeephaven:mainfrom
mattrunyon:ruff-minor-changes
Oct 4, 2024
Merged

fix: Change ruff errors to warnings and fix config saving#2246
mattrunyon merged 1 commit intodeephaven:mainfrom
mattrunyon:ruff-minor-changes

Conversation

@mattrunyon
Copy link
Copy Markdown
Collaborator

Changed all except syntax errors to warning underlines instead of error underline since they are not actual errors.

Also changed redux to not save if the config matches the default. This should fix an edge case where a user opens the settings editor just to see what the config is, then hits "Save". Previously, this would save the current defaults as their settings and then if the defaults changed they would not get updated settings. This way, if a user was on defaults and the default changes they will get the new default.

Also added a little bit of debug logging for Ruff.

@mattrunyon mattrunyon requested a review from a team October 3, 2024 21:20
@mattrunyon mattrunyon self-assigned this Oct 3, 2024
@mattrunyon mattrunyon requested review from bmingles and removed request for a team October 3, 2024 21:20
linter: {
...ruffSettings,
config:
JSON.stringify(newValue) ===
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the argument mismatch in the JSON.stringify calls intentional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I want to check if the value was reset to default here, but the objects won't be the same. The other option was to do this check in the settings modal before onSave is called and then call with null or undefined to indicate the default.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I misread this. I thought your were passing in undefined, 2 to one of the JSON.stringify calls

);

const [val, setVal] = useState(JSON.stringify(ruffConfig, null, 2));
const val = JSON.stringify(ruffConfig, null, 2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we memoize this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters. The object isn't that big and there's still some overhead to do the string comparison for memoization. Also the component shouldn't re-render often.

Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Left 2 suggestion / questions

Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mattrunyon mattrunyon merged commit 6ae25a2 into deephaven:main Oct 4, 2024
@mattrunyon mattrunyon deleted the ruff-minor-changes branch October 4, 2024 15:17
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants