san650/ember-cli-page-object

View on GitHub

Showing 21 of 212 total issues

File collection-test.ts has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { collection, create, hasClass, text } from 'ember-cli-page-object';
import withIteratorSymbolDefined from '../../../helpers/with-iterator-symbol-defined';
import { setupRenderingTest, TestContext } from '../../../helpers';
import { module, test } from 'qunit';

Severity: Minor
Found in test-app/tests/unit/-private/properties/collection-test.ts - About 7 hrs to fix

    File value-test.ts has 448 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { create, value } from 'ember-cli-page-object';
    import { setupRenderingTest, TestContext } from '../../../helpers';
    import { module, test } from 'qunit';
    import { render } from '@ember/test-helpers';
    import hbs from 'htmlbars-inline-precompile';
    Severity: Minor
    Found in test-app/tests/unit/-private/properties/value-test.ts - About 6 hrs to fix

      Function exports has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = async function () {
        return {
          usePnpm: true,
          scenarios: [
            {
      Severity: Major
      Found in test-app/config/ember-try.js - About 4 hrs to fix

        File action-test.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { module, test } from 'qunit';
        import { create } from 'ember-cli-page-object';
        import action from 'ember-cli-page-object/-private/action';
        import { isPageObject } from 'ember-cli-page-object/-private/meta';
        import { setAdapter, getAdapter } from 'ember-cli-page-object/adapters';
        Severity: Minor
        Found in test-app/tests/unit/-private/action-test.js - About 3 hrs to fix

          File actions-test.ts has 285 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import 'qunit-dom';
          import { run } from '@ember/runloop';
          
          import { module, test } from 'qunit';
          import { render } from '@ember/test-helpers';
          Severity: Minor
          Found in test-app/tests/integration/actions-test.ts - About 2 hrs to fix

            File composition-test.ts has 256 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { setupRenderingTest } from '../../helpers';
            import { test, module } from 'qunit';
            import {
              isPageObject,
              getPageObjectDefinition,
            Severity: Minor
            Found in test-app/tests/unit/-private/composition-test.ts - About 2 hrs to fix

              Function buildObject has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function buildObject(node, blueprintKey, blueprint, defaultBuilder) {
                let definition;
              
                // Preserve plain arrays, prevent `Error: string values are not supported in page object definitions Key: "0"` error
                if (Array.isArray(blueprint)) {
              Severity: Minor
              Found in addon/src/create.js - About 1 hr to fix

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

                    keyPress(key, asyncOp) {
                      let exec = () => {
                        let result = this.expression;
                        let stack = this.stack;
                        let op = this.op;
                Severity: Minor
                Found in test-app/app/controllers/calculator.js - About 1 hr to fix

                  Function writeDocsFile has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function writeDocsFile(srcPath, destDir, options) {
                    // capture stdout of 'documentation'
                    // FIXME: Change this to use documentation Node API
                    var filename = options.slug + '.md';
                    var destPath = path.join(destDir, filename);
                  Severity: Minor
                  Found in docs/index.js - About 1 hr to fix

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

                    function massageMarkdown(markdown, options) {
                      var headerRegex = /^#{1,6} /;
                      var h2Regex = /^## (.*)$/;
                      var lines = markdown.split('\n');
                      var tableOfContents = ['### Methods\n'];
                    Severity: Minor
                    Found in docs/index.js - About 1 hr to fix

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

                      export function create(definition = {}, options = {}) {
                        if (typeof definition === 'string') {
                          throw new Error('Definition can not be a string');
                        }
                      
                      
                      Severity: Minor
                      Found in addon/src/create.js - About 1 hr to fix

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

                        function proxyIfSupported(instance) {
                          if (window.Proxy) {
                            return new window.Proxy(instance, {
                              get: function (target, name) {
                                if (typeof name === 'number' || typeof name === 'string') {
                        Severity: Minor
                        Found in addon/src/properties/collection.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 attr has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function attr(element, attributeName) {
                          const value = element.getAttribute(attributeName);
                          if (value) {
                            // Non-existent attributes return `null`, we normalize to undefined
                            return value == null ? undefined : value;
                        Severity: Minor
                        Found in addon/src/properties/attribute.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 getter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function getter(fn) {
                          if (typeof fn !== 'function') {
                            throw new Error('Argument passed to `getter` must be a function.');
                          }
                        
                        
                        Severity: Minor
                        Found in addon/src/macros/getter.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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function (environment) {
                          let ENV = {
                            modulePrefix: 'test-app',
                            environment,
                            rootURL: '/',
                        Severity: Minor
                        Found in test-app/config/environment.js - About 1 hr to fix

                          Function getter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function getter(fn) {
                            if (typeof fn !== 'function') {
                              throw new Error('Argument passed to `getter` must be a function.');
                            }
                          
                          
                          Severity: Minor
                          Found in addon/src/macros/getter.js - About 1 hr to fix

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

                            function getProperty(object, pathToProp) {
                              const pathSegments = pathToProp.split('.');
                            
                              let parent = object;
                              let value;
                            Severity: Minor
                            Found in addon/src/macros/alias.js - About 45 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 addValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function addValue(
                              urlSearchParams,
                              key,
                              value,
                              parentKey = '',
                            Severity: Minor
                            Found in addon/src/properties/visitable.js - About 45 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 writeDocsFile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function writeDocsFile(srcPath, destDir, options) {
                              // capture stdout of 'documentation'
                              // FIXME: Change this to use documentation Node API
                              var filename = options.slug + '.md';
                              var destPath = path.join(destDir, filename);
                            Severity: Minor
                            Found in docs/index.js - About 45 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 addValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              urlSearchParams,
                              key,
                              value,
                              parentKey = '',
                              isArrayValue = false
                            Severity: Minor
                            Found in addon/src/properties/visitable.js - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language