Showing 83 of 394 total issues
Function JSONTreeView
has a Cognitive Complexity of 307 (exceeds 5 allowed). Consider refactoring. Open
Open
function JSONTreeView(name_, value_, parent_, isRoot_) {
const self = this;
this.ee = new EventEmitter();
this.on = (...args) => this.ee.on(...args);
this.once = (...args) => this.ee.once(...args);
- 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
Function JSONTreeView
has 726 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function JSONTreeView(name_, value_, parent_, isRoot_) {
const self = this;
this.ee = new EventEmitter();
this.on = (...args) => this.ee.on(...args);
this.once = (...args) => this.ee.once(...args);
Function createData
has 391 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function createData() {
console.log('Cleaning database...');
await cleanDatabase();
/** *****************************************
File jsonTreeView.js
has 762 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* https://gist.github.com/mudge/5830382#gistcomment-2691957
*/
class EventEmitter {
constructor() {
File create-dev-data.js
has 474 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable no-console */
const { addDays } = require('date-fns');
Promise.props = require('promise-props');
const BuildLogs = require('../api/services/build-logs');
const { encrypt } = require('../api/services/Encryptor');
Function SiteBuilds
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SiteBuilds() {
const { id } = useParams();
const [autoRefresh, setAutoRefresh] = useState(false);
const site = useSelector(state => currentSite(state.sites, id));
const organization = useSelector(state => getOrgById(state.organizations, site.organizationId));
Function exports
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const Site = sequelize.define('Site', {
demoBranch: {
type: DataTypes.STRING,
validate: {
Function exports
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const Build = sequelize.define(
'Build',
{
branch: {
Function SiteContainer
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function SiteContainer(props) {
const { id } = useParams();
const location = useLocation();
const params = useSearchParams();
const sites = useSelector(state => state.sites);
CloudFoundryAPIClient
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class CloudFoundryAPIClient {
constructor({ apiUrl, authClient } = {}) {
this.authClient = authClient ?? new CloudFoundryAuthClient();
this.httpClient = new HttpClient(apiUrl ?? process.env.CLOUD_FOUNDRY_API_HOST);
}
Function AddSite
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function AddSite() {
useEffect(() => () => {
// dispatch the action to hide the additional new site fields
// when this component is unmounted
addNewSiteFieldsActions.hideAddNewSiteFields();
Function define
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function define(sequelize, DataTypes) {
const SiteBranchConfig = sequelize.define(
'SiteBranchConfig',
{
branch: {
File build.js
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const { Op } = require('sequelize');
const crypto = require('crypto');
const URLSafeBase64 = require('urlsafe-base64');
const SiteBuildQueue = require('../services/SiteBuildQueue');
Function define
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function define(sequelize, DataTypes) {
const Domain = sequelize.define('Domain', {
names: {
type: DataTypes.STRING,
allowNull: false,
Function create
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async create(req, res) {
const { body, params, user } = req;
const { site_id: siteId } = params;
const site = await Site.forUser(user).findByPk(siteId);
Function update
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async update(req, res) {
const { body, params, user } = req;
const { site_id: siteId, id } = params;
const site = await Site.forUser(user).findByPk(siteId);
File federalistApi.js
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import fetch from './fetch';
import alertActions from '../actions/alertActions';
export const API = '/v0';
Function SiteSettings
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SiteSettings() {
const { id } = useParams();
const site = useSelector(state => currentSite(state.sites, id));
const navigate = useNavigate();
File cfApiClient.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const CloudFoundryAuthClient = require('./cfAuthClient');
const HttpClient = require('./httpClient');
function filterEntity(res, name, field = 'name') {
const errMsg = `Not found: Entity @${field} = ${name}`;
File api.js
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable no-console */
/* global API_URL */
import { notification, session } from '../stores';
import { logout as authLogout } from './auth';