intellij-lsp/intellij-lsp-plugin

View on GitHub
src/main/scala/com/github/gtache/lsp/PluginMain.scala

Summary

Maintainability
A
3 hrs
Test Coverage
F
0%

Function editorOpened has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def editorOpened(editor: Editor): Unit = {
    if (!loadedExtensions) {
      val extensions = LanguageServerDefinition.getAllDefinitions.filter(s => !extToServerDefinition.contains(s.ext))
      LOG.info("Added serverDefinitions " + extensions + " from plugins")
      extToServerDefinition = extToServerDefinition ++ extensions.map(s => (s.ext, s))
Severity: Minor
Found in src/main/scala/com/github/gtache/lsp/PluginMain.scala - About 1 hr to fix

    Function workspaceSymbols has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def workspaceSymbols(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean = false, onlyKind: Set[SymbolKind] = Set()): Array[NavigationItem] = {
        projectToLanguageWrappers.get(FileUtils.pathToUri(project.getBasePath)) match {
          case Some(set) =>
            val params: WorkspaceSymbolParams = new WorkspaceSymbolParams(name)
            val servDefToReq = set.collect {
    Severity: Minor
    Found in src/main/scala/com/github/gtache/lsp/PluginMain.scala - About 1 hr to fix

      Method workspaceSymbols has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def workspaceSymbols(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean = false, onlyKind: Set[SymbolKind] = Set()): Array[NavigationItem] = {
      Severity: Minor
      Found in src/main/scala/com/github/gtache/lsp/PluginMain.scala - About 35 mins to fix

        File line length exceeds 160 characters
        Open

              val openedEditors: Iterable[Editor] = ApplicationUtils.computableReadAction(() => ProjectManager.getInstance().getOpenProjects.flatMap(proj => FileEditorManager.getInstance(proj).getAllEditors()).collect { case t: TextEditor => t.getEditor })

        File line length exceeds 160 characters
        Open

          def workspaceSymbols(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean = false, onlyKind: Set[SymbolKind] = Set()): Array[NavigationItem] = {

        Avoid using null
        Open

                      case null =>

        Avoid using null
        Open

                        .filter(s => if (onlyKind.isEmpty) true else onlyKind.contains(s.getKind)) else null)

        Avoid wildcard imports
        Open

            import scala.collection.JavaConverters._

        If block needs braces
        Open

                if (!servDefToReq.contains(null)) {

        Avoid using null
        Open

                        null

        Avoid using null
        Open

                if (!servDefToReq.contains(null)) {

        Avoid wildcard imports
        Open

        import org.eclipse.lsp4j._

        Avoid wildcard imports
        Open

            import scala.collection.JavaConverters._

        Avoid wildcard imports
        Open

                  import scala.collection.JavaConverters._

        Avoid wildcard imports
        Open

          import PluginMain._

        The string literal " is null" appears 3 times in the file.
        Open

            nullDef.foreach(ext => LOG.error("Definition for " + ext + " is null"))

        If block needs braces
        Open

                      (w._1, if (symbols != null) symbols.asScala

        Imports should be grouped together
        Open

          import PluginMain._

        Imports should be grouped together
        Open

            import scala.collection.JavaConverters._

        Imports should be grouped together
        Open

                  import scala.collection.JavaConverters._

        Imports should be grouped together
        Open

            import scala.collection.JavaConverters._

        There are no issues that match your filters.

        Category
        Status