# 更改检查严重性

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/idea/llms.txt).

检查严重性级别表示检测到的代码问题对您的项目影响的严重程度。 在 IntelliJ IDEA 中，有一组预定义的严重性级别：

![错误图标](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.status.error.svg)   错误
: 语法错误

![警告图标](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.inspectionsWarningIcon.svg)   警告
: 可能产生错误或需要增强的代码片段

![弱警告图标](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.inspectionsWeakWarningIcon.svg)   弱警告},{
: 可以改进或优化的代码片段（冗余代码、重复的代码片段等）

![服务器问题图标](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.inspectionsServerProblemIcon.svg)   服务器问题
: 来自外部构建服务器的问题，例如，来自 TeamCity 的问题

![Typo 图标](https://resources.jetbrains.com/help/img/idea/2026.3/grazie.icons.grammarError.svg)   语法错误
: 语法错误。 此严重性来自捆绑的   自然语言   插件。 更多信息请参阅 [语法](grammar.html)。

![Typo 图标](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.inspectionsTypos.svg)   拼写错误
: 拼写错误和输入错误。 有关更多信息，请参见 [拼写检查](spellchecking.html)。

需考虑事项
: 可以改进的代码片段。 此严重级别不会在 [error stripe](file-and-project-wide-analysis.html#error_stripe)上标记，且没有默认的高亮样式，但您可以从现有样式列表中选择一个或配置您自己的样式。

无高亮显示（可用修复）
: 没有代码高亮，但您可以通过按 `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) 来调用修复。

对于每种严重性，您可以在编辑器中配置其自己的高亮样式。

严重级别用于指示问题，它们不会对代码执行产生任何影响：如果将拼写错误的严重级别从   拼写错误   更改为   错误  ，这不会影响您的应用程序的执行。

Procedure: 更改所有范围内的检查严重性

1. 按 `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) 打开设置，然后选择  `编辑器 | 检查` 。

2. 选择要修改的配置文件，然后从列表中选择一个检查。 确保其已启用。

3. 从   严重性   列表中选择一个新的严重级别。 您还可以右键点击检查，并从上下文菜单中选择严重级别。

如果列表中没有所需的严重性，请点击   编辑严重性   以 [新建一个](#new_severity)。

4. 从   编辑器中的高亮显示   列表中，选择要用于在编辑器中高亮显示代码片段的样式。

选择   编辑高亮   以 [修改现有样式](#change_highlighting)。

![选择检查的严重性级别](https://resources.jetbrains.com/help/img/idea/2026.3/ij_inspection_severity.png)

5. 应用更改并关闭对话框。

修改后的检查现在将在选定的配置文件中具有新的严重级别。

Procedure: 在特定范围内更改检查严重性

1. 按 `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) 打开设置，然后选择  `编辑器 | 检查` 。

2. 选择要修改的配置文件，然后从列表中选择一个检查。 确保其已启用。

3. 从   范围   列表中，选择要更改严重性的作用域。

IntelliJ IDEA 会显示两个作用域的严重性：选定的作用域和   其他地方  。

要再添加一个作用域，请点击 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.add.svg)。 如果要新建作用域，请从作用域列表中选择   编辑作用域顺序  ，然后点击 ![编辑图标](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.edit.svg)。

4. 请从   严重性  列表中选择必要的严重级别。

如果列表中没有所需的严重性，请点击   编辑严重性   以 [新建一个](#new_severity)。

![按范围更改检查严重性](https://resources.jetbrains.com/help/img/idea/2026.3/severity_by_scope.png)

5. 此外，从   编辑器中的高亮显示   列表中，选择要用于在编辑器中高亮显示代码片段的样式。

选择   编辑高亮   以 [修改现有样式](#change_highlighting)。

如果在多个作用域中启用了某个检查，并且这些作用域中的文件匹配，IDE 将按照列表中的顺序处理这些作用域。 有关详细信息，请参阅 [更改作用域的顺序](running-inspections.html#scopes_order)。

> **Tip:**
> 您可以直接在编辑器中快速更改检查的严重级别   无高亮显示（可用修复）  。 更多信息请参阅 [禁用高亮显示，但保留修复](disabling-and-enabling-inspections.html#disable_highlighting_keep_fix)。

Procedure: 配置错误高亮

1. 按 `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) 打开 IDE 设置并选择  `编辑器 | 配色方案 | 常规` 。

您还可以从检查设置中配置高亮显示：前往  `编辑器 | 检查` ，点击任何启用的检查，然后从   编辑器中的高亮显示   列表中选择   编辑高亮  。

2. 从   错误与警告   列表中选择您要修改的样式。

3. 使用右侧的选项配置新的高亮规则。 要在应用更改之前预览这些更改，请使用对话框底部的预览部分。

![更改错误高亮显示方式](https://resources.jetbrains.com/help/img/idea/2026.3/severity_formatting.png)

Procedure: 创建新的严重级别

1. 按 `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) 打开设置，然后选择  `编辑器 | 检查` 。

2. 选择您想要在其中创建新严重级别的配置文件。

3. 点击任意检查项并从严重性级别列表中选择   编辑严重性  。

4. 在   严重性编辑器  对话框中，点击 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.add.svg)并命名新的严重级别。

5. 使用 ![向上](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.moveUp.svg) 和 ![向下](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.moveDown.svg) 按钮配置格式和设置优先级——将严重性放在列表越高的位置，其优先级就越高。

6. 请点击   OK  完成操作。

![创建新的严重性](https://resources.jetbrains.com/help/img/idea/2026.3/severities_editor_ij.png)

## See also

### 过程

[代码检查](code-inspection.html)

### 参考

[检查](inspections-settings.html) [作用域](settings-scopes.html)

