packages/core/src/middleware/inline.ts
Function inline
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
Open
export const inline = (
options: InlineOptions | Derivable<InlineOptions> = {},
): Middleware => ({
name: 'inline',
options,
- Read upRead up
- Create a ticketCreate a ticket
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 fn
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async fn(state) {
const {placement, elements, rects, platform, strategy} = state;
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
// ClientRect's bounds, despite the event listener being triggered. A
// padding of 2 seems to handle this issue.
- Create a ticketCreate a ticket
Function getBoundingClientRect
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getBoundingClientRect() {
// There are two rects and they are disjoined.
if (
clientRects.length === 2 &&
clientRects[0].left > clientRects[1].right &&
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
Open
if (
clientRects.length === 2 &&
clientRects[0].left > clientRects[1].right &&
x != null &&
y != null
- Create a ticketCreate a ticket