Conversation
bca0e3d to
56a03e9
Compare
56a03e9 to
d1949c4
Compare
| false, | ||
| "warn-short-path-literals", | ||
| LintMode::allow, | ||
| "short-path-literals", |
There was a problem hiding this comment.
Isn't this too ambiguous of an option name?
There was a problem hiding this comment.
It's a stabilization 🎉
My understanding here:
- this check works
- it's something we can keep maintaining
- neither we nor users have felt a need to make this opt-out, but could still be considered
Needs release note.
Should this experimental feature be kept around just to affect the option default? Maybe not because unlike a Nix-based configuration manager, the settings/flags system is tricky and hard to reason about.
There was a problem hiding this comment.
Something actionable beyond "warning: unknown experimental feature 'no-url-literals'" would be nice
There was a problem hiding this comment.
Improved the warning and added the release note
There was a problem hiding this comment.
Could, but does not implement the command line options proposed and approved in
There was a problem hiding this comment.
Need to drop from "Fixes #" or implement
There was a problem hiding this comment.
Made it "progress on"
d1949c4 to
41e1671
Compare
EvalSettings Warning infra, and some uses cases41e1671 to
1fe811a
Compare
1fe811a to
1ff9db8
Compare
1ff9db8 to
49cd521
Compare
1c47b3c to
929f50d
Compare
| logWarning(mkInfo()); | ||
| return; | ||
| case Diagnose::Fatal: | ||
| throw ParseError(mkInfo()); |
There was a problem hiding this comment.
Seems like harding ParseError here isn't exactly correct. Maybe it should be the callback the decides which error type to throw?
roberth
left a comment
There was a problem hiding this comment.
Ideas. See comments.
Also would be nice to have compiler-style flag syntax from the start.
Other than that, lgtm.
There was a problem hiding this comment.
We can pass options in the lang tests as well. These tests could perhaps be migrated. Characterisation tests give a more detailed coverage of the error reports and nicer DX.
| /** | ||
| * Treat the feature as a fatal error. | ||
| */ | ||
| Fatal, |
There was a problem hiding this comment.
Good rename!
We could add Error and a diagnostic state later.
class DiagnosticState { vector<Error>; warn(Error &&); saveError(Error &&); }
or
class DiagnosticState { bool mustThrow; }
and
throwingDiagnosticErrors :: (DiagnosticState -> IO r) -> IO r
There was a problem hiding this comment.
Agreed we should collect all fatal errors and then throw. But best saved for later.
17bcefd to
739eee6
Compare
src/libexpr/parser.y
Outdated
| .msg = HintFmt("URL literals are disabled"), | ||
| diagnose(state->settings.urlLiterals, [&]() -> std::optional<ParseError> { | ||
| return ParseError({ | ||
| .msg = HintFmt("URL literal '%s' is deprecated", std::string_view($1.p, $1.l)), |
There was a problem hiding this comment.
Like my earlier comment, this raises the question: which URL literals are allowed?
Instead it should say these independent things:
- URL literals are disallowed / discouraged (depending on warn/fatal)
- Here it is
- Use a string literal instead
|
|
||
| source common.sh | ||
|
|
||
| clearStoreIfPossible |
There was a problem hiding this comment.
Please look into this:
- Removed test cases not fully covered by new lang tests
no-url-literals.sh went from 7 tests to 4:
- Old Test 1 (default: unquoted URLs accepted) — REMOVED, not replaced. No new test verifies that lint-url-literals defaults to ignore and URLs work without flags.
- Old Test 6 (CLI flag override: --extra-experimental-features works even with empty NIX_CONFIG) — REMOVED, not replaced.
- Old Test 7 (--raw evaluation correctness for quoted URLs) — REMOVED. Partially covered by the new eval-okay-url-literal-warn.exp lang test, but that tests warn mode, not fatal mode with quoted URLs.
short-path-literals.sh went from 11 tests to 10 (8 old + 3 new):
- Old Test 3 (multiple path patterns: foo/bar, a/b/c/d) — REMOVED. Only test/subdir is tested now. Reduces variation coverage.
- Old Test 7 (position check: at «string»:1:1:) — REMOVED. Covered by the .err.exp lang tests.
- Old Test 8 (evaluation correctness: result equals $PWD/test/subdir) — REMOVED. Covered by eval-okay-short-path-literal-warn.exp.
f9f6c4e to
0f95928
Compare
- Convert `no-url-literals` from experimental feature to `Diagnose` setting Replace `Xp::NoUrlLiterals` with a new `lint-url-literals` setting that accepts `ignore`, `warn`, or `fatal`. This provides more flexibility than the binary experimental feature. - Convert `warn-short-path-literals` to use new lint infra We now have `lint-short-path-literals = ignore | warn | fatal` instead. - Convert some of the tests to lang tests Fix NixOS#10048 Progress on NixOS#10281
0f95928 to
5184f84
Compare
Motivation
Convert
no-url-literalsfrom experimental feature toDiagnosesettingReplace
Xp::NoUrlLiteralswith a newlint-url-literalssetting that acceptsignore,warn, orfatal. This provides more flexibility than the binary experimental feature.Convert
warn-short-path-literalsto use new lint infraWe now have
lint-short-path-literals = ignore | warn | fatalinstead.Context
Fix #10048
Progress on #10281
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.