aider icon indicating copy to clipboard operation
aider copied to clipboard

.NET: Linter runner doesn't work

Open rodion-m opened this issue 1 year ago • 10 comments

Issue

image dotnet build - is the correct linter command (it doesn't require to provide any files paths.

Version and model info

Aider v0.37.0 Models: claude-3-opus-20240229 with diff edit format, weak model claude-3-haiku-20240307 Git repo: .git with 33 files Repo-map: using 10000 tokens

rodion-m avatar Jun 09 '24 19:06 rodion-m

Thanks for trying aider and filing this issue.

Does running dotnet build <filename> work for you if you just run it on the command line? That's all aider is doing.

paul-gauthier avatar Jun 10 '24 22:06 paul-gauthier

Yeah, I understand. It's not working from cmd too. dotnet build accepts a solution or project path as an argument. C# and F# are compilable languages. So we need an ability for aider to make it to not inject anything into the command line. https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build

rodion-m avatar Jun 11 '24 04:06 rodion-m

I believe dotnet build is a quite comprehensive make/compile/build command. Not a linter.

paul-gauthier avatar Jun 20 '24 14:06 paul-gauthier

You're right. An alternative true way is to make aider interact with the LSP (with its diagnostics), but it's much harder to implement and also not all IDEs use it. Anyway, I think the feature is a good candidate for a separate issue.

Speaking about dotnet build - yes, it's not a perfect option, but it works (I had to use it via tests with aider), so I believe we should allow developers to set this command as a linter command (or even add a new command).

rodion-m avatar Jun 20 '24 17:06 rodion-m

Using aider --test-cmd "dotnet build" might make more sense.

paul-gauthier avatar Jun 20 '24 17:06 paul-gauthier

Using aider --test-cmd "dotnet build" might make more sense.

Paul, but it's not tests. For tests we have dotnet test. What do you think about adding the 3-rd feature "building" or "compilation"? It can be like build-cmd.

rodion-m avatar Jun 21 '24 19:06 rodion-m

Using aider --test-cmd "dotnet build" might make more sense.

This is what I wanted to use, but that does not work for me. In fact, trying to run any command with arguments does not work as I expect. Something wrong with the quoting.

https://github.com/paul-gauthier/aider/issues/741


Specifically, to this issue I see two obvious options:

  1. Call a shell script that invokes dotnet build and ignores the args. Requires no aider changes.
  2. Add an option to not pass the file name to the linter command.

nevercast avatar Jul 01 '24 00:07 nevercast

So the model for aider is that the lint step is something which is done to specific files which have been edited. So it's expected to take the filename(s) of source files on the cmd line.

The test step is a "global" operation, not applied to specific file.

Why not do --test-cmd "dotnet build && dotnet test" to both build and test?

paul-gauthier avatar Jul 03 '24 15:07 paul-gauthier

Why not do --test-cmd "dotnet build && dotnet test" to both build and test?

@paul-gauthier Paul, because it's not the same operations :) Build is a build and test is a test) it's often when a project doesn't even have any tests.

Many languages have a build/compile feature and it'll be nice to see support of building in aider. If you wish I can even implement it...

rodion-m avatar Jul 03 '24 17:07 rodion-m

It's called --test-cmd but it doesn't need to be used for testing. It's just used for any repo-wide checks that you want aider to do. For many projects, that's testing. It could be building. Or it could be both building and testing. Whatever you like for your project.

There's no need for a separate --build-cmd. That just adds complexity and I don't think it does anything more than using --test-cmd for any/all repo-wide checks.

paul-gauthier avatar Jul 03 '24 17:07 paul-gauthier

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

paul-gauthier avatar Jul 07 '24 10:07 paul-gauthier