File lsp.py
has 455 lines of code (exceeds 250 allowed). Consider refactoring. Open
# This file is part of HDL Checker.
#
# Copyright (c) 2015 - 2019 suoto (Andre Souto)
#
# HDL Checker is free software: you can redistribute it and/or modify
Function definitions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def definitions(
self, params: TextDocumentPositionParams
) -> Optional[List[Location]]:
"""
Returns known definitions found in the given location
- 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 references
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def references(self, params: ReferenceParams) -> Optional[List[Location]]:
"Tries to find references for the selected element"
element = self.getElementAtPosition(
Path(to_fs_path(params.textDocument.uri)), params.position
- 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 too many return
statements within this function. Open
return locations
Function getDependencyInfoForHover
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def getDependencyInfoForHover(self, dependency):
# type: (BaseDependencySpec) -> str
"""
Report which source defines a given dependency when the user hovers
over its name
- 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 getElementAtPosition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def getElementAtPosition(
self, path: Path, position: Position
) -> Union[BaseDependencySpec, tAnyDesignUnit, None]:
"""
Gets design units and dependencies (in this order) of path and checks
- 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"