dsifford/academic-bloggers-toolkit

View on GitHub

Showing 1,811 of 1,811 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if (node.firstElementChild) {
node.dataset.hasChildren = 'true';
node.firstElementChild.innerHTML =
ZERO_WIDTH_SPACE +
node.firstElementChild.innerHTML +
Severity: Minor
Found in src/js/gutenberg/formats/citation/citation.tsx and 1 other location - About 45 mins to fix
src/js/stores/data/actions.ts on lines 210..219

Function neighbors has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

dir: 'left' | 'right',
idx: number,
val: Value,
type: string,
located: Format[] = [],
Severity: Minor
Found in src/js/utils/formats.ts - About 35 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    {
    icon: 'editor-ol',
    title: __(
    'Convert to ordered list',
    'academic-bloggers-toolkit',
    Severity: Minor
    Found in src/js/gutenberg/blocks/static-bibliography/edit.tsx and 1 other location - About 35 mins to fix
    src/js/gutenberg/blocks/static-bibliography/edit.tsx on lines 66..76

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    {
    icon: 'editor-ul',
    title: __(
    'Convert to unordered list',
    'academic-bloggers-toolkit',
    Severity: Minor
    Found in src/js/gutenberg/blocks/static-bibliography/edit.tsx and 1 other location - About 35 mins to fix
    src/js/gutenberg/blocks/static-bibliography/edit.tsx on lines 77..87

    Function StyleForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function StyleForm() {
    const [style, setStyle] = useState(SAVED_STYLE);
    const [errorMessage, setErrorMessage] = useState('');
     
    return (
    Severity: Minor
    Found in src/js/options-page/style-form.tsx - About 35 mins to fix

    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(
    Severity: Minor
    Found in src/js/stores/data/actions.ts - About 35 mins to fix

    Expected 0 spaces before closing bracket; 1 found
    Open

    if ( plugin_basename( __FILE__ ) === $file ) {

    Expected 0 spaces between opening bracket and type hint "array"; 1 found
    Open

    function add_options_link( array $links ): array {

    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;
    }
    Severity: Minor
    Found in src/php/frontend.php - About 35 mins to fix

    Expected 1 space after FUNCTION keyword; 0 found
    Open

    'auth_callback' => function() {
    Severity: Minor
    Found in src/php/editor.php by phpcodesniffer

    Expected 0 spaces between opening bracket and type hint "int"; 1 found
    Open

    function init_editor_state( int $post_id ) {
    Severity: Minor
    Found in src/php/editor.php by phpcodesniffer

    Expected 0 spaces before closing bracket; 1 found
    Open

    if ( version_compare( ABT_VERSION, $options['VERSION'] ?? '0', '>' ) ) {

    Expected 0 spaces between argument "$links" and closing bracket; 1 found
    Open

    function add_options_link( array $links ): array {

    Expected 0 spaces between argument "$post_id" and closing bracket; 1 found
    Open

    function init_editor_state( int $post_id ) {
    Severity: Minor
    Found in src/php/editor.php by phpcodesniffer

    Expected 0 spaces between opening bracket and type hint "array"; 1 found
    Open

    function add_donate_link( array $links, string $file ): array {

    Expected 0 spaces between argument "$file" and closing bracket; 1 found
    Open

    function add_donate_link( array $links, string $file ): array {

    Expected 0 spaces before closing bracket; 1 found
    Open

    if ( ! array_key_exists( '_abt_state', $meta ) || ! has_blocks( $post_id ) ) {
    Severity: Minor
    Found in src/php/editor.php by phpcodesniffer

    Function ReferenceFormManual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function ReferenceFormManual(props: Props) {
    const [errorMessage, setErrorMessage] = useState('');
    const [data, setData] = useState<CSL.Data>({
    id: '',
    type: 'webpage',
    Severity: Minor
    Found in src/js/gutenberg/components/reference-form-manual/index.tsx - About 35 mins to fix

    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' });
    Severity: Minor
    Found in scripts/update-styles.ts - About 35 mins to fix

    Space found before closing bracket of FOREACH loop
    Open

    foreach ( $legacy_meta->CSL as $id => $data ) { // phpcs:ignore
    Severity: Minor
    Found in src/php/editor.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language