Showing 110 of 159 total issues
Function getPreviousBuilds
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getPreviousBuilds = (currentBuilds, callback) => {
async.map(previousBuildsToGet, (build, callback) => {
let def = build.definition;
// If we already have a previous build, then we don't need to get another one
Function BuildMonitorServer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var BuildMonitorServer = function () {
var self = this,
cachedSettings;
this.connect = function () {
Function formatWorkflow
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
formatWorkflow = function (buildsGroup) {
const { vcs, username, project } = self.configuration;
if (buildsGroup.some(build => build.in_workflow=== false)) {
return buildsGroup.map(build => self.formatBuild(build));
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function () {
var self = this,
requestBuilds = function (callback) {
bitriseRequest(
'/apps/' + self.configuration.slug + '/builds',
- Read upRead up
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 deeply nested control flow statements. Open
Open
if (cause && cause.userName) {
return cause.userName;
}
Avoid too many return
statements within this function. Open
Open
return "Green";
Avoid too many return
statements within this function. Open
Open
return statusText + "/" + resultText;
Avoid too many return
statements within this function. Open
Open
if (statusText === "IN_PROGRESS") return "Blue";
Avoid too many return
statements within this function. Open
Open
if (result === null) return "Blue";
Avoid too many return
statements within this function. Open
Open
return -1;
Avoid too many return
statements within this function. Open
Open
return 0;
Avoid too many return
statements within this function. Open
Open
if (statusText === "PENDING") return "Pending";
Avoid too many return
statements within this function. Open
Open
if (statusText === "IN_PROGRESS") return "In Progress";
Avoid too many return
statements within this function. Open
Open
if (lifeCycleState === 'NotBuilt') return 'Gray';
Avoid too many return
statements within this function. Open
Open
if (result === 'ABORTED') return "Gray";
Avoid too many return
statements within this function. Open
Open
if (result === 'NOT_BUILT') return "Running";
Avoid too many return
statements within this function. Open
Open
if (result === 'ABORTED') return "Aborted";
Avoid too many return
statements within this function. Open
Open
if (statusText === "stopped") return "Gray";
Avoid too many return
statements within this function. Open
Open
if (build.status === "ERROR") return "Error";
Avoid too many return
statements within this function. Open
Open
return 'Paused';