cltk/annotations

View on GitHub

Showing 18 of 18 total issues

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

export const scansionStrategy = (
contentBlock: ContentBlock,
callback: Function,
contentState: ContentState
) => {
Severity: Major
Found in src/decorators/GreekProsody.js and 1 other location - About 3 hrs to fix
src/decorators/Annotation.js on lines 10..26

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

export const findNoteEntities = (
contentBlock: ContentBlock,
callback: Function,
contentState: ContentState
) => {
Severity: Major
Found in src/decorators/Annotation.js and 1 other location - About 3 hrs to fix
src/decorators/GreekProsody.js on lines 295..311

File GreekProsody.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
 
import React from 'react'
import type { ContentBlock, ContentState } from 'draft-js'
 
 
Severity: Minor
Found in src/decorators/GreekProsody.js - About 3 hrs to fix

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

    if (diaresis.includes(currentLetter)) {
    const substr = sentence.substring(lastIndex, index + 1)
    const nextEl = [substr, lastIndex, index === 0 ? 1 : index + 1]
     
    lastIndex = index + 1
    Severity: Major
    Found in src/decorators/GreekProsody.js and 2 other locations - About 1 hr to fix
    src/decorators/GreekProsody.js on lines 149..156
    src/decorators/GreekProsody.js on lines 158..165

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

    if (diphthongs.includes(`${currentLetter}${sentence[index + 1]}`)) {
    const substr = sentence.substring(lastIndex, index + 2)
    const nextEl = [substr, lastIndex, index === 0 ? 2 : index + 2]
     
    lastIndex = index + 2
    Severity: Major
    Found in src/decorators/GreekProsody.js and 2 other locations - About 1 hr to fix
    src/decorators/GreekProsody.js on lines 140..147
    src/decorators/GreekProsody.js on lines 158..165

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

    if (vowels.includes(currentLetter)) {
    const substr = sentence.substring(lastIndex, index + 1)
    const nextEl = [substr, lastIndex, index === 0 ? 1 : index + 1]
     
    lastIndex = index + 1
    Severity: Major
    Found in src/decorators/GreekProsody.js and 2 other locations - About 1 hr to fix
    src/decorators/GreekProsody.js on lines 140..147
    src/decorators/GreekProsody.js on lines 149..156

    Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    render() {
    const {
    annotatableEditorState,
    noteEditorState,
    noteEditorReadOnly
    Severity: Minor
    Found in stories/Annotating/index.js - About 1 hr to fix

      Function syllablize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const syllablize = (sentence: string): Array<[
      string,
      number,
      number
      ]> => {
      Severity: Minor
      Found in src/decorators/GreekProsody.js - About 1 hr to fix

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

        export const argonautica = `εἰ δ᾽ ἄγε νῦν, Ἐρατώ, παρά θ᾽ ἵστασο, καί μοι ἔνισπε,
        ἔνθεν ὅπως ἐς Ἰωλκὸν ἀνήγαγε κῶας Ἰήσων
        Μηδείης ὑπ᾽ ἔρωτι. σὺ γὰρ καὶ Κύπριδος αἶσαν
        ἔμμορες, ἀδμῆτας δὲ τεοῖς μελεδήμασι θέλγεις
        παρθενικάς: τῶ καί τοι ἐπήρατον οὔνομ᾽ ἀνῆπται.
        Severity: Major
        Found in stories/stubs.js and 1 other location - About 1 hr to fix
        stories/stubs.js on lines 3..46

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

        export const nicomachea = `[1447α] [8]
        περὶ ποιητικῆς αὐτῆς τε καὶ τῶν εἰδῶν αὐτῆς, ἥν τινα δύναμιν ἕκαστον ἔχει, καὶ
        πῶς δεῖ συνίστασθαι τοὺς μύθους [10] εἰ μέλλει καλῶς ἕξειν ἡ ποίησις, ἔτι δὲ ἐκ
        πόσων καὶ ποίων ἐστὶ μορίων, ὁμοίως δὲ καὶ περὶ τῶν ἄλλων ὅσα τῆς αὐτῆς ἐστι
        μεθόδου, λέγωμεν ἀρξάμενοι κατὰ φύσιν πρῶτον ἀπὸ τῶν πρώτων.
        Severity: Major
        Found in stories/stubs.js and 1 other location - About 1 hr to fix
        stories/stubs.js on lines 48..83

        Avoid too many return statements within this function.
        Open

        return false
        Severity: Major
        Found in src/decorators/GreekProsody.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

          return syllables
          Severity: Major
          Found in src/decorators/GreekProsody.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

            return syllables
            Severity: Major
            Found in src/decorators/GreekProsody.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

              return [...syllables, nextEl]
              Severity: Major
              Found in src/decorators/GreekProsody.js - About 30 mins to fix

                Function isLongByPosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                export const isLongByPosition = (syllable: string, nextSyllable: string): boolean => {
                if (!nextSyllable) {
                return false
                }
                 
                 
                Severity: Minor
                Found in src/decorators/GreekProsody.js - About 25 mins to fix

                Extra semicolon.
                Open

                import { configure } from 'enzyme';
                Severity: Minor
                Found in testSetup.js by eslint

                Extra semicolon.
                Open

                import Adapter from 'enzyme-adapter-react-16';
                Severity: Minor
                Found in testSetup.js by eslint

                Extra semicolon.
                Open

                configure({ adapter: new Adapter() });
                Severity: Minor
                Found in testSetup.js by eslint
                Severity
                Category
                Status
                Source
                Language