Exclude Jquery files/libraries to ignore Duplicate Lines or Blocks

Hi

I am unable to exclude all directories and *.js files for Duplicate Lines or Blocks.

sonar.cpd.exclusions=Content/** , css/** , ASPX/** , javaScripts/**, javaScripts/*.js

Please clarify.

Hello @sushma.r,
Sorry but your problem description is too blunt.
Please provide more details, such as the logs of you scanner execution and what you get in the SonarQube project home page (duplications in particular)

I got duplication 40% in my project when i run sonarqube, in that jquery, css files are displayed.
so i need to exclude these file from duplication lines or blocks, i try to configure exclusions settings in the (Administration --> General settings --> Analysis Scope --> Duplication Exclusion) as:

Sonar.cpd.exclusions=Project/Content/** , Project/css/** , Project/tiny_mce/** ,Project/tiny_mce/** , Project/javaScripts/** , Project/Scripts/**, Project/Scripts/*

After these settings again i run the code, but duplication was displayed as same with Jquey & Css files.

Hello Sushma,
This should work if:

  • The settings are indeed applied to your project: Most settings can be set at global admin level (Starting from the top level global Administration menu, but also at project admin level (from the 2nd level Project Administration menu). The latter overrides the global level.
    Normally you set exclusions at project level (because it rarely the case that exclusions are global, ie the same for all projects)
  • You entered the settings properly: When using the GUI, you don’t enter all separate exclusion pattern comma separated, you have to enter one pattern per line:
    – The below won’t work:

    – This is the right way:

If you think you did everything correctly, please send the logs of you scanner ran in debug model (-Dsonar.verbose=true)

Regards

Thank You, duplication percentage has got reduced to 22% by this settings.