此内容没有您所选择的语言版本。

Chapter 3. Configuring Visual Studio Code to use Dependency Analytics


You can gain access to Red Hat’s Trusted Profile Analyzer (RHTPA) service by using the Dependency Analytics extension for Microsoft’s Visual Studio Code application. With this extension you get access to the latest open source vulnerability information, and insights about your application’s dependent packages.

Dependency Analytics supports the following programming languages:

  • Maven
  • Gradle

    • Groovy
    • Kotlin DSL
  • NPM
  • PNPM
  • Yarn

    • Berry
    • Classic
  • Python
  • Go
Important

Visual Studio Code by default, executes binaries directly in a terminal found in your system’s PATH environment. You can configure Visual Studio Code to look somewhere else to run the necessary binaries. You can configure this by accessing the extension settings. Click the Workspace tab, search for the word executable, and specify the absolute path to the binary file you want to use for Maven, Node, Python, or Go.

Note

The Dependency Analytics extension is an online service maintained by Red Hat. Dependency Analytics only accesses your manifest files to analyze your application dependencies before displaying the results.

Prerequisites

  • Install Visual Studio Code on your workstation.
  • For Maven projects, analyzing a pom.xml file, you must have the mvn binary in your system’s PATH environment.
  • For NPM projects, analyzing a package.json file, you must have the npm binary in your system’s PATH environment.
  • For Go projects, analyzing a go.mod file, you must have the go binary in your system’s PATH environment.
  • For Python projects, analyzing a requirements.txt file, you must have the python3/pip3 or python/pip binaries in your system’s PATH environment. Also, the Python application needs to be in VS Code’s interpreter path.

Procedure

  1. Open the Visual Studio Code application.
  2. From the file menu, click View, and click Extensions.
  3. Search the Marketplace for Red Hat Dependency Analytics.
  4. Click the Install button to install the extension. Wait for the installation to finish.
  5. To start scanning your application for security vulnerabilities, and view the vulnerability report, you can do one of the following:

    • Open a manifest file, hover over a dependency marked by the inline Component Analysis, indicated by the wavy-red line under a dependency name, click Quick Fix, and click Detailed Vulnerability Report.
    • Open a manifest file, and click the pie chart icon.
    • Right click the manifest file in the Explorer view, and click Red Hat Dependency Analytics Report…​.
    • From the vulnerability pop-up alert message, click Open detailed vulnerability report.
  6. If you want to exclude specific packages for analysis, you can use the exhortignore as a comment tag for your specific programming language.

    • For Maven, update the pom.xml file:

      ...
      <dependency> <!--exhortignore-->
        <groupId>...</groupId>
        <artifactId>...</artifactId>
        <version>...</version>
      </dependency>
      ...
      Copy to Clipboard Toggle word wrap
    • For Go, update the go.mod file:

      module github.com/trustify-da/SaaSi/deployer
      
      go 1.19
      
      require (
              github.com/davecgh/go-spew v1.1.1 // indirect exhortignore
              github.com/emicklei/go-restful/v3 v3.9.0 // indirect
              github.com/go-logr/logr v1.2.3 // indirect //exhortignore
      
      )
      ...
      Copy to Clipboard Toggle word wrap
    • For Python, update the requirements.txt file:

      ...
      click==8.0.4 #exhortignore
      ...
      Copy to Clipboard Toggle word wrap
    • For Gradle, update the build.gradle file:

      plugins {
      id 'java'
      }
      
      group = 'groupName'
      version = 'version'
      
      repositories {
          mavenCentral()
      }
      
      dependencies {
          implementation "groupId:artifactId:version" // exhortignore
      }
      test {
          useJUnitPlatform()
      }
      Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat