nycJSorg/angular-presentation

View on GitHub
apps/kirjs/src/app/modules/webassembly/webassembly-playground/runners/wasm-test-runner/wasm-test-runner.component.ts

Summary

Maintainability
C
7 hrs
Test Coverage

Function runTests has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  runTests() {
    this.focused = undefined;
    const { tests, code, name, allCode, table } = this.config as any;

    let hasFailures = false;

    Function sources has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const sources = (tests as any[]).map(test => {
          return new Observable<TestResult>(subscriber => {
            const wat = populateTestCode(code.wat, test, allCode, table);
    
            return this.webAssemblyService

      Function webAssemblyTestHandler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function webAssemblyTestHandler(
        config: TestConfig,
        blockCode: string,
        allCode: string
      ): WebAssemblyTestConfig {

        Function passOrNot has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function passOrNot(m: any, blockCode, allCode) {
          if (m.type === 'func') {
            return new Set(extractAllFunctions(allCode)).has(m.name);
          }
          if (m.type === 'module') {

        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

            return !!allCode.match(/\(global \$rowSize i32\)/);

          Avoid too many return statements within this function.
          Open

              return !!allCode.match(new RegExp('global\\s*\\$' + m.name));

            Avoid too many return statements within this function.
            Open

                return !!allCode.match(new RegExp('memory'));

              Avoid too many return statements within this function.
              Open

                  return !!allCode.match(/\(export "step"\)/);

                There are no issues that match your filters.

                Category
                Status