jameswlane/status-board

View on GitHub

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;

Severity: Minor
Found in src/Scheduler.ts - 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

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;
Severity: Major
Found in src/item-manager/get-by-package.ts - About 2 hrs to fix

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,
Severity: Minor
Found in src/job-manager/process-dashboard.ts - About 2 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

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');
Severity: Major
Found in src/job-manager/get-jobs.ts - About 2 hrs to fix

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;

Severity: Major
Found in src/Scheduler.ts - About 2 hrs to fix

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 = {
Severity: Major
Found in src/job-dependencies/experimentalConfluence/dependency.ts - About 2 hrs to fix

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());
Severity: Minor
Found in src/global-auth.ts - About 1 hr to fix

Function processDashboard has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function processDashboard(
  allJobs: string[],
  dashboardName: string,
  dashboardConfig: IDashboardConfig,
  filters: IFilters,
Severity: Minor
Found in src/job-manager/process-dashboard.ts - About 1 hr to fix

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);
    }
Severity: Minor
Found in src/job-initialiser.ts - About 1 hr to fix

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
Severity: Minor
Found in src/webapp/routes.ts - About 1 hr to fix

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) {
Severity: Minor
Found in src/webapp/logic.ts - About 1 hr to fix

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');
Severity: Minor
Found in src/job-dependencies/hipchat/hipchat.ts - About 1 hr to fix

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');
Severity: Minor
Found in src/runner.ts - About 1 hr to fix

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();
Severity: Minor
Found in assets/javascripts/application.js - About 1 hr to fix

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');
Severity: Minor
Found in src/webapp/routes/dashboard.ts - About 1 hr to fix

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);
Severity: Minor
Found in src/webapp/routes/dashboard.ts - About 1 hr to fix

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)) {
Severity: Minor
Found in src/item-manager/get-by-package.ts - About 1 hr to fix

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) => {
Severity: Minor
Found in src/job-dependencies/postgreSQL/dependency.ts - About 55 mins 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 renderJsDashboard has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function renderJsDashboard(packagesPath: any,
                                  wallboardAssetsFolder: any,
                                  dashboardName: any,
                                  request: Request,
                                  response: Response) {
Severity: Minor
Found in src/webapp/logic.ts - About 35 mins to fix

Function message has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    message(roomId: number, from: string, message: string, notify: 1 | 0, callback?: any) {
Severity: Minor
Found in src/job-dependencies/hipchat/hipchat.ts - About 35 mins to fix
Severity
Category
Status
Source
Language