tools/license2rtf.js

Summary

Maintainability
D
2 days
Test Coverage

Function ParagraphParser has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

function ParagraphParser() {
  var self = this,
      block_is_license_block = false,
      block_has_c_style_comment,
      is_first_line_in_paragraph,
Severity: Minor
Found in tools/license2rtf.js - About 5 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 ParagraphParser has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ParagraphParser() {
  var self = this,
      block_is_license_block = false,
      block_has_c_style_comment,
      is_first_line_in_paragraph,
Severity: Major
Found in tools/license2rtf.js - About 3 hrs to fix

    Function RtfGenerator has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    function RtfGenerator() {
      var self = this,
          did_write_anything = false;
    
      Stream.call(this);
    Severity: Minor
    Found in tools/license2rtf.js - 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 RtfGenerator has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function RtfGenerator() {
      var self = this,
          did_write_anything = false;
    
      Stream.call(this);
    Severity: Major
    Found in tools/license2rtf.js - About 2 hrs to fix

      Function Unwrapper has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      function Unwrapper() {
        var self = this;
      
        Stream.call(this);
        this.writable = true;
      Severity: Minor
      Found in tools/license2rtf.js - About 2 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 parseLine has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function parseLine(line) {
          // Strip trailing whitespace
          line = line.replace(/\s*$/, '');
      
          // Detect block separator
      Severity: Minor
      Found in tools/license2rtf.js - About 1 hr to fix

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

        function Unwrapper() {
          var self = this;
        
          Stream.call(this);
          this.writable = true;
        Severity: Minor
        Found in tools/license2rtf.js - About 1 hr to fix

          Function write has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.write = function(paragraph) {
              if (!did_write_anything) {
                emitHeader();
                did_write_anything = true;
              }
          Severity: Minor
          Found in tools/license2rtf.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status