kongou-ae/redpen-validator

View on GitHub

Showing 26 of 26 total issues

Function validateSentence has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function validateSentence(sentence) {
    // 参考
    // https://www.jtf.jp/jp/style_guide/pdf/jtf_style_guide.pdf
    // 4.2. 記号
    // カタカナは「全角」で表記します。半角カタカナは特殊な用途を除いて、原則として使いません。
Severity: Minor
Found in symbol.js - About 1 hr to fix

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 validateSentence has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function validateSentence(sentence) {
    // 参考
    // https://www.jtf.jp/jp/style_guide/pdf/jtf_style_guide.pdf
    // 2.2.3. 一部の助数詞の表記
    // 助数詞にともなう「ヵ」、「か」、「カ」、「ヶ」、「ケ」、「箇」、「個」の表記は、原則として、ひらがなの「か」を使います。
Severity: Minor
Found in ka-is-written-in-hiragana.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                            if (
                                sentence.tokens[i+k].tags[0] === terms[j].tokens[k].tags0 &&
                                sentence.tokens[i+k].tags[1] === terms[j].tokens[k].tags1 &&
                                sentence.tokens[i+k].tags[6] === terms[j].tokens[k].tags6
                            ){
    Severity: Major
    Found in dont-use-kosoado.js - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

                  ) return null;
      Severity: Major
      Found in use-numeral-properly.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                if ( sentence.tokens[k].tags[6].match(/十進法|二進法|十六進法/) ) return addError('数を数えられるものは算用数字を利用します' , sentence );
        Severity: Major
        Found in use-numeral-properly.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      ) return null;
          Severity: Major
          Found in use-numeral-properly.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language