heiglandreas/TextStatistics

View on GitHub

Showing 14 of 35 total issues

Function run has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(t\TokenRegistry $tokens)
    {
        foreach ($tokens as $token) {
            if (! $token instanceof t\WordToken) {
                continue;
Severity: Minor
Found in src/Util/WordsWithNSyllablesOnlyFilter.php - About 3 hrs 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 run has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(t\TokenRegistry $tokens)
    {
        foreach ($tokens as $token) {
            if (! $token instanceof t\WordToken) {
                continue;
Severity: Minor
Found in src/Util/WordsWithNSyllablesFilter.php - About 3 hrs 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 run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(t\TokenRegistry $tokens)
    {
        foreach ($tokens as $token) {
            if (! $token instanceof t\WordToken) {
                continue;
Severity: Minor
Found in src/Util/SyllableFilter.php - About 3 hrs 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

Method run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run(t\TokenRegistry $tokens)
    {
        foreach ($tokens as $token) {
            if (! $token instanceof t\WordToken) {
                continue;
Severity: Minor
Found in src/Util/WordsWithNSyllablesOnlyFilter.php - About 1 hr to fix

    Method run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function run(t\TokenRegistry $tokens)
        {
            foreach ($tokens as $token) {
                if (! $token instanceof t\WordToken) {
                    continue;
    Severity: Minor
    Found in src/Util/WordsWithNSyllablesFilter.php - About 1 hr to fix

      Method run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run(t\TokenRegistry $tokens)
          {
              foreach ($tokens as $token) {
                  if (! $token instanceof t\WordToken) {
                      continue;
      Severity: Minor
      Found in src/Util/SyllableFilter.php - About 1 hr to fix

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

            protected function doConcatenate(t\TokenRegistry $tokens) // @codingStandardsIgnoreLine
            {
                $wordsWithNSyllables = [];
                foreach ($tokens as $token) {
                    if (! $token instanceof t\WordToken) {
        Severity: Minor
        Found in src/Util/WordsWithNSyllablesOnlyFilter.php - About 35 mins 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 doConcatenate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function doConcatenate(t\TokenRegistry $tokens) // @codingStandardsIgnoreLine
            {
                $wordsWithNSyllables = [];
                foreach ($tokens as $token) {
                    if (! $token instanceof t\WordToken) {
        Severity: Minor
        Found in src/Util/WordsWithNSyllablesFilter.php - About 35 mins 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

        Avoid too many return statements within this method.
        Open

                return 'college graduate';
        Severity: Major
        Found in src/Calculator/FleschReadingEaseSchoolGradeCalculator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return 12;
          Severity: Major
          Found in src/Calculator/FleschReadingEaseSchoolGradeCalculator.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return 'college';
            Severity: Major
            Found in src/Calculator/FleschReadingEaseSchoolGradeCalculator.php - About 30 mins to fix

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

                  public function calculate(Text $text)
                  {
                      $fre = $this->fleschReadingEaseCalculator->calculate($text);
              
                      if ($fre > 90) {
              Severity: Minor
              Found in src/Calculator/FleschReadingEaseSchoolGradeCalculator.php - About 25 mins 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 calculate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function calculate(Text $text)
                  {
                      $tokens = $this->tokenizer->tokenize($text->getPlainText());
              
                      $maxSyllables = 0;
              Severity: Minor
              Found in src/Calculator/WordMaxSyllablesCounter.php - About 25 mins 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 doConcatenate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function doConcatenate(t\TokenRegistry $tokens) // @codingStandardsIgnoreLine
                  {
                      $syllables = [];
                      foreach ($tokens as $token) {
                          if (! $token instanceof t\WordToken) {
              Severity: Minor
              Found in src/Util/SyllableFilter.php - About 25 mins 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

              Severity
              Category
              Status
              Source
              Language