Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typos ci #614

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# yamllint disable rule:line-length
name: check_typos

on: # yamllint disable-line rule:truthy
push:
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: typos-action
uses: crate-ci/[email protected]
7 changes: 7 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[files]
extend-exclude = ["server/src/test/resources/completions/*.kt"]

[default.extend-words]
ba = "ba"
vertx = "vertx"
nd = "nd"
2 changes: 1 addition & 1 deletion detekt_baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ID>EmptyClassBlock:samefile.kt$MyImplClass${}</ID>
<ID>EmptyClassBlock:samefile.kt$NullClass${}</ID>
<ID>EmptyClassBlock:samefile.kt$PrintableClass${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyComperable${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyComparable${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyList${}</ID>
<ID>EmptyClassBlock:standardlib.kt$MyThread${}</ID>
<ID>EmptyDefaultConstructor:BigFile.kt$BigFile.A$()</ID>
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/kotlin/org/javacs/kt/compiler/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private class CompilationEnvironment(
"org.gradle.api.tasks.testing.*",
"org.gradle.api.tasks.testing.junit.*",
"org.gradle.api.tasks.testing.junitplatform.*",
"org.gradle.api.tasks.testing.testng.*",
"org.gradle.api.tasks.testing.testing.*",
"org.gradle.api.tasks.util.*",
"org.gradle.api.tasks.wrapper.*",
"org.gradle.authentication.*",
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/kotlin/org/javacs/kt/formatting/Formatter.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.javacs.kt.formatting

import org.eclipse.lsp4j.FormattingOptions as LspFromattingOptions
import org.eclipse.lsp4j.FormattingOptions as LspFormattingOptions

interface Formatter {
fun format(code: String, options: LspFromattingOptions): String
fun format(code: String, options: LspFormattingOptions): String
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.javacs.kt.formatting

import org.javacs.kt.Configuration
import org.javacs.kt.FormattingConfiguration
import org.eclipse.lsp4j.FormattingOptions as LspFromattingOptions
import org.eclipse.lsp4j.FormattingOptions as LspFormattingOptions

private const val DEFAULT_INDENT = 4

Expand All @@ -16,6 +16,6 @@ class FormattingService(private val config: FormattingConfiguration) {

fun formatKotlinCode(
code: String,
options: LspFromattingOptions = LspFromattingOptions(DEFAULT_INDENT, true)
options: LspFormattingOptions = LspFormattingOptions(DEFAULT_INDENT, true)
): String = this.formatter.format(code, options)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.jetbrains.kotlin.descriptors.*

object ExtractSymbolVisibility : DeclarationDescriptorVisitor<Symbol.Visibility, Unit> {
private fun convert(visibility: DescriptorVisibility): Symbol.Visibility = when (visibility.delegate) {
Visibilities.PrivateToThis -> Symbol.Visibility.PRIAVTE_TO_THIS
Visibilities.PrivateToThis -> Symbol.Visibility.PRIVATE_TO_THIS
Visibilities.Private -> Symbol.Visibility.PRIVATE
Visibilities.Internal -> Symbol.Visibility.INTERNAL
Visibilities.Protected -> Symbol.Visibility.PROTECTED
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/kotlin/org/javacs/kt/index/Symbol.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data class Symbol(
}

enum class Visibility(val rawValue: Int) {
PRIAVTE_TO_THIS(0),
PRIVATE_TO_THIS(0),
PRIVATE(1),
INTERNAL(2),
PROTECTED(3),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private fun declarationHint(
) {
if (!config.typeHints) return

//check decleration does not include type i.e. var t1: String
//check declaration does not include type i.e. var t1: String
if (node.typeReference != null) return

val hint = node.hintBuilder(InlayKind.TypeHint, file) ?: return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private fun getUnimplementedMembersStubs(file: CompiledFile, kotlinClass: KtClas
.getContributedDescriptors()
.filter { classMember ->
classMember is MemberDescriptor &&
classMember.canBeOverriden() &&
classMember.canBeOverridden() &&
!overridesDeclaration(kotlinClass, classMember)
}
.mapNotNull { member ->
Expand All @@ -111,7 +111,7 @@ private fun ClassDescriptor.canBeExtended() = this.kind.isInterface ||
this.modality == Modality.ABSTRACT ||
this.modality == Modality.OPEN

private fun MemberDescriptor.canBeOverriden() = (Modality.ABSTRACT == this.modality || Modality.OPEN == this.modality) && Modality.FINAL != this.modality && this.visibility != DescriptorVisibilities.PRIVATE && this.visibility != DescriptorVisibilities.PROTECTED
private fun MemberDescriptor.canBeOverridden() = (Modality.ABSTRACT == this.modality || Modality.OPEN == this.modality) && Modality.FINAL != this.modality && this.visibility != DescriptorVisibilities.PRIVATE && this.visibility != DescriptorVisibilities.PROTECTED

// interfaces are ClassDescriptors by default. When calling AbstractClass super methods, we get a ClassConstructorDescriptor
fun getClassDescriptor(descriptor: DeclarationDescriptor?): ClassDescriptor? =
Expand Down
2 changes: 1 addition & 1 deletion server/src/test/kotlin/org/javacs/kt/ReferencesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test

class ReferencesTest : SingleFileTestFixture("references", "ReferenceTo.kt") {
@Test fun `find referencs to foo`() {
@Test fun `find references to foo`() {
val request = referenceParams(file, 2, 11)
val references = languageServer.textDocumentService.references(request).get()
val referenceStrs = references?.map { it.toString() }
Expand Down
2 changes: 1 addition & 1 deletion server/src/test/resources/quickfixes/samefile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class NullClass : NullMethodAndReturn<String> {}

abstract class MyAbstract {
val otherValToTestAbstractOverride = 1

abstract val name: String

abstract fun myFun()
Expand Down
2 changes: 1 addition & 1 deletion server/src/test/resources/quickfixes/standardlib.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import java.util.Comparator

class MyThread : Runnable {}

class MyComperable : Comparator<String> {}
class MyComparable : Comparator<String> {}

class MyList : AbstractList<String>() {}