Skip to content

Commit 218fe77

Browse files
committed
Enable PhpCSValidationInspection in MoodleSettingsForm
This change ensures that the PhpCSValidationInspection tool is enabled by default when configuring the Moodle coding standard for the project. It updates the inspection profile and logs a confirmation message, improving default validation settings for better code quality.
1 parent ae8bc43 commit 218fe77

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/kotlin/il/co/sysbind/intellij/moodledev/project/MoodleSettingsForm.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.intellij.openapi.options.ShowSettingsUtil
1212
import com.intellij.openapi.project.Project
1313
import com.intellij.openapi.project.guessProjectDir
1414
import com.intellij.openapi.ui.TextFieldWithBrowseButton
15+
import com.intellij.profile.codeInspection.InspectionProjectProfileManager
1516
import com.intellij.ui.components.JBCheckBox
1617
import com.intellij.ui.dsl.builder.*
1718
import com.jetbrains.php.config.interpreters.PhpInterpretersManagerImpl
@@ -115,6 +116,12 @@ class MoodleSettingsForm(val project: Project) : PhpFrameworkConfigurable {
115116
optionsConfig.isShowSniffs = true
116117
optionsConfig.codingStandard = "moodle"
117118

119+
// Enable PhpCSValidationInspection
120+
val profileManager = InspectionProjectProfileManager.getInstance(project)
121+
val profile = profileManager.currentProfile
122+
profile.setToolEnabled("PhpCSValidationInspection", true)
123+
LOG.info("Successfully enabled PhpCSValidationInspection")
124+
118125
// Try to set the configuration for phpcs_by_interpreter
119126
try {
120127
manager.markAndSetNewSettings(listOf(configuration))
@@ -135,6 +142,8 @@ class MoodleSettingsForm(val project: Project) : PhpFrameworkConfigurable {
135142
- Coding Standard: moodle
136143
- Show Sniffs: enabled
137144
- Highlight Level: WARNING
145+
- Validation: enabled
146+
- PhpCSValidationInspection: enabled
138147
""".trimIndent(),
139148
NotificationType.INFORMATION
140149
)

0 commit comments

Comments
 (0)