Skip to content

Commit dbf7095

Browse files
LtdJorgeSJrX
authored andcommitted
fix: Don't warn if notify-reload is used as a Type= in service.
* Adds notify-reload service Type Fixes #263 * Update test InvalidValueInspectionForEnumOptionValueTests.kt with notify-reload service Type * Adds notify-reload to completion test for service Type=o... * Update PidFileOptionWarning.kt annotation msg to reflect current systemd docs While searching for "notify" throughout the repo to add notify-reload support, I noticed this message which mentioned notify and notify-release. This might be from a previous version of systemd, but the docs now mention notify-reload instead of notify-release, so I updated it to be consistent with the addition of notify-release mode to the plugin.
1 parent ff22f3f commit dbf7095

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/annotators/PidFileOptionWarning.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class PidFileOptionWarning : Annotator {
2020
}
2121

2222
companion object {
23-
const val ANNOTATION_ERROR_MSG = "PID files should be avoided in modern projects. Use type=notify, Type=notify-release or Type=simple where possible, which does not require use of PID files to determine the main process of a service and avoids needless forking."
23+
const val ANNOTATION_ERROR_MSG = "PID files should be avoided in modern projects. Use Type=notify, Type=notify-reload or Type=simple where possible, which does not require use of PID files to determine the main process of a service and avoids needless forking."
2424
}
2525
}

src/main/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/semanticdata/optionvalues/EnumOptionValues.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RestartOptionValue : AbstractEnumOptionValue(validOptions, VALIDATOR_NAME)
4040
class ServiceTypeOptionValue : AbstractEnumOptionValue(validOptions, VALIDATOR_NAME) {
4141

4242
companion object {
43-
private val validOptions: Set<String> = ImmutableSet.of("simple", "forking", "oneshot", "dbus", "notify", "idle", "exec")
43+
private val validOptions: Set<String> = ImmutableSet.of("simple", "forking", "oneshot", "dbus", "notify", "notify-reload", "idle", "exec")
4444
const val VALIDATOR_NAME = "config_parse_service_type"
4545
}
4646
}

src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/completion/UnitFileValueCompletionContributorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class UnitFileValueCompletionContributorTest : AbstractUnitFileTest() {
9292
val completions = basicCompletionResultStrings
9393

9494
// Verification
95-
assertContainsElements(completions, "forking", "oneshot", "notify")
95+
assertContainsElements(completions, "forking", "oneshot", "notify", "notify-reload")
9696
}
9797

9898
fun testCompletionOfUnitDependencyIncludesUnitsInFilename() {

src/test/kotlin/net/sjrx/intellij/plugins/systemdunitfiles/inspections/InvalidValueInspectionForEnumOptionValueTests.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ class InvalidValueInspectionForServiceTypeOptionValues : AbstractUnitFileTest()
380380
Type=oneshot
381381
Type=dbus
382382
Type=notify
383+
Type=notify-reload
383384
Type=idle
384385
Type=exec
385386
@@ -423,6 +424,7 @@ class InvalidValueInspectionForServiceTypeOptionValues : AbstractUnitFileTest()
423424
assertStringContains("oneshot", info.description)
424425
assertStringContains("dbus", info.description)
425426
assertStringContains("notify", info.description)
427+
assertStringContains("notify-reload", info.description)
426428
assertStringContains("idle", info.description)
427429
assertStringContains("exec", info.description)
428430
TestCase.assertEquals(HighlightInfoType.WARNING, info.type)
@@ -453,6 +455,7 @@ class InvalidValueInspectionForServiceTypeOptionValues : AbstractUnitFileTest()
453455
assertStringContains("oneshot", info.description)
454456
assertStringContains("dbus", info.description)
455457
assertStringContains("notify", info.description)
458+
assertStringContains("notify-reload", info.description)
456459
assertStringContains("idle", info.description)
457460
assertStringContains("exec", info.description)
458461
TestCase.assertEquals(HighlightInfoType.WARNING, info.type)

0 commit comments

Comments
 (0)