Better errors when bash-like operators are used#7241
Merged
sophiajt merged 2 commits intonushell:mainfrom Dec 7, 2022
Merged
Conversation
sholderbach
reviewed
Nov 25, 2022
| #[diagnostic( | ||
| code(nu::parser::shell_outerr), | ||
| url(docsrs), | ||
| help("Nushell redirection will write all of stdout before stderr.") |
sholderbach
added a commit
to sholderbach/nushell
that referenced
this pull request
Dec 21, 2022
`proptest` caught a failing test condition for `&&` as a literal string. https://github.com/nushell/nushell/actions/runs/3753242377/jobs/6376308675 The change in the parser that now returns an error was introduced by nushell#7241 This in theory doesn't have to be an error but it is probably better safe than sorry to require quotation here.
sholderbach
added a commit
to sholderbach/nushell
that referenced
this pull request
Dec 21, 2022
Requires a quotation to be parsed by current `from nuon` Only required since nushell#7241 Include a comment stating that this is due to a zealous diagnostic
Member
|
Some of it is messing with quote-less nuon but should probably quoted anyways. |
sholderbach
added a commit
that referenced
this pull request
Dec 21, 2022
`proptest` caught a failing test condition for `&&` as a literal string. It requires a quotation to be parsed correctly by current `from nuon`
https://github.com/nushell/nushell/actions/runs/3753242377/jobs/6376308675
The change in the parser that now returns an error was introduced by #7241
This in theory doesn't have to be an error (it is a diagnostic for nushell code) but it is probably better safe than sorry to require quotation here.
- Add a test for `&&` in `to nuon` from proptest fail
- Fix `to nuon` generating invalid `&&` literal
- Add a test for `,` in `to nuon`/`from nuon` cycle
- Bonus: should already be properly quoted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds improved errors for when a user uses a bashism that nu doesn't support.
fixes #7237
Examples:
User-Facing Changes
BREAKING CHANGES
This removes the
&&and||operators. We previously supported by&&/andand||/or. With this change, onlyandandorare valid boolean operators.Tests + Formatting
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspaceto check that all tests passAfter Submitting
If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.