Showing 43 of 1,811 total issues
Function transform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
transform(node: HTMLDivElement) {
const heading = node.querySelector<HTMLElement>(
'.abt-bibliography__heading',
);
const body = node.querySelector<HTMLElement>(
- 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 stripListItem
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function stripListItem(item: Element | string): string {
if (typeof item === 'string') {
const container = document.createElement('div');
container.innerHTML = item;
const child = container.querySelector('.csl-entry');
- 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 sidebar
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function sidebar(
state = SIDEBAR_INITIAL_STATE,
action: Action,
): State['sidebar'] {
switch (action.type) {
Function getSortedItems
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getSortedItems(
state: State,
mode: 'date' | 'publication' | 'title' = 'title',
order: 'asc' | 'desc' = 'asc',
kind?: 'cited' | 'uncited',
Function parseCSL
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function parseCSL(file: File): Promise<Style> {
const content = await readFile(file);
const xml = new DOMParser().parseFromString(content, 'application/xml');
const error = xml.querySelector('parsererror');
const label = xml.querySelector('info title');
Function setFootnotes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function* setFootnotes() {
const items = select('abt/data').getFootnotes();
const blocksList = select('core/block-editor').getBlocks();
const footnoteBlockIndex = blocksList.findIndex(
({ name }) => name === 'abt/footnotes',
Function stripListItem
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function stripListItem(item: Element | string): string {
if (typeof item === 'string') {
const container = document.createElement('div');
container.innerHTML = item;
const child = container.querySelector('.csl-entry');
Function references
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function references(
state = INITIAL_STATE.references,
action: Action,
): State['references'] {
switch (action.type) {
Method inject_author_meta
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function inject_author_meta() {
global $post;
if ( ! $post || ! is_singular() ) {
return;
}
Function removeReferences
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function* removeReferences(itemIds: string[]) {
const doc = getEditorDOM();
const toDelete = [
...doc.querySelectorAll<HTMLSpanElement>(CitationElement.selector),
].reduce(
Method render_options_page
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function render_options_page() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die(
esc_html__(
'You do not have sufficient permissions to access this page.',
Function AddReferenceDialog
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function AddReferenceDialog() {
const { addReference } = useDispatch('abt/data');
const [isOpen, setIsOpen] = useState(false);
const toggleDialog = () => setIsOpen(!isOpen);
return (
Function updateEditorCitations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function* updateEditorCitations(citations: Processor.CitationMeta[]) {
const doc = getEditorDOM();
for (const { html, id, sortedItems } of citations) {
const node = doc.querySelector<HTMLElement>(
createSelector(
Function iterate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function* iterate(
{ formats = [] }: Value,
formatType?: string,
): IterableIterator<Format> {
for (const fmts of formats) {
- 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 init_editor_state
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function init_editor_state( int $post_id ) {
$meta = get_post_meta( $post_id );
if ( ! array_key_exists( '_abt_state', $meta ) || ! has_blocks( $post_id ) ) {
$state = (object) [
- 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 parseCSL
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function parseCSL(file: File): Promise<Style> {
const content = await readFile(file);
const xml = new DOMParser().parseFromString(content, 'application/xml');
const error = xml.querySelector('parsererror');
const label = xml.querySelector('info title');
- 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 neighbors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dir: 'left' | 'right',
idx: number,
val: Value,
type: string,
located: Format[] = [],
Function inject_author_meta
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function inject_author_meta() {
global $post;
if ( ! $post || ! is_singular() ) {
return;
}
- 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 parseCSL
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function parseCSL(
filepath: string,
isIndependent: boolean,
): Promise<Style[]> {
const xml = await readfile(filepath, { encoding: 'utf-8' });
- 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 updateEditorCitations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function* updateEditorCitations(citations: Processor.CitationMeta[]) {
const doc = getEditorDOM();
for (const { html, id, sortedItems } of citations) {
const node = doc.querySelector<HTMLElement>(
createSelector(
- 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"