Showing 87 of 774 total issues
Function documentChanged
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def documentChanged(event: DocumentEvent): Unit = {
if (!editor.isDisposed) {
if (event.getDocument == editor.getDocument) {
predTime = System.nanoTime() //So that there are no hover events while typing
changesParams.getTextDocument.setVersion({
- 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
val oldTextLength = if (oldLines.isEmpty) 0 else oldLines.last.length
Avoid deeply nested control flow statements. Open
if (syncOptions != null) {
if (syncOptions.isRight) syncKind = syncOptions.getRight.getChange
else if (syncOptions.isLeft) syncKind = syncOptions.getLeft
val mouseListener = new EditorMouseListenerImpl
val mouseMotionListener = new EditorMouseMotionListenerImpl
Avoid deeply nested control flow statements. Open
val column = if (oldLines.length == 1) startColumn + oldTextLength else oldTextLength
Function replace
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def replace[T](key: Key[T], @Nullable oldValue: T, @Nullable newValue: T): Boolean = {
while (true) {
val map = getUserMap
if (map.get(key) != oldValue) {
return false
- 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 (currentHint != null) currentHint.hide()
Avoid deeply nested control flow statements. Open
invokeLater(() => if (!editor.isDisposed) currentHint = createAndShowEditorHint(editor, string, point, flags = HintManager.HIDE_BY_OTHER_HINT))
Avoid deeply nested control flow statements. Open
val syncOptions: Either[TextDocumentSyncKind, TextDocumentSyncOptions] = if (capabilities == null) null else capabilities.getTextDocumentSync
Consider simplifying this complex logical expression. Open
if (curTime - predTime > HOVER_TIME_THRES && mouseInEditor && editor.getContentComponent.hasFocus && (!isKeyPressed || isCtrlDown)) {
val editorOffset = computableReadAction[Int](() => editor.logicalPositionToOffset(editorPos))
val inHighlights = diagnosticsHighlights.filter(diag =>
diag.rangeHighlighter.getStartOffset <= editorOffset &&
editorOffset <= diag.rangeHighlighter.getEndOffset)
Constructor has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
case class LSPPsiElement(var name: String, project: Project, start: Int, end: Int, file: PsiFile) extends PsiNameIdentifierOwner with NavigatablePsiElement {
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] = {
Method applyEdit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def applyEdit(elem: PsiElement, newName: String, infos: Array[UsageInfo], listener: RefactoringElementListener, openedEditors: Iterable[VirtualFile]): Unit = {
Method createAndShowEditorHint
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def createAndShowEditorHint(editor: Editor, string: String, point: Point, constraint: Short = HintManager.ABOVE,
flags: Int = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING): Hint = {
Function maySaveDocument
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
override def maySaveDocument(document: Document, isSaveExplicit: Boolean): Boolean = {
EditorEventManager.forUri(FileUtils.documentToUri(document)) match {
case Some(m) =>
if (m.needSave) {
m.needSave = false
- 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 crashed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
override def crashed(e: Exception): Unit = {
crashCount += 1
if (crashCount < 2) {
val editors = connectedEditors.clone().toMap.keys
stop()
- 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 createCtrlRange
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private def createCtrlRange(serverPos: Position, range: Range): Unit = {
val loc = requestDefinition(serverPos)
if (loc != null) {
if (!editor.isDisposed) {
val corRange = if (range == null) {
- 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 fromArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
override def fromArray(arr: Array[String]): ExeLanguageServerDefinition = {
if (arr.head == typ) {
val arrTail = arr.tail
if (arrTail.length < 2) {
LOG.warn("Not enough elements to translate into a ServerDefinition : " + arr)
- 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 requestDefinition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private def requestDefinition(position: Position): Location = {
val params = new TextDocumentPositionParams(identifier, position)
val request = requestManager.definition(params)
if (request != null) {
try {
- 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 fromArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
override def fromArray(arr: Array[String]): CommandServerDefinition = {
if (arr.head == typ) {
val arrTail = arr.tail
if (arrTail.length > 1) {
RawCommandServerDefinition(arrTail.head, arrTail.tail)
- 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 documentReferences
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def documentReferences(offset: Int): Iterable[(Int, Int)] = {
val params = new ReferenceParams()
val context = new ReferenceContext()
context.setIncludeDeclaration(true)
params.setContext(context)
- 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"