How do I exclude generated files - marked with @Generated annotation

We generate some code and mark the source files with the @Generated annotation.
How do we exclude these files (in various directories) - or have a special rule set for them.


If you want to ignore these files altogether (issues, duplications, coverage, …) you’ll need to segregate them from your non-generated files and set an exclusion for the relevant directories. If you simply want to ignore issues on these files, but retain them in all other aspects of analysis, then take a look at the “Ignore Issues on Files” section of this page of the docs.


Thanks Ann!
I know the directory option and hoped that the @Generated annotation is good for something :wink:

1 Like

You could as well set sonar.issue.ignore.allfile=@Generated. This setting will skip scanning files that contain @Generated.