Skip to content

Conversation

@julieg18
Copy link
Contributor

@julieg18 julieg18 commented Dec 15, 2023

main

Screen.Recording.2023-12-15.at.10.44.46.AM.mov

PR

Screen.Recording.2023-12-15.at.10.51.29.AM.mov

Fixes #5122

@julieg18 julieg18 added the bug Something isn't working label Dec 15, 2023
@julieg18 julieg18 self-assigned this Dec 15, 2023
Copy link
Contributor Author

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

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

This solution feels hacky but I'm not seeing a better way 🤔. At least I don't think this route will get hit very often since list items with no indentation are not the norm in my experience.

const mockPlotYamlContent = [
'',
'- simple_plot:',
' template: simple',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can see in the demo (and these tests) that the new plot yaml still doesn't line up perfectly with the previous plots since we're grabbing the indent level from a nested item (x: recall in this example) which doesn't always tell you the plots actual indent level.

Since I'm not seeing an simple way to make sure it's all aligned correctly, I chose to aim for just ensuring that the new yaml is valid and doesn't break anything :)

line.startsWith('-')
)
return doesYamlListItemHaveNoIndent
? newPlotLines.map(line =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We check for if the lines have a list item with no indentation and trim our new plot lines to ensure that the new plot also has 0 indentation for its list item.

@julieg18 julieg18 marked this pull request as ready for review December 15, 2023 17:15
' y:',
' eval/prc/train.json: precision',
' eval/prc/test.json: precision'
].join('\n')
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use string literals to test for format (`) instead of creating lines and joining them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I prefer creating lines since I find it easier to keep track of the exact spacing on each line.

@julieg18 julieg18 enabled auto-merge (squash) December 18, 2023 12:46
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 0ef49d6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.2% (0.0% change).

View more on Code Climate.

@julieg18 julieg18 merged commit eacee4b into main Dec 18, 2023
@julieg18 julieg18 deleted the fix-plots-creation-indentation branch December 18, 2023 12:57
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

Successfully merging this pull request may close these issues.

plots wizard: indentation issue

2 participants