Typescript 您可以分析特定的文件

Typescript 您可以分析特定的文件,typescript,azure-devops,continuous-integration,sonarqube,continuous-deployment,Typescript,Azure Devops,Continuous Integration,Sonarqube,Continuous Deployment,我试图使用sonarqube分析azure devops git存储库中的一个特定文件(filename.ts),我想每天运行该文件 到目前为止,我已确定: 我现在挠头的地方是确定以下几点: a. How to tell my CD pipeline where the file is in the azure repo. Should I point it to the file in the Repo? Or should i take it from the CI a

我试图使用sonarqube分析azure devops git存储库中的一个特定文件(filename.ts),我想每天运行该文件

到目前为止,我已确定:

  • 我现在挠头的地方是确定以下几点:

    a.  How to tell my CD pipeline where the file is in the azure repo. Should I point it to the file in the Repo? Or should i take it from the CI artifact?
    
    b.  Would the sonarqube project require further configuration so to see the file?
    

    我觉得这个拼图还有几块。有人能给我指出正确的路径吗?请包括我可能没有想到的任何其他内容?

    首先,您需要检查预配置的sonarqube服务连接点是否指向您的sonarqube主机

    转到azure devops中的
    项目设置-->
    服务连接
    -->选择预配置的
    sonarqube服务连接
    -->单击
    编辑
    -->检查
    服务器Url是否指向您的sonarqube主机Url

    如果预配置的sonarqube服务连接指向不同的sonarqube主机。您需要为sonarqube主机创建新的sonarqube服务连接

    分析特定文件

    您可以将
    sonar.includes
    属性设置为仅分析特定文件。见下图。有关更多信息,请查看

    您可以在发布管道中准备分析配置任务的
    附加属性
    字段中配置
    sonar.includes
    属性

    或者也可以在SonarQube项目UI中设置
    sonar.includes
    属性

    要使用排除仅分析sonar.sources中指定的文件子集,请转到“项目设置>常规设置>分析范围>文件”

    • 源文件包含
    • 测试文件包含

    谢谢@Levi,我关注了你的详细回复。我确实遇到了一个缺少的组件:“错误:找不到模块‘typescript’”。这是我可以在Azure CD发行管道中单独安装的东西吗?Hello@Levi,我通过添加一个任务来安装typescript npm解决了这个错误。这是一个简单的bash脚本“npm安装类型脚本”。谢谢你的帮助,我会把你标记为已接受的答案。
    Created a CD release pipeline in Azure DevOps including the predefined sonarqube tasks:
    
        *    prepare analysis on sonarqube (unclear to me how I configure this)
        *    run code analysis (looks as if this doesn't require configuration)
        *    publish quality gate (same belief here that it doesn't require configuration)
    
    Identified the repository where the file exists in the azure repo. 
    
    I have also discovered the artifact name that the repo's CI pipeline generates.
    
    Found a preconfigured sonarqube service connection in Azure DevOps.
    
    a.  How to tell my CD pipeline where the file is in the azure repo. Should I point it to the file in the Repo? Or should i take it from the CI artifact?
    
    b.  Would the sonarqube project require further configuration so to see the file?