Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLuMaye committed May 2, 2024
1 parent cd701c6 commit 14cc337
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
insert_final_newline = true

[*.kt*]
ktlint_code_style = intellij_idea
ktlint_standard_no-empty-first-line-in-method-block = disabled
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ val String.isReleaseBuild
val Project.releaseRepositoryUrl: String
get() = properties.getOrDefault(
"RELEASE_REPOSITORY_URL",
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
"https://oss.sonatype.org/service/local/staging/deploy/maven2",
).toString()

val Project.snapshotRepositoryUrl: String
get() = properties.getOrDefault(
"SNAPSHOT_REPOSITORY_URL",
"https://oss.sonatype.org/content/repositories/snapshots"
"https://oss.sonatype.org/content/repositories/snapshots",
).toString()

val Project.repositoryUsername: String
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/com/pkware/ahocorasick/AhoCorasickBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public abstract class AhoCorasickBase<T> @JvmOverloads constructor(options: Set<
private fun handleBaseOffsetConflict(
originalParentIndex: Int,
encroachingParentIndex: Int,
wantedInsertion: Int
wantedInsertion: Int,
): Int {

val originalChildren = determineChildOffsets(originalParentIndex, childrenOffsetStore1)
Expand Down Expand Up @@ -593,7 +593,7 @@ public abstract class AhoCorasickBase<T> @JvmOverloads constructor(options: Set<
toMoveParent,
store.getValue(previousChildIndex),
store.getNextSiblingOffset(previousChildIndex),
store.getChildOffset(previousChildIndex)
store.getChildOffset(previousChildIndex),
)

// Indicate the previously used space can now be used.
Expand Down Expand Up @@ -656,9 +656,10 @@ public abstract class AhoCorasickBase<T> @JvmOverloads constructor(options: Set<
index,
RESERVED_VALUE,
parentIndex,
RESERVED_VALUE, // If this node corresponds to the end of a key, the correct value is set later on.
// If this node corresponds to the end of a key, the correct value is set later on.
RESERVED_VALUE,
siblingOffset,
RESERVED_VALUE
RESERVED_VALUE,
)
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/kotlin/com/pkware/ahocorasick/AhoCorasickTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AhoCorasickTest {
@ParameterizedTest
@MethodSource("emptyAhoCorasickStructures")
internal fun `throws error when objects are added after built has been called`(
ahoCorasick: StringAhoCorasickWrapper
ahoCorasick: StringAhoCorasickWrapper,
) {
ahoCorasick.build()
assertThrows<IllegalStateException> { ahoCorasick.addString("value") }
Expand All @@ -93,7 +93,7 @@ class AhoCorasickTest {
@ParameterizedTest
@MethodSource("emptyAhoCorasickStructures")
internal fun `words are found in ascending order by ending position, and descending size from same position`(
ahoCorasick: StringAhoCorasickWrapper
ahoCorasick: StringAhoCorasickWrapper,
) {
ahoCorasick.buildWith("cat", "at", "catapult", "tap", "a", "t")

Expand Down Expand Up @@ -151,7 +151,7 @@ class AhoCorasickTest {
ahoCorasick.buildWith("Expected", "Double Expected", "Exp")

val results = ahoCorasick.wrappedAhoCorasick.parse(
"Double Expected\tnotExpected notDouble\rExpected Expected\nExpectedNot Exp"
"Double Expected\tnotExpected notDouble\rExpected Expected\nExpectedNot Exp",
).map { it.start }.toList()

assertThat(results).containsExactly(0, 7, 38, 47, 68)
Expand Down Expand Up @@ -211,7 +211,7 @@ class AhoCorasickTest {
@ParameterizedTest
@MethodSource("emptyAhoCorasickStructures")
internal fun `offset greater than length of double array is handled while building`(
ahoCorasick: StringAhoCorasickWrapper
ahoCorasick: StringAhoCorasickWrapper,
) {
// The below setup would cause an index out of bounds exception if one did not safely get the value at an index.
ahoCorasick.addString("cab")
Expand Down

0 comments on commit 14cc337

Please sign in to comment.