How to consider only python files for my sonar analysis

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube 8.6, Scanner maven plugin 3.8)
  • what are you trying to achieve: python files alone need to analyze correctly
  • what have you tried so far to achieve this: My project is a nested sub module maven project
    configuration/src/bin → contains .py and .sh files. (here configuration is submodule)
    So in the pom.xml of submodule(configuration) specified the sonar.source path in the property tag as mentioned below

    <sonar.sources>src/bin</sonar.sources>

I think sonar have a capability to identify the programming language based on the file extension say for python file extension is.py.

Sonar is doing the analysis on python files but as we have configured sonar do the analysis only on “New code”. In my case i have modified the changes in pom.xml, but sonar raised the issue on some of the python files which is not related to my changes.

Could you please help me on this.

Thanks
subbu

Hi subbu,

It’s not clear what you’re trying to accomplish. Is this about analyzing only Python files or about only analyzing new files?

 
Ann

Hi Ann,

Yes, we would like to know how to analyze only python files.

Thanks
subbu

Hi subbu,

There are several ways to go about this. The cleanest is probably to set an inclusion to **/*.py. The docs should help.

 
HTH,
Ann