Showing 87 of 774 total issues
Function scheduleDocumentation
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private def scheduleDocumentation(time: Long, editorPos: LogicalPosition, point: Point): Unit = {
if (editorPos != null) {
if (time - predTime > SCHEDULE_THRES) {
try {
hoverThread.schedule(new TimerTask {
Function getHoverString
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def getHoverString(@NonNull hover: Hover): String = {
import scala.collection.JavaConverters._
if (hover != null && hover.getContents != null) {
val hoverContents = hover.getContents
if (hoverContents.isLeft) {
Function getEditsRunnable
has 27 lines of code (exceeds 25 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) {
() => {
Function mouseClicked
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mouseClicked(e: EditorMouseEvent): Unit = {
if (isCtrlDown) {
if (ctrlRange == null)
createCtrlRange(DocumentUtils.logicalToLSPPos(editor.xyToLogicalPosition(e.getMouseEvent.getPoint), editor), null)
if (ctrlRange != null) {
Function start
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
override def start(): Unit = {
val serverSocket = new ServerSocket(port)
val socketThread = new Thread(() => {
try
socket = serverSocket.accept
Function canProcessElement
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
override def canProcessElement(element: PsiElement): Boolean = {
element match {
case lsp: LSPPsiElement => true
case file: PsiFile =>
val editorO = FileEditorManager.getInstance(file.getProject).getAllEditors(file.getVirtualFile).collectFirst { case t: TextEditor => t.getEditor }
Function applyEdit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def applyEdit(elem: PsiElement, newName: String, infos: Array[UsageInfo], listener: RefactoringElementListener, openedEditors: Iterable[VirtualFile]): Unit = {
val edits = mutable.Map[String, mutable.ListBuffer[TextEdit]]()
elem match {
case lspElem: LSPPsiElement =>
if (infos.forall(info => info.getElement.isInstanceOf[LSPPsiElement])) {
Constructor has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
class EditorEventManager(val editor: Editor, val mouseListener: EditorMouseListener, val mouseMotionListener: EditorMouseMotionListener,
val documentListener: DocumentListener, val selectionListener: SelectionListener,
val requestManager: RequestManager, val serverOptions: ServerOptions, val wrapper: LanguageServerWrapperImpl) {
Function references
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def references(offset: Int, getOriginalElement: Boolean = false, close: Boolean = false): (Iterable[PsiElement], Iterable[VirtualFile]) = {
val lspPos = DocumentUtils.offsetToLSPPos(editor, offset)
val params = new ReferenceParams(new ReferenceContext(getOriginalElement))
params.setPosition(lspPos)
params.setTextDocument(identifier)
- Read upRead up
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 actionPerformed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
override def actionPerformed(e: AnActionEvent): Unit = {
val editor = e.getData(CommonDataKeys.EDITOR)
val project = e.getData(CommonDataKeys.PROJECT)
if (editor != null) {
val file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument)
- Read upRead up
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 canProcessElement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
override def canProcessElement(element: PsiElement): Boolean = {
element match {
case lsp: LSPPsiElement => true
case file: PsiFile =>
val editorO = FileEditorManager.getInstance(file.getProject).getAllEditors(file.getVirtualFile).collectFirst { case t: TextEditor => t.getEditor }
- Read upRead up
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
Constructor has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
case class LSPNavigationItem(name: String, container: String, project: Project, file: VirtualFile, line: Int, col: Int, icon: Icon = null) extends OpenFileDescriptor(project, file, line, col) with NavigationItem {
Constructor has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
case class ServerOptions(syncKind: TextDocumentSyncKind, completionOptions: CompletionOptions, signatureHelpOptions: SignatureHelpOptions, codeLensOptions: CodeLensOptions, documentOnTypeFormattingOptions: DocumentOnTypeFormattingOptions, documentLinkOptions: DocumentLinkOptions, executeCommandOptions: ExecuteCommandOptions) {
Avoid deeply nested control flow statements. Open
if (ctrlRange != null) ctrlRange.dispose()
Avoid deeply nested control flow statements. Open
if (highlights != null) {
wrapper.notifySuccess(Timeouts.DOC_HIGHLIGHT)
val offset = DocumentUtils.LSPPosToOffset(editor, serverPos)
highlights.asScala.find(dh => DocumentUtils.LSPPosToOffset(editor, dh.getRange.getStart) <= offset
&& offset <= DocumentUtils.LSPPosToOffset(editor, dh.getRange.getEnd)).fold(new Range(serverPos, serverPos))(dh => dh.getRange)
Avoid deeply nested control flow statements. Open
if (!editor.isDisposed) {
try {
val resp = request.get(DOC_HIGHLIGHT_TIMEOUT, TimeUnit.MILLISECONDS)
wrapper.notifySuccess(Timeouts.DOC_HIGHLIGHT)
if (resp != null) {
Method isModified
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean isModified() {
if (serverDefinitions.size() == rows.stream().filter(row -> Arrays.stream(row.toStringArray()).skip(1).anyMatch(s -> s != null && !s.isEmpty())).collect(Collectors.toList()).size()) {
for (final ServersGUIRow row : rows) {
final UserConfigurableServerDefinition stateDef = serverDefinitions.get(row.getText(EXT));
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if (command != null) executeCommands(Iterable(command))
Avoid deeply nested control flow statements. Open
if (inHighlights.isEmpty || isCtrlDown) {
requestAndShowDoc(curTime, editorPos, point)
}
Function findReferences
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
override def findReferences(element: PsiElement, searchInCommentsAndStrings: Boolean): util.Collection[PsiReference] = {
import scala.collection.JavaConverters._
element match {
case lsp: LSPPsiElement => if (elements.contains(lsp)) elements.map(e => e.getReference).asJava else {
EditorEventManager.forEditor(FileUtils.editorFromPsiFile(lsp.getContainingFile)) match {
- Read upRead up
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"