-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Excluding files from static analysis doesn't appear to stop errors from being generated in those files #28754
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
Comments
I don't know what's causing the issue, but I can suggest a couple of possibilities. First, it's possible that the analysis server failed to respond correctly to the exclusion request and continued to report errors and / or failed to tell the client to flush information for the newly excluded files. Second, I know that we are still refining the definition of strong mode. One implication of this is that the |
I'm setting the exclusion in
I discovered the issue here wasn't just strong mode, it was implicit dynamics. I've raised a request for the generated code to support that; but at least that bit makes sense now.
I don't believe so, I've been using 1.21.1 almost the entire day (I did some testing earlier, but that was before I really started any of this work). I think the errors coming/going probably isn't that interesting for now (I had other errors that might've affected those appearing; I can raise an issue if I can reliably repro an issue there); this case was more about the exclude not working. I'll see if I can get some better info... |
Ok; I think I know what's happening here. When I open a project with ignored files, I do not get errors for them (this is expected). If I then open a file in the IDE (which will send So, I think maybe ignored files should have their errors flushed when they are removed from priority files (assuming the behaviour of showing errors while they're open is correct; otherwise not showing them would also solve the issue). |
Might be related to #26212 |
I've been experiencing this same issue -- I've added an exclude rule for a directory, using analyzer 1.22.0, and it's not picking it up :( Checked that my .analysis_options is correctly formed, tried wildcards ( |
FWIW -- built_value will try to generate code as "analyzer friendly" as possible. (I will take a look to see what can be done about the current warnings). Good support for excluding warnings for generated files is important. This doesn't quite end the story, though. There is a more complex issue because built_value works by generating an implementation of your abstract class. If your abstract class implements an interface that built_value doesn't know/care about ... then the generated class has an analyzer warning that you do want to see, because you need to fix it yourself. e.g. if you implement "HasFoo", with a "foo" property, but don't write that "foo" property yourself; then the class built_value generates also implements HasFoo, is not abstract, and ideally you should get a warning saying that your override is incorrect. Unfortunately I don't see any way to fix this besides built_value doing the check itself and failing the generation step if there are "left over" abstract methods that you need to implement yourself. This has the pretty major downside that what you're used to seeing as an analyzer warning is delivered via an entirely different path. |
It's out of scope for this case, but if generating code this way is going to be a common case, I think there should be some ability to route messages back to the analyzer. This isn't just for if a user decides to ignore warnings/errors in the generated code; often the errors in that code do not accurately describe the problem, whereas the author of the code-gen would be able to? |
To perpetuate the side-trail... As it happens, I'm in the process of implementing support for plugins to the analyzer / analysis server that would allow packages like built_value to contribute to analysis. There isn't a way for plugins to remove or replace errors that analyzer generates, but they could generate their own, and they will be able to contribute quick fixes (for their own errors or those generated by analyzer). If I don't get sidetracked, I'm hoping to have an initial version within a couple of months. |
@bwilkerson Sounds good! Is there a GH Issue relating to this we can follow for updates? (just for curiosity, not to continually ask if it's finished yet.. probably). |
Not that I'm aware of. |
Dup of #25551 ? |
Yeah, seems like it to me. |
I don't know if this is expected; but I'm trying out the
built_value
package hoping to get JSON support. I found the generated code didn't seem to "compile" in strong mode (@davidmorgan - is this expected? I can see commits suggesting strong mode should work; there is generated code likevar key;
).I tried adding the generated file to the exclude list in
analysis_options.yaml
but even after restarting the Analyzer it still reports errors on in those files.I don't know if this is expected (nor do I know if the generated code is intended to be strong-mode compliant) but I figured I should ask!
The text was updated successfully, but these errors were encountered: