Hello there, I’m analyzing a project with my new custom rule plugin. Let me give some informations to explain what exactly i need.
I created a plugin capable of read any kind of file, and now I’m trying to analyze yaml files. And i need to try if it works in any kind of project, but for that i need to make sure that the .yaml files are indexed. For this, I’m trying to use sonar parameters in the sonar-project.properties, how you can see below :
But when i run it with sonar-scanner, i get this message :
Anyone know what to set in the parameters to make sure that all yaml files will be read?
Since you’re creating an analyzer for any file, then I guess you don’t declare a language and claim file extensions? I wouldn’t expect an exception for this, but I wonder if you have any language in your instance that has declared / claimed
.yaml files? If not, then they won’t be indexed and thus not available to analysis, even if you do list them as “included”.
Does this make sense?
Hello G Ann, thanks for your replying. Look, the plugin i am building is mainly for java, but i have two aditional sensors that helps me read xml and yml files. So its not focused on read just the yml files. Yml files are just a “plus”. And now i’m trying to read projects in another languages than java. So I am testing my rule for java plugin, which can read yml too, in a ruby project(but it could be in any other language). The thing I want to do is analyze every single .yml in all the repository, it doesn’t matter if it is inside a folder or in the root folder, thats why i tried “sonar.sources=**/*.yaml”. Is there a way to add all yaml files of the project?
Just to add more information, it works when i use :
Because inside this folder there are only yaml files. And it works, like you can see below :
But when i use :
I get the error described in the image of the first post.
It show to me that is possible to read yaml files and analyse them to create a violation in SonarQue, but, is there a way to set “all yaml files” instead of analyze just one specific folder? I am asking this beacuase i have many yaml files in different directories and we have many projects on the company, so I can’t ask/trust for everyone to put all yaml in one specific folder(and we have all the organization files problems too).
One more time, thanks for your time, i really appreciate you G Ann and all SonarSource, you helped me a lot with this forum and with this amazing technology!
First, thanks for the kind words!
.yaml files are being indexed in the analysis. No need to explicitly include them.
Well that’s because
sonar.sources is expecting a comma-delimited list of paths, not a pattern.
All the YAML files in the project will be picked up automatically. Your only challenge is to filter them from the rest of the project files. Unfortunately, I’m afraid I don’t have the background to help on that. If you want to pursue it, you probably need to post a second topic focused precisely on that queston.
Thanks a lot G Ann. I will try to change my environment too, i noticed that some files were unrecheable to windows(don’t know why) and try my analysis again. Thanks a lot for the explanation about sources expectations.
It was really an environment problem, everything went right now. I could analyze my ruby project and all yaml files in the repository.
Ruby project :
Ruby rules and Yaml Rules together :
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.