rodrigogs/github-metrics

View on GitHub

Showing 98 of 98 total issues

Function Dashboard has 406 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Dashboard = ((window, document, $, Promise, toastr, dragula, Chart, randomColor, Color, moment, _, App, ProjectService, ColumnService, ReportService, LabelService) => {
  /* Charts */
  let cfdChart;
  let wipChart;
  let leadTimeChart;
Severity: Major
Found in src/public/javascript/dashboard.js - About 2 days to fix

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

    const _summarizeCardEvents = async (processedDeliveries) => {
      const cardEvents = await CardEvent
        .find({ delivery: { $not: { $in: processedDeliveries } } }).exec();
    
      let cardsTodo = cardEvents.length;
    Severity: Major
    Found in src/services/v1/summary.v1.service.js and 1 other location - About 5 hrs to fix
    src/services/v1/summary.v1.service.js on lines 298..313

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

    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

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

    const _summarizeIssueEvents = async (processedDeliveries) => {
      const issueEvents = await IssueEvent
        .find({ delivery: { $not: { $in: processedDeliveries } } }).exec();
    
      let issuesTodo = issueEvents.length;
    Severity: Major
    Found in src/services/v1/summary.v1.service.js and 1 other location - About 5 hrs to fix
    src/services/v1/summary.v1.service.js on lines 276..291

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

    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

    File dashboard.js has 409 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const Dashboard = ((window, document, $, Promise, toastr, dragula, Chart, randomColor, Color, moment, _, App, ProjectService, ColumnService, ReportService, LabelService) => {
      /* Charts */
      let cfdChart;
      let wipChart;
      let leadTimeChart;
    Severity: Minor
    Found in src/public/javascript/dashboard.js - About 5 hrs to fix

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        static async saveFromUrl(url) {
          if (!url) throw new Error('Trying to resolve a reference without url');
      
          debug('saving from url', url);
      
      
      Severity: Major
      Found in src/services/v1/issue.v1.service.js and 4 other locations - About 5 hrs to fix
      src/services/v1/card.v1.service.js on lines 87..102
      src/services/v1/column.v1.service.js on lines 78..93
      src/services/v1/label.v1.service.js on lines 35..50
      src/services/v1/project.v1.service.js on lines 75..90

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

      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

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        static async saveFromUrl(url) {
          if (!url) throw new Error('Trying to resolve a reference without url');
      
          debug('saving from url', url);
      
      
      Severity: Major
      Found in src/services/v1/card.v1.service.js and 4 other locations - About 5 hrs to fix
      src/services/v1/column.v1.service.js on lines 78..93
      src/services/v1/issue.v1.service.js on lines 80..95
      src/services/v1/label.v1.service.js on lines 35..50
      src/services/v1/project.v1.service.js on lines 75..90

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

      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

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        static async saveFromUrl(url) {
          if (!url) throw new Error('Trying to resolve a reference without url');
      
          debug('saving from url', url);
      
      
      Severity: Major
      Found in src/services/v1/label.v1.service.js and 4 other locations - About 5 hrs to fix
      src/services/v1/card.v1.service.js on lines 87..102
      src/services/v1/column.v1.service.js on lines 78..93
      src/services/v1/issue.v1.service.js on lines 80..95
      src/services/v1/project.v1.service.js on lines 75..90

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

      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

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        static async saveFromUrl(url) {
          if (!url) throw new Error('Trying to resolve a reference without url');
      
          debug('saving from url', url);
      
      
      Severity: Major
      Found in src/services/v1/column.v1.service.js and 4 other locations - About 5 hrs to fix
      src/services/v1/card.v1.service.js on lines 87..102
      src/services/v1/issue.v1.service.js on lines 80..95
      src/services/v1/label.v1.service.js on lines 35..50
      src/services/v1/project.v1.service.js on lines 75..90

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

      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

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        static async saveFromUrl(url) {
          if (!url) throw new Error('Trying to resolve a reference without url');
      
          debug('saving from url', url);
      
      
      Severity: Major
      Found in src/services/v1/project.v1.service.js and 4 other locations - About 5 hrs to fix
      src/services/v1/card.v1.service.js on lines 87..102
      src/services/v1/column.v1.service.js on lines 78..93
      src/services/v1/issue.v1.service.js on lines 80..95
      src/services/v1/label.v1.service.js on lines 35..50

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

      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 Dashboard has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      const Dashboard = ((window, document, $, Promise, toastr, dragula, Chart, randomColor, Color, moment, _, App, ProjectService, ColumnService, ReportService, LabelService) => {
        /* Charts */
        let cfdChart;
        let wipChart;
        let leadTimeChart;
      Severity: Minor
      Found in src/public/javascript/dashboard.js - About 4 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

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

        static async saveEvent(event) {
          if (!event) throw new Error('Trying to save an empty entity');
      
          debug('saving event', JSON.stringify(event));
      
      
      Severity: Major
      Found in src/services/v1/column.v1.service.js and 1 other location - About 4 hrs to fix
      src/services/v1/project.v1.service.js on lines 44..55

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

      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

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

        static async saveEvent(event) {
          if (!event) throw new Error('Trying to save an empty entity');
      
          debug('saving event', JSON.stringify(event));
      
      
      Severity: Major
      Found in src/services/v1/issue.v1.service.js and 1 other location - About 4 hrs to fix
      src/services/v1/card.v1.service.js on lines 56..67

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

      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

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

        static async saveEvent(event) {
          if (!event) throw new Error('Trying to save an empty entity');
      
          debug('saving event', JSON.stringify(event));
      
      
      Severity: Major
      Found in src/services/v1/card.v1.service.js and 1 other location - About 4 hrs to fix
      src/services/v1/issue.v1.service.js on lines 49..60

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

      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

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

        static async saveEvent(event) {
          if (!event) throw new Error('Trying to save an empty entity');
      
          debug('saving event', JSON.stringify(event));
      
      
      Severity: Major
      Found in src/services/v1/project.v1.service.js and 1 other location - About 4 hrs to fix
      src/services/v1/column.v1.service.js on lines 47..58

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

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

        const initCharts = () => {
          cfdChart = new Chart(cfdCanvas[0], {
            type: 'line',
            options: {
              responsive: true,
      Severity: Major
      Found in src/public/javascript/dashboard.js - About 3 hrs to fix

        File report.v1.service.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable no-multi-assign */
        const debug = require('debug')('github-metrics:services:v1:report');
        const moment = require('moment');
        const _ = require('lodash');
        const Color = require('color');
        Severity: Minor
        Found in src/services/v1/report.v1.service.js - About 3 hrs to fix

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            wip: async (req, res, next) => {
              debug('executing wip action');
          
              const { project_id: projectId, from_date: from, to_date: to } = req.query;
          
          
          Severity: Major
          Found in src/controllers/v1/report.v1.controller.js and 3 other locations - About 3 hrs to fix
          src/controllers/v1/report.v1.controller.js on lines 31..42
          src/controllers/v1/report.v1.controller.js on lines 69..80
          src/controllers/v1/report.v1.controller.js on lines 88..99

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            leadtime: async (req, res, next) => {
              debug('executing leadtime action');
          
              const { project_id: projectId, from_date: from, to_date: to } = req.query;
          
          
          Severity: Major
          Found in src/controllers/v1/report.v1.controller.js and 3 other locations - About 3 hrs to fix
          src/controllers/v1/report.v1.controller.js on lines 31..42
          src/controllers/v1/report.v1.controller.js on lines 50..61
          src/controllers/v1/report.v1.controller.js on lines 88..99

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            cfd: async (req, res, next) => {
              debug('executing cfd action');
          
              const { project_id: projectId, from_date: from, to_date: to } = req.query;
          
          
          Severity: Major
          Found in src/controllers/v1/report.v1.controller.js and 3 other locations - About 3 hrs to fix
          src/controllers/v1/report.v1.controller.js on lines 50..61
          src/controllers/v1/report.v1.controller.js on lines 69..80
          src/controllers/v1/report.v1.controller.js on lines 88..99

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            throughput: async (req, res, next) => {
              debug('executing throughput action');
          
              const { project_id: projectId, from_date: from, to_date: to } = req.query;
          
          
          Severity: Major
          Found in src/controllers/v1/report.v1.controller.js and 3 other locations - About 3 hrs to fix
          src/controllers/v1/report.v1.controller.js on lines 31..42
          src/controllers/v1/report.v1.controller.js on lines 50..61
          src/controllers/v1/report.v1.controller.js on lines 69..80

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

          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

          Severity
          Category
          Status
          Source
          Language