attester/attester

View on GitHub
lib/test-type/aria-templates/at-file-reader.js

Summary

Maintainability
C
1 day
Test Coverage

Function readATNewFileContent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function readATNewFileContent(res, fileContent, fileName) {
    var foundClassDef = null;
    var walker = new UglifyJS.TreeWalker(function (node) {
        var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
        if (!isAssignment) return;
Severity: Minor
Found in lib/test-type/aria-templates/at-file-reader.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 readATNewFileContent has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function readATNewFileContent(res, fileContent, fileName) {
    var foundClassDef = null;
    var walker = new UglifyJS.TreeWalker(function (node) {
        var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
        if (!isAssignment) return;
Severity: Major
Found in lib/test-type/aria-templates/at-file-reader.js - About 2 hrs to fix

    Function readATOldFileContent has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function readATOldFileContent(res, fileContent, fileName) {
        var classDef = null;
        var classDefinitionCalls = 0;
        var sandbox = {
            aria: {
    Severity: Minor
    Found in lib/test-type/aria-templates/at-file-reader.js - About 1 hr to fix

      Function walker has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var walker = new UglifyJS.TreeWalker(function (node) {
              var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
              if (!isAssignment) return;
              var moduleExports = node.left;
              var isDotExports = moduleExports instanceof UglifyJS.AST_Dot && moduleExports.property == "exports";
      Severity: Minor
      Found in lib/test-type/aria-templates/at-file-reader.js - About 1 hr to fix

        Function readRequire has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        function readRequire(expression) {
            if (expression instanceof UglifyJS.AST_Call && expression.args.length == 1) {
                var requireVar = expression.expression;
                if (requireVar instanceof UglifyJS.AST_SymbolRef && requireVar.name == "require" && requireVar.thedef.undeclared) {
                    var param = expression.args[0];
        Severity: Minor
        Found in lib/test-type/aria-templates/at-file-reader.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

        Avoid too many return statements within this function.
        Open

                if (!isDotClassDefinition) return;
        Severity: Major
        Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  if (!isObjectLitteral) return;
          Severity: Major
          Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return;
            Severity: Major
            Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      if (!(ariaRef && /^aria(templates)?\/Aria(\.js)?$/.test(ariaRef))) return;
              Severity: Major
              Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return true;
                Severity: Major
                Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status