Showing 24 of 112 total issues
Function start
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public start() {
// tslint:disable-next-line no-this-assignment
const self = this;
const job = self.jobWorker;
- Read upRead up
- Create a ticketCreate a ticket
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 getByPackage
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getByPackage(packagesPath: string | string[],
itemType: string,
extension: string,
callback: any) {
let processedPackagePath;
- Create a ticketCreate a ticket
Function processDashboard
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function processDashboard(
allJobs: string[],
dashboardName: string,
dashboardConfig: IDashboardConfig,
filters: IFilters,
- Read upRead up
- Create a ticketCreate a ticket
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 getJobs
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getJobs(options: IJobOptions, callback: IVoidCallbackWithData) {
const packagesPath = options.packagesPath;
const filters = options.filters || {};
const configPath = path.join(options.configPath, '/dashboard_common.json');
- Create a ticketCreate a ticket
Function start
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public start() {
// tslint:disable-next-line no-this-assignment
const self = this;
const job = self.jobWorker;
- Create a ticketCreate a ticket
Function default
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function (jobWorker: any) {
function addAuthConfig(auth: any, opts: any) {
const authData = jobWorker.config.globalAuth[auth];
if (authData && authData.username && authData.password) {
opts.auth = {
- Create a ticketCreate a ticket
Function globalAuth
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function globalAuth(file: string) {
let auth = {};
try {
auth = JSON.parse(fs.readFileSync(file).toString());
- Create a ticketCreate a ticket
Function processDashboard
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function processDashboard(
allJobs: string[],
dashboardName: string,
dashboardConfig: IDashboardConfig,
filters: IFilters,
- Create a ticketCreate a ticket
Function init
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function init(options: IJobOptions, cb: (error?: any) => void) {
getJobs(options, (err: any, jobWorkers: IJob[]) => {
if (err) {
return cb(err);
}
- Create a ticketCreate a ticket
Function routes
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function routes(app: Application, packagesPath: any) {
const wallboardAssetsFolder = path.join(process.cwd(), 'assets');
// -----------------------------------------
// Log
- Create a ticketCreate a ticket
Function renderJsDashboard
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function renderJsDashboard(packagesPath: any,
wallboardAssetsFolder: any,
dashboardName: any,
request: Request,
response: Response) {
- Create a ticketCreate a ticket
Function create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function create(options: any) {
const request = options.request || require('request');
if (!options.api_key) {
logger.error('api_key required');
- Create a ticketCreate a ticket
Function runner
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function runner(
options: IOptions,
callback: IVoidCallbackWithError,
) {
const packagesLocalFolder = path.join(process.cwd(), '/packages');
- Create a ticketCreate a ticket
Function bindWidget
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindWidget(io, $li) {
var widgetId = encodeURIComponent($li.attr("data-widget-id"));
var eventId = $li.attr("data-event-id");
var $widgetContainer = $("<div>").addClass("widget-container").appendTo($li).hide();
- Create a ticketCreate a ticket
Function listAllDashboards
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function listAllDashboards(packagesPath: any, request: Request, response: Response) {
get(packagesPath, 'dashboards', '.json', (getError: any, dashboardConfigFiles: string[]) => {
if (getError) {
logger().error(getError);
return response.status(400).send('Error loading dashboards');
- Create a ticketCreate a ticket
Function renderDashboard
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function renderDashboard(packagesPath: any,
dashboardName: any,
request: Request,
response: Response) {
const safeDashboardName = getSafeItemName(dashboardName);
- Create a ticketCreate a ticket
Function readItemsFromPackageDir
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function readItemsFromPackageDir(dir: any, cb: any) {
const packages: any = { dir };
const itemDir = path.join(dir, itemType);
if (!fs.existsSync(itemDir)) {
- Create a ticketCreate a ticket
Function default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function (config: any) {
const client = new Client(config);
return {
query: (connectionString: any, query: any, params: any, callback: any) => {
- Read upRead up
- Create a ticketCreate a ticket
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 renderJsDashboard
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function renderJsDashboard(packagesPath: any,
wallboardAssetsFolder: any,
dashboardName: any,
request: Request,
response: Response) {
- Create a ticketCreate a ticket
Function message
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
message(roomId: number, from: string, message: string, notify: 1 | 0, callback?: any) {
- Create a ticketCreate a ticket