You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

构建排除的jQuery IntelliSense文件仍在SonarQube重复列表中

Troubleshooting: jQuery IntelliSense Files Still Appearing in SonarQube Duplicate List After Nuspec Exclusion

Let's walk through why your excluded .intellisense.js files are still showing up in SonarQube's duplicate detection, and how to fix this issue step by step.

1. First: Verify Your Nuspec Exclusion Is Actually Working

The nuspec <file> exclude rule only controls what gets packaged into your NuGet artifact—not what SonarQube scans. But first, let's confirm the rule itself is correct:

  • Your current exclude pattern is scripts*.intellisense.js—this likely has a path matching issue. If you're trying to exclude all .intellisense.js files under the scripts directory (including subfolders), you need to use a recursive pattern:
    <file src="scripts/**" target="scripts" exclude="scripts/**/*.intellisense.js"/>
    
  • To validate, run nuget pack locally, extract the generated .nupkg file, and check if the scripts folder still contains any .intellisense.js files. If they're still present, adjust the exclude pattern to match your actual file structure.

2. SonarQube Needs Its Own Exclusion Rules

If SonarQube is scanning your source code repository (not just the NuGet package), the nuspec settings won't affect what it analyzes. You need to tell SonarQube directly to ignore these files:

  • Option 1: SonarQube UI Configuration
    Go to your project in SonarQube → Project Settings → General Settings → Analysis Scope → Files. Under Exclusions, add the pattern:
    scripts/**/*.intellisense.js
    
  • Option 2: Project-Level Properties File
    Create or update a sonar-project.properties file in your repository root with:
    sonar.exclusions=scripts/**/*.intellisense.js
    
  • Option 3: CI/CD Pipeline Parameter
    If you're using a CI/CD tool (like Azure DevOps, GitHub Actions), pass the exclusion directly to the SonarQube scanner command. For example, with .NET:
    dotnet sonarscanner begin /d:sonar.exclusions=scripts/**/*.intellisense.js /k:"your-project-key" /d:sonar.host.url="your-sonarqube-url"
    

3. Clear SonarQube's Cache and Re-Run a Full Analysis

SonarQube often caches analysis results to speed up incremental scans. This can cause old data (including the excluded files) to stick around:

  • In your SonarQube project, go to Administration → Project Settings → General Settings → Clean Project to trigger a cache clear.
  • Re-run your CI/CD pipeline with a full analysis (disable incremental scanning if your tool allows it) to ensure SonarQube picks up the new exclusion rules.

4. Check Branch-Specific Configuration

Since you're pushing to the develop branch, make sure the exclusion rules are applied to this branch. Sometimes teams configure different analysis scopes for feature/develop branches vs. main. Double-check the develop branch's analysis settings in SonarQube to confirm the exclusions are active.


内容的提问来源于stack exchange,提问作者Anju Rajan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 21:27:33