Skip to content
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

Suggestion: Ignore compiler warnings and information from specified directories #660

Open
ChrisTrenkamp opened this issue Oct 1, 2018 · 8 comments

Comments

@ChrisTrenkamp
Copy link

As a user of the vscode-java extension, I would like to ignore Java compiler warnings and information coming from certain directories.

Generated code and unit tests often generate warnings from the compiler. I would like to have warnings coming from certain directories suppressed so it'll be easier to find warnings from code we're interested in.

files.ignore is not good enough because sometimes you want to ignore warnings coming from unit tests. For example, you might want to test your equals() method against different objects, but you will get an information message telling you that it's an unlikely argument.

For now, entering src/main/** into the problems filter seems to be good enough for now, but I would like to create a workspace with some sane defaults for my coworkers to use when pulling the project.

@fbricon
Copy link
Collaborator

fbricon commented Oct 3, 2018

You can add an ignore_optional_problems flag to your project's .classpath file, like:

<classpathentry kind="src" output="target/classes" path="src/main/java">
    <attributes>
        <attribute name="ignore_optional_problems" value="true" />
    </attributes>
</classpathentry>

@BlazerYang
Copy link

same problem, any solution yet?

@ghost
Copy link

ghost commented May 24, 2022

+1

@dashorst
Copy link

dashorst commented Jun 27, 2022

Since VS Code no longer generates the .classpath files inside the workspace, it is quite difficult to modify them directly, especially when using a remote devcontainer. Having a UI to add this boolean attribute, or a menu item to open the .classpath file for the project would be absolutely helpful. At this time I can't recommend using VS Code for our project as the number of warnings in generated dwarfs the actual warnings in our code base, and we have a zero warning policy.

@rubensa
Copy link

rubensa commented Sep 14, 2022

Should be great to have an option to do this in the JAVA PROJECTS view by a right click in an specific source folder (or in the Configure Classpath page).

(related to: #2150)

@rubensa
Copy link

rubensa commented May 29, 2023

Any chance for the ignore_optional_problems to be added for any folder under "target/generated-sources" (like it is currently automatically being added for target/generated-sources/annotations and target/generated-test-sources/test-annotations)?

@heruan
Copy link

heruan commented Feb 12, 2024

Any chance for the ignore_optional_problems to be added for any folder under "target/generated-sources" (like it is currently automatically being added for target/generated-sources/annotations and target/generated-test-sources/test-annotations)?

This would be great. I use a Maven plugin to generate a lot of sources in target/generated-sources/** and I have thousands of warnings 🤯

@snjeza
Copy link
Contributor

snjeza commented Feb 12, 2024

@rubensa @heruan You can try the ecliseignorehelper plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants