-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/testing-python.nix: Add skipFormatter #122197
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -83,8 +83,10 @@ rec { | |||||||
{ testScript | ||||||||
, enableOCR ? false | ||||||||
, name ? "unnamed" | ||||||||
# Skip linting (mainly intended for faster dev cycles) | ||||||||
# Skip linting (not advisable) | ||||||||
, skipLint ? false | ||||||||
# Skip formatting check | ||||||||
, skipFormatter ? false | ||||||||
, passthru ? {} | ||||||||
, # For meta.position | ||||||||
pos ? # position used in error messages and for meta.position | ||||||||
|
@@ -158,7 +160,7 @@ rec { | |||||||
mkdir -p $out/bin | ||||||||
|
||||||||
echo -n "$testScript" > $out/test-script | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, what about doing something like this instead:
Suggested change
I do this by default on all my tests and if I'm not missing something, this causes black to not apply formatting but still does things such as syntax checks and other rather useful things. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What else does it do? I've re-read the README, but it only seems to talk about formatting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Giving this a shot here #122199 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, just checked: It basically just does a syntax check. Maybe using something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
${lib.optionalString (!skipLint) '' | ||||||||
${lib.optionalString (!skipLint && !skipFormatter) '' | ||||||||
${python3Packages.black}/bin/black --check --diff $out/test-script | ||||||||
''} | ||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this
false
by default wouldn't prevent those annoyances (you get annoyed, then enableskipFormatter
until all tests have it enabled?) unless we useskipFormatter = true;
for every test, which then in turn poses the question why we need black at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're 100% right about this, but the apparent lack of agreement on this topic still makes me hesitant to decide for everyone. I'd be happy to change it to
true
though.