bitter-ability-32190
07/26/2022, 5:53 PMfix
goal. However this brings up a follow-up issue, which goal should run these to validate code? lint
or check
.
Which then, IMO, turns into a question of, have we really nailed down the difference between lint
and check
w.r.t. which belongs where? I know at least for Python the delineation is fuzzy and even has a few maintainers unsure.
I'd like to open a discussion for really nailing down exactly how someone can determine which tool belongs where, and why (with a slight lens on languages where it isn't obvious, like Python or JS).
(Note this isnt a discussion about where fixers go, we can have that discussion after this one)hundreds-father-404
07/26/2022, 5:56 PMfix
and fmt
existing as separate goals.
b) I too don't love the difference between check
and lint
, but specifically for non-compiled languages. For compiled languages, I think it's great having a goal only to run compilation w/o running linters
For compiled languages, we have not yet formalized whether check
should exclusively run compilation, or also be able to run linters? If so, how do we determine whether the linter belongs to lint
vs check
?bitter-ability-32190
07/26/2022, 5:56 PMwitty-crayon-22786
07/26/2022, 6:19 PMlint
.bitter-ability-32190
07/26/2022, 6:20 PMwitty-crayon-22786
07/26/2022, 6:21 PMbitter-ability-32190
07/26/2022, 6:22 PMwitty-crayon-22786
07/26/2022, 6:23 PMis it a type checking error or is it a lint?
witty-crayon-22786
07/26/2022, 6:24 PMwitty-crayon-22786
07/26/2022, 6:25 PMflow
, the typescript compiler, etcâhundreds-father-404
07/26/2022, 6:26 PMcheck
. In the past, it's been proposed that we use the dividing line as
does this tool need to consider transitive deps?Which leads to my question about compiled languages. If a JVM linting tool needed transitive deps, what goal should it belong to?
bitter-ability-32190
07/26/2022, 6:26 PMmypy
claims to be both a static type checker
as well as a lint-like tool
. Languages like Python which use type hints can still be completely valid runnable code with incorrect or missing type hints, just as they can with one or more lint errors.hundreds-father-404
07/26/2022, 6:28 PMcheck
only being type-checking or compilation, then I think there's little ambiguity. The issue would be if we moved Pylint to check
, or had compiled-language linters using check
bitter-ability-32190
07/26/2022, 6:30 PMmypy
only more extreme is both a linter and "typechecker". It complains about names as well as type issues.bitter-ability-32190
07/26/2022, 6:34 PMcheck
fails?". Or put another way, when we say "type checking" do we mean "strict" or "loose" checking?witty-crayon-22786
07/26/2022, 6:36 PMhundreds-father-404
07/26/2022, 6:37 PMwitty-crayon-22786
07/26/2022, 6:37 PMpylint
?)bitter-ability-32190
07/26/2022, 6:38 PMbitter-ability-32190
07/26/2022, 6:48 PMpylint
requiring transitive deps because its only ever been run in an env containing all possible deps.
Combine that with the obvious name association and it can get really confusing.witty-crayon-22786
07/26/2022, 6:50 PM--changed-dependees=transitive check
is necessary, while dependees/dependencies are not necessary for lint
. e.g. https://github.com/pantsbuild/pants/issues/16240witty-crayon-22786
07/26/2022, 6:50 PMbitter-ability-32190
07/26/2022, 6:52 PMmypy
and pylint
it is "valid" to run without dependencies. And we could allow configurability for such.
For compiled languages, where you can't make forward progress if your code doesn't compile, the razor seems more natural and users are more dependency-aware (due to tools like GNU make)bitter-ability-32190
07/26/2022, 6:57 PMflat-zoo-31952
07/26/2022, 7:01 PMpylint
đżenough-analyst-54434
07/26/2022, 7:01 PMbitter-ability-32190
07/26/2022, 7:02 PMhundreds-father-404
07/26/2022, 7:03 PMcheck
to be called compile
, and it only works with compiled languages. Linting tools are always lint
, and compilation is always compile
. No ambiguity what "check" means
(Ack renaming Yet Again would be obnoxious.)witty-crayon-22786
07/26/2022, 7:03 PMcheck
for rust doesnât actually compileflat-zoo-31952
07/26/2022, 7:03 PMlint
goal for a long time. I don't think there's a compelling reason to move itbitter-ability-32190
07/26/2022, 7:04 PMcheck
?hundreds-father-404
07/26/2022, 7:04 PMcheck
== compile or type check. For compiled languages, this means all linting tools are run via lint
, regardless of transitive deps
2) get rid of check
, and add compile
which is solely for compiled languages.flat-zoo-31952
07/26/2022, 7:05 PMhundreds-father-404
07/26/2022, 7:06 PMwitty-crayon-22786
07/26/2022, 7:06 PMhundreds-father-404
07/26/2022, 7:08 PMcheck
makes sense. Rather, for compiled languages, this is my concern
Which leads to my question about compiled languages. If a JVM linting tool needed transitive deps, what goal should it belong to?We have not thought about that question, afaict
witty-crayon-22786
07/26/2022, 7:09 PMpylint
, discussing that more concretely would be helpful. the rest of the discussion is too abstract.hundreds-father-404
07/26/2022, 7:14 PMcheck
vs lint
.
We've said in the past that it's "does this need transitive deps", but haven't formally committed to it because:
a) Pylint would be miscategorized w/ that definition
b) we haven't confirmed we're okay with linting tools for compiled languages being in check
So, do we:
1. stick to that razor line?
2. Change razor to something like "either compilation or type checking, but nothing else"?
3. Get rid of check
and add compile
?
Motivation is fmt
vs fix
relates to this conversation, specifically confirming whether fix
tools should always run with lint
, rather than check
@bitter-ability-32190 does that sound right?bitter-ability-32190
07/26/2022, 7:22 PMbitter-ability-32190
07/26/2022, 7:24 PMmypy
and pylint
come up often because they are deeply related in a typechecking sense, are in different goals, and have varying degrees of requiring dependencies / "checking" the code for "compilability".bitter-ability-32190
07/26/2022, 7:28 PMpylint
as well as flake8
, but without the batching and parallelization. (Part of this of course, is that open ticket about possibly treating it as a compiler, but to me this is completely a Pants-ism. Ask anyone in the Python community if you should run mypy
recursively like a compiler and they'll go "what?!")
⢠lint
runs linters and formatters. should check
encompass fixers that require deps, if thats the razor?hundreds-father-404
07/26/2022, 7:43 PMcheck
into lint
, but add compile
for compiled languagesbitter-ability-32190
07/26/2022, 7:48 PMcargo check
- "This will essentially compile the packages without performing the final step of code generation [...] Some diagnostics and errors are only emitted during code generation, so they inherently won't be reported with cargo check
."
In a C++ backend, check
v compile
, I could see a user being amenable to check
running the compiler but with certain settings to make the operation fast (skips optimization for instance). Where compile
seems like it does the user-required work, and produces an artifact (either the obj
or the built lib).
Honestly I wish one of us had more TypeScript experience, as that is a "compiled" scripting language and might also help us decide.flat-zoo-31952
07/26/2022, 8:10 PMflat-zoo-31952
07/26/2022, 8:12 PMhundreds-father-404
07/26/2022, 8:15 PMcheck
to then run things like package
. Pants will do whatever is necessary beforehand, i.e. on-the-fly dynamic compilation
check
solely exists to allow you explicitly check that compilation worksflat-zoo-31952
07/26/2022, 8:18 PMpackage.json
file, which then gets run with npm run my-command
like make files...if you wanted to get a picture of how it's actually used, it might be interesting to sample those in major JS projectshappy-kitchen-89482
07/26/2022, 8:30 PMhappy-kitchen-89482
07/26/2022, 8:30 PMwide-midnight-78598
07/26/2022, 8:36 PMcheck
is a user-facing API and as a user, I don't want dependency graphs in my brain while figuring out which 3-5 letters to type (regardless of how trivial or not)
⢠Need to be careful with compile
as a goal because I think it is conflated with "build" or "compile and link" for a lot/most developers, which this goal wouldn't do... Not opposed to a compile
goal, but that's something to think about
⌠In my C/C++ backend, check
performs compilation, but there is a separate Linking step that happens on package
- but I know that's how it should work, not suggesting it's intuitive to someone who is new to Pants
⢠Typescript (the entire JS ecosystem actually) is a strange one, because of all the pseudo-isolated concepts of bundling, tree-shaking (optimization), transpilation, etc - I've been trying to add TS to the JS backend for a while, but I'm stuck in a semantics loop - so excited to hear the result of all this
⢠I'd be fine keeping check
with the Rust definition mentioned above ("This will essentially compile the packages without performing the final step of code generation")
⌠I'd only want to see check
changed to compile
if we're entirely on board, but changing the documentation and slowly moving plugins around while keeping the same name would allow an eventual deprecation and re-naming, without it being too crazy
⌠Could also add to check
- for non- ahead-of-time compiled languages, check
will perform typechecking (if possible)
⢠Mentioned above, but I wonder if a check
vs lint
rule could be "your code won't run"?
⌠This does exclude interpreted languages from check
but they can run linters, and this would also be where something like mypyc
could go for Python, because check
failures would become make/breakbitter-ability-32190
07/26/2022, 8:47 PMcheck
shedding itself of "typechecking" and being much closer to "light compilation"wide-midnight-78598
07/26/2022, 8:54 PMtsc
as a compiler. https://www.typescriptlang.org/docs/handbook/compiler-options.html
So, go figure đ¤ˇwitty-crayon-22786
07/26/2022, 8:55 PMmypy
from check
which doesnât make sense to me for practical purposes.bitter-ability-32190
07/26/2022, 8:57 PMdoesnât make sense to me for practical purposesCan you elaborate?
witty-crayon-22786
07/26/2022, 8:58 PMcheck
to decide whether itâs going to be worthwhile to run a bunch of tests⌠i donât care about the rest of lint
for that purpose, and so i donât lint
until iâm ~done with codewitty-crayon-22786
07/26/2022, 8:59 PMbitter-ability-32190
07/26/2022, 9:00 PMcheck
then is something a la "check for code correctness?"bitter-ability-32190
07/26/2022, 9:01 PM./pants lint --only=mypy ...
would be your spiritual equivalentwitty-crayon-22786
07/26/2022, 9:02 PMpython
, but not for the other languages. would be better not to have to type out the specific check
implementation i want (scalac
, rustc
, etc)witty-crayon-22786
07/26/2022, 9:03 PM./pants lint --typecheckers
or something.witty-crayon-22786
07/26/2022, 9:03 PMbitter-ability-32190
07/26/2022, 9:05 PMwitty-crayon-22786
07/26/2022, 9:09 PMpylint
, so whether that is progress depends on the goal of the threadbitter-ability-32190
07/26/2022, 9:12 PMpylint
is đbitter-ability-32190
07/26/2022, 9:14 PMit would be forYou'd have, but not for the other languages. would be better not to have to type out the specificpython
implementation i want (check
,scalac
, etc)rustc
./pants lint --only=mypy check ...
bitter-ability-32190
07/26/2022, 9:20 PMcheck
is more about ensuring it's even worth testing (or executing the next goal)?
How do you feel about the fact that mypy
can fail, but tests can pass?witty-crayon-22786
07/26/2022, 9:39 PMSo, to you,yea. âtypecheckingâ is, to be clear.is more about ensuring itâs even worth testing (or executing the next goal)?check
How do you feel about the fact thatno compiler/typechecker can solve that problem statically, but theyâre still worth running⌠not sure i understand the questioncan fail, but tests can pass?mypy
bitter-ability-32190
07/26/2022, 9:40 PMbitter-ability-32190
07/26/2022, 9:45 PMhundreds-father-404
07/26/2022, 9:48 PM2) change razor to "is compilation or type checking"And it actually matches our current
./pants help
definition.
I'm generally very open to that outcome, as long as we follow it through to its logical conclusion:
1) For compiled languages, linting tools should not be run with check
. Only the compilers themselves are check
, e.g. cargo check
vs cargo clippy
(linter)
2) Still don't know what Pylint is. I think it's less of a type checker, it's not MyPybitter-ability-32190
07/26/2022, 9:50 PMhundreds-father-404
07/26/2022, 9:53 PMcheck
. This would only tighten up our semanticshundreds-father-404
07/26/2022, 9:53 PMenough-analyst-54434
07/26/2022, 9:56 PMenough-analyst-54434
07/26/2022, 9:57 PMhundreds-father-404
07/26/2022, 9:57 PMIt's probably indicative of a broader problem in that you can't ad-hoc pick out a member of a union when running any goal today.Sort of.
./pants fmt --only=black --only=isort
exists, along with ./pants --black-skip fmt
enough-analyst-54434
07/26/2022, 9:57 PMcurved-television-6568
07/26/2022, 10:09 PMlint
is just a configuration for running tools a
b
and c
. for instance. If a users feels strongly that it doesnât make sense can move tool b
to check
instead, in their project.enough-analyst-54434
07/26/2022, 10:10 PMbitter-ability-32190
07/26/2022, 10:12 PMbitter-ability-32190
07/26/2022, 10:53 PMwide-midnight-78598
07/26/2022, 10:53 PMI feel a big issue is trying to find goal vocabulary that will make sense for any tool for any language. That feels like it could be an impossible task. So how about instead look for a way to more dynamically tie tools to goals in a more configurable way. That is,While I like a good mic drop as much as the next person, this feels like it's moving in the wrong direction - basically over-configurability. It's the whole "anything can be anything" which is usually fine in the moment, but I've had to maintain projects with this type of dev tool configuration (and sometimes even production configuration), and it's a hard pass. It ends up moving this entire Slack thread to multiple companies over multiple years of bike-shedding I'm an advocate of getting tools that make sane decisions, with some configuration as an aside: Black, Prettier, SvelteKit, etcis just a configuration for running toolslint
a
andb
. for instance. If a users feels strongly that it doesnât make sense can move toolc
tob
instead, in their project.check
hundreds-father-404
07/26/2022, 10:55 PMproud-dentist-22844
07/26/2022, 11:50 PMhundreds-father-404
07/26/2022, 11:55 PMlint
, and check
solely being compilation, aka "option 3"? If not, we can probably stop considering this
2) Do folks agree that for compiled languages, linting tools should never run under check
, as they are not compilation?wide-midnight-78598
07/27/2022, 12:05 AMcheck
means compilation without linking/codegen and for non-compiled languages, it's a best-effort typecheck (mypy, pyright, tsc, Flow, etc)?bitter-ability-32190
07/27/2022, 12:29 AM