Bamieh/reflow

View on GitHub

Showing 112 of 112 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

function getAndroidFeatures(devices) {
  return Promise.all(
    devices
      .filter(device => device.type !== 'unauthorized')
      .map(device => {
Severity: Major
Found in packages/reflow-appium/lib/routes/devices.js and 3 other locations - About 3 hrs to fix
packages/reflow-appium/lib/devices.js on lines 23..32
packages/reflow-appium/lib/devices.js on lines 33..42
packages/reflow-appium/lib/routes/devices.js on lines 33..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

function getAndroidProperties(devices) {
  return Promise.all(
    devices
      .filter(device => device.type !== 'unauthorized')
      .map(device => {
Severity: Major
Found in packages/reflow-appium/lib/routes/devices.js and 3 other locations - About 3 hrs to fix
packages/reflow-appium/lib/devices.js on lines 23..32
packages/reflow-appium/lib/devices.js on lines 33..42
packages/reflow-appium/lib/routes/devices.js on lines 23..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

function getAndroidProperties(devices) {
  return Promise.all(
    devices
      .filter(device => device.type !== 'unauthorized')
      .map(device => {
Severity: Major
Found in packages/reflow-appium/lib/devices.js and 3 other locations - About 3 hrs to fix
packages/reflow-appium/lib/devices.js on lines 23..32
packages/reflow-appium/lib/routes/devices.js on lines 23..32
packages/reflow-appium/lib/routes/devices.js on lines 33..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File index.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const { DOMParser } =  require('xmldom');
const xpath = require('xpath');

const sourceXML = `
<?xml version="1.0" encoding="UTF-8"?><AppiumAUT><XCUIElementTypeApplication type="XCUIElementTypeApplication" name=" " label=" " enabled="true" visible="true" x="0" y="0" width="375" height="667">
Severity: Minor
Found in examples/example-native-project/index.js - About 2 hrs to fix

    Function reflowBddInterface has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function reflowBddInterface(suite) {
      var suites = [suite];
      var hooks = [];
    
      suite.on('pre-require', function (context, file, mocha) {
    Severity: Major
    Found in packages/reflow-core/src/interfaces/bdd.ts - About 2 hrs to fix

      Function createMatrixGenerator has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const createMatrixGenerator = async function(reflowConfig: ReflowConfig) {
        const {
          // flowPaths,
          hooks,
          suites,
      Severity: Major
      Found in packages/reflow-core/src/_generate-matrix.ts - About 2 hrs to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        subflow("Conditional Subflow", function() {
          return {
            condition: branches => {
              return branches
                .filter(branch => branch.type === 'suite')
        Severity: Major
        Found in examples/example-e2e-project/subflow/conditional.js and 1 other location - About 2 hrs to fix
        examples/example-native-project/subflow/conditional.js on lines 1..12

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 85.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        subflow("Conditional Subflow", function() {
          return {
            condition: branches => {
              return branches
                .filter(branch => branch.type === 'suite')
        Severity: Major
        Found in examples/example-native-project/subflow/conditional.js and 1 other location - About 2 hrs to fix
        examples/example-e2e-project/subflow/conditional.js on lines 1..12

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 85.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function createReflowContext has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const createReflowContext = function(filepath) {
          const self = this;
          return {
            describe(name) {
              self.suites[name] = filepath
        Severity: Major
        Found in packages/reflow-core/lib/reflow.js - About 2 hrs to fix

          Function createReflowContext has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const createReflowContext = function(filepath) {
            const self = this;
            return {
              describe(name) {
                self.suites[name] = filepath
          Severity: Major
          Found in packages/reflow-core/src/context.ts - About 2 hrs to fix

            Function render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const { data: {loading, error, node }} = this.props;
                console.log('node:::, ', node)
            
                const { onlyFailures } = this.state
            Severity: Major
            Found in packages/reflow-board/src/pages/CombinationsList/Page.js - About 2 hrs to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

              function decode(globalID) {
                try {
                  const [type, id] = Buffer.from(globalID, 'base64').toString('utf8').split('_');
                  return { id, type }
                } catch(e) {
              Severity: Major
              Found in packages/reflow-circuit/lib/util/global-id.js and 1 other location - About 2 hrs to fix
              packages/reflow-cassandra-connection/lib/util/global-id.js on lines 7..14

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 76.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

              function decode(globalID) {
                try {
                  const [type, id] = Buffer.from(globalID, 'base64').toString('utf8').split('_');
                  return { id, type }
                } catch(e) {
              Severity: Major
              Found in packages/reflow-cassandra-connection/lib/util/global-id.js and 1 other location - About 2 hrs to fix
              packages/reflow-circuit/lib/util/global-id.js on lines 7..14

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 76.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function executeMatrix has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const executeMatrix = function(matrix, config) {
                const {
                  mocha: mochaConfig,
                  jobDetails,
                  flowDetails,
              Severity: Major
              Found in packages/reflow-core/src/execute.ts - About 2 hrs to fix

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

                  getByProjectID(encodedProjectID, cursorInfo) {
                    const projectID = globalID.decode(encodedProjectID).id;
                    return models.instance.jobsByProjectId.findAsync({
                        project_id: models.datatypes.Long.fromString(projectID),
                      }, {
                Severity: Minor
                Found in packages/reflow-cassandra-connection/lib/connection/reflow/job.js - About 2 hrs to fix

                  Function createMatrixGenerator has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const createMatrixGenerator = async function(reflowConfig: ReflowConfig) {
                    const {
                      // flowPaths,
                      hooks,
                      suites,
                  Severity: Minor
                  Found in packages/reflow-core/src/generate-matrix.ts - 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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      getSuite(name, tags) {
                        const suitePath = self.suites[name];
                        if (!suitePath) throw new Error(`Unable to find suite [ ${name} ].`);
                        return {
                          name,
                  Severity: Major
                  Found in packages/reflow-core/lib/reflow.js and 1 other location - About 1 hr to fix
                  packages/reflow-core/lib/reflow.js on lines 33..42

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 71.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Function createReflowContext has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const createReflowContext = () => {
                      const matrix:MatrixEntries = [];
                      const reflowContext = {
                        matrix,
                        flow(title: Title, flowDetails: any) {
                  Severity: Minor
                  Found in packages/reflow-core/src/generate-matrix.ts - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        getHook(name, tags) {
                          const suitePath = self.hooks[name];
                          if (!suitePath) throw new Error(`Unable to find hook [ ${name} ].`);
                          return {
                            name,
                    Severity: Major
                    Found in packages/reflow-core/lib/reflow.js and 1 other location - About 1 hr to fix
                    packages/reflow-core/lib/reflow.js on lines 53..62

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 71.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Function runFlows has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      runFlows() {
                        const flowsList = Object.values(this.flows);
                        console.log(`${flowsList.length} total flows.`)
                        let totalCombinations = 0;
                    
                    
                    Severity: Minor
                    Found in packages/reflow-core/lib/reflow.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language