oss-specs/specs

View on GitHub

Showing 192 of 192 total issues

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

module.exports = function () {

  this.Given(/^a URL representing a remote Git repo "([^"]*)"$/, function (repoUrl) {
    this.repoUrl = repoUrl;
  });
Severity: Major
Found in features-support/step_definitions/features.js - About 7 hrs to fix

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

module.exports = function() {
  // Shared variables
  var featureText;
  var features;

Severity: Major
Found in features-support/step_definitions/parsing.js - About 5 hrs to fix

Function checkResultsFromList has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

function checkResultsFromList(array, scenario) {
  if (array && array.length > 0) {
    var passes ='';
    var scenarioName= scenario.name;
    if(scenario.type === 'ScenarioOutline' ) {
Severity: Minor
Found in views/helpers/index.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

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

  getProjectData(projectData, ref)
  .then(function (_projectData) {
    projectData = _projectData;

    var filePathToFileObject = processFiles.getFilePathToFileObject(appConfig.projectRoute, projectData, getFileContent);
Severity: Major
Found in routes/feature.js and 1 other location - About 2 hrs to fix
routes/feature.js on lines 96..146

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 88.

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

  getProjectData(projectData, ref)
  .then(function (_projectData) {
    projectData = _projectData;

    var filePathToFileObject = processFiles.getFilePathToFileObject(appConfig.projectRoute, projectData, getFileContent);
Severity: Major
Found in routes/feature.js and 1 other location - About 2 hrs to fix
routes/feature.js on lines 51..64

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 88.

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 _processViews has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function _processViews(projectViews) {
  var viewNames;

  // Valid undefined argument.
  if (projectViews === undefined) {
Severity: Major
Found in lib/configuration/project-config.js - About 2 hrs to fix

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

  function switchToDemoBranch(callback) {
    var world = this;
    var burgerMenuId = 'expand-collapse-repository-controls';
    var repositoryCongtrolsId = 'repository-controls';
    var projectShaElId = 'project-commit';
Severity: Minor
Found in features-support/step_definitions/features.js - About 2 hrs to fix

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

function compareJobsAndFeatures(array, scenarioName,directFeature) {
  if (array && array.length > 0) {
    var passes ='';
    for( var i = 0; i < array.length ; i++) {
      //If we check direct equals then we miss out some in scenario outline that end in digits, so needs changing
Severity: Minor
Found in views/helpers/index.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function() {
  // Shared variables
  var featureText;
  var features;

Severity: Minor
Found in features-support/step_definitions/parsing.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 getRender has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getRender(res, appConfig, renderOptions) {
  return function render(projectData) {
    var renderingData = {};

    // The tags object associated with this project.
Severity: Minor
Found in routes/project.js - About 1 hr to fix

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

  return function render(projectData) {
    var renderingData = {};

    // The tags object associated with this project.
    var projectTags = {};
Severity: Minor
Found in routes/project.js - About 1 hr to fix

Function getRender has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function getRender(res, appConfig, renderOptions) {
  return function render(projectData) {
    var renderingData = {};

    // The tags object associated with this project.
Severity: Minor
Found in routes/project.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 seleniumHooks has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function seleniumHooks() {
  // Lets give browser a minute to start up
  this.Before({ tags: ['@ui-automation'], timeout: 60 * 1000}, function(scenario, callback) {
    var world = this;
    var timeoutManager;
Severity: Minor
Found in features-support/hooks/ui-automation.js - About 1 hr to fix

Function applyProjectView has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function applyProjectView(projectData, renderingData) {
  var currentProjectViewName = renderingData.currentProjectViewName;
  var projectView = {};
  var viewNames = [];

Severity: Minor
Found in lib/specifications/projects/project-views.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 expandCollapseDetails has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function expandCollapseDetails() {
      var featureTitleEl = window.document.getElementById('feature-title');
      var tagsButtonEl = window.document.getElementById('expand-collapse-tags');
      var featureDetailsEls = window.document.getElementsByClassName('feature-details');
      var scenarioDetailsEls = window.document.getElementsByClassName('scenario-details');
Severity: Minor
Found in public/javascript/feature.js - About 1 hr to fix

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

function applyProjectView(projectData, renderingData) {
  var currentProjectViewName = renderingData.currentProjectViewName;
  var projectView = {};
  var viewNames = [];

Severity: Minor
Found in lib/specifications/projects/project-views.js - About 1 hr to fix

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

function filterFeaturesAndScenarios(projectData, projectTags, currentTagName) {

  // Count the project tags and mark the current
  // tag of interest if there is one.
  let ret = countProjectTags(projectData, projectTags, currentTagName);
Severity: Minor
Found in lib/specifications/files/feature-files/tags.js - About 1 hr to fix

Function update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function update(projectData) {

  var repository;
  var defaultBranch;
  var defaultRemoteBranch;
Severity: Minor
Found in lib/specifications/repository-types/git/fetching.js - About 1 hr to fix

Function getProjectData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getProjectData(projectData, targetBranchName) {
  var currentRef;
  var repository;
  var remoteUrl;
  var headCommit;
Severity: Minor
Found in lib/specifications/repository-types/git/project-data.js - About 1 hr to fix

Function getCustomCapabilitiesFromEnvironment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getCustomCapabilitiesFromEnvironment(webdriver) {
  var saucelabsProperties = {};

  var browserKey = webdriver.Capability.BROWSER_NAME;
  var platformKey = webdriver.Capability.PLATFORM_NAME;
Severity: Minor
Found in features-support/hooks/ui-automation.js - About 1 hr to fix
Severity
Category
Status
Source
Language