intellij-lsp/intellij-lsp-plugin

View on GitHub

Showing 87 of 774 total issues

Function getIconProviderFor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def getIconProviderFor(serverDefinition: LanguageServerDefinition): LSPIconProvider = {
    if (serverDefinition != null) {
      try {
        val providers = LSPIconProvider.EP_NAME.getExtensions.filter(provider => provider.isSpecificFor(serverDefinition))
        if (providers.nonEmpty) providers.head else LSPDefaultIconProvider
Severity: Minor
Found in src/main/scala/com/github/gtache/lsp/utils/GUIUtils.scala - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function invoke has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  override def invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext): Unit = {
    EditorEventManager.forEditor(editor) match {
      case Some(m) =>
        if (editor.getContentComponent.hasFocus) {
          val psiElement = m.getElementAtOffset(editor.getCaretModel.getCurrentCaret.getOffset)

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getPos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private def getPos(e: EditorMouseEvent): LogicalPosition = {
    val mousePos = e.getMouseEvent.getPoint
    val editorPos = editor.xyToLogicalPosition(mousePos)
    val doc = e.getEditor.getDocument
    val maxLines = doc.getLineCount
Severity: Minor
Found in src/main/scala/com/github/gtache/lsp/editor/EditorEventManager.scala - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method addServerDefinition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void addServerDefinition(final UserConfigurableServerDefinition serverDefinition) {
        if (serverDefinition != null) {
            serverDefinitions.put(serverDefinition.ext(), serverDefinition);
            if (serverDefinition.getClass().equals(ArtifactLanguageServerDefinition.class)) {
                final ArtifactLanguageServerDefinition def = (ArtifactLanguageServerDefinition) serverDefinition;
Severity: Minor
Found in src/main/scala/com/github/gtache/lsp/settings/gui/ServersGUI.java - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getEditsRunnable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def getEditsRunnable(version: Int = Int.MaxValue, edits: Iterable[TextEdit], name: String = "Apply LSP edits"): Runnable = {
    if (version >= this.version) {
      val document = editor.getDocument
      if (document.isWritable) {
        () => {
Severity: Minor
Found in src/main/scala/com/github/gtache/lsp/editor/EditorEventManager.scala - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function fromArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fromArray(arr: Array[String]): ArtifactLanguageServerDefinition = {
    if (arr.head == typ) {
      val arrTail = arr.tail
      if (arrTail.length < 3) {
        LOG.warn("Not enough elements to translate into a ServerDefinition : " + arr)

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function checkRepositories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def checkRepositories(repos: Iterable[String], showErrorMessage: Boolean): Boolean = {
    val errMsg: StringBuilder = new StringBuilder(0)
    if (showErrorMessage) {
      repos.foreach(s => {
        val arr = s.split(separator)
Severity: Minor
Found in src/main/scala/com/github/gtache/lsp/utils/coursier/CoursierImpl.scala - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language