Dulce-Work-Schedule/2018.1-Dulce_Schedule

View on GitHub

Showing 25 of 25 total issues

Function exports has 382 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(options){
  this.add('role:schedule,cmd:createSchedule', async function create (msg,respond) {
    // schedule Entity
    var schedule = this.make(schedule_db);
    // scheduleSettings Entity
Severity: Major
Found in Server/plg_schedule.js - About 1 day to fix

    Function api has 308 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function api(options){
    
    //#############################################################################
      this.add('role:api,path:createSchedule', function(msg, respond){
        // result variable store attribute errors or the success created schedule
    Severity: Major
    Found in Client/api.js - About 1 day to fix

      Function create has 242 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.add('role:schedule,cmd:createSchedule', async function create (msg,respond) {
          // schedule Entity
          var schedule = this.make(schedule_db);
          // scheduleSettings Entity
          var scheduleSettings = this.make(schedule_settings_db);
      Severity: Major
      Found in Server/plg_schedule.js - About 1 day to fix

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

          this.add('role:api,path:listYearByUser', function (msg, respond) {
            console.log(msg.args)
            var currentDate = new Date();
            var year = msg.args.query.year;
            if (year == undefined || year == "Invalid Date") {
        Severity: Major
        Found in Client/api.js and 1 other location - About 1 day to fix
        Client/api.js on lines 302..322

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

        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

          this.add('role:api,path:listYearBySector', function (msg, respond) {
            console.log(msg.args)
            var currentDate = new Date();
            var year = msg.args.query.year;
            if (year == undefined || year == "Invalid Date") {
        Severity: Major
        Found in Client/api.js and 1 other location - About 1 day to fix
        Client/api.js on lines 352..372

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

        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 plg_schedule.js has 416 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var Promise = require('bluebird');
        
        // BDs names
        var schedule_db = 'schedules'
        var schedule_settings_db = 'scheduleSettings'
        Severity: Minor
        Found in Server/plg_schedule.js - About 6 hrs to fix

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

              if(isNaN(max_hours_month)){
                result.max_hours_month_NaN_error = 'O máximo de horas por mês deve ser um valor inteiro positivo';
                console.log(result.max_hours_month_NaN_error);
              } else if(max_hours_month <= 0){
                result.max_hours_month_negative_number_error = 'O máximo de horas por mês deve ser um valor positivo maior que zero';
          Severity: Major
          Found in Client/api.js and 3 other locations - About 4 hrs to fix
          Client/api.js on lines 156..165
          Client/api.js on lines 190..199
          Client/api.js on lines 202..211

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

          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

              if(isNaN(max_hours_week)){
                result.max_hours_week_NaN_error = 'O máximo de horas por semana deve ser um valor inteiro positivo';
                console.log(result.max_hours_week_NaN_error);
              } else if(max_hours_week <= 0){
                result.max_hours_week_negative_number_error = 'O máximo de horas por semana deve ser um valor positivo maior que zero';
          Severity: Major
          Found in Client/api.js and 3 other locations - About 4 hrs to fix
          Client/api.js on lines 156..165
          Client/api.js on lines 178..187
          Client/api.js on lines 202..211

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

          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

              if(isNaN(min_hours_month)){
                result.min_hours_month_NaN_error = 'O mínimo de horas por mês deve ser um valor inteiro positivo';
                console.log(result.min_hours_month_NaN_error);
              } else if(min_hours_month <= 0){
                result.min_hours_month_negative_number_error = 'O mínimo de horas por mês deve ser um valor positivo maior que zero';
          Severity: Major
          Found in Client/api.js and 3 other locations - About 4 hrs to fix
          Client/api.js on lines 156..165
          Client/api.js on lines 178..187
          Client/api.js on lines 190..199

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

          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

              if(isNaN(max_hours_day)){
                result.max_hours_day_NaN_error = 'O máximo de horas por dia deve ser um valor inteiro positivo';
                console.log(result.max_hours_day_NaN_error);
              } else if(max_hours_day <= 0){
                result.max_hours_day_negative_number_error = 'O máximo de horas por dia deve ser um valor positivo maior que zero';
          Severity: Major
          Found in Client/api.js and 3 other locations - About 4 hrs to fix
          Client/api.js on lines 178..187
          Client/api.js on lines 190..199
          Client/api.js on lines 202..211

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

          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 api.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          
          currentWeekNumber = require('current-week-number');
          
          // The RegExp Object above validates MongoBD ObjectIds
          function IsInvalidObjectId(objectIdString){
          Severity: Minor
          Found in Client/api.js - About 4 hrs to fix

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

                if(arguments.length < replaceable_count){
                  console.log(
                    "Expecting " + replaceable_count + "arguments, " +
                    arguments.length + 'found.');
                  return this
            Severity: Major
            Found in Client/api.js and 1 other location - About 3 hrs to fix
            Server/plg_schedule.js on lines 30..41

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

            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

                if(args.length < replaceable_count){
                  console.log(
                    "Expecting " + replaceable_count + "arguments, " +
                    args.length + 'found.');
                  return this
            Severity: Major
            Found in Server/plg_schedule.js and 1 other location - About 3 hrs to fix
            Client/api.js on lines 16..27

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

            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

                if (sector_id == null || sector_id == "") {
                  result.sector_id_error = 'O setor é obrigatório';
                  console.log(result.sector_id_error);
                } else if (IsInvalidObjectId(sector_id)) {
                  result.invalid_sector_id_error = 'sector_id inválido'
            Severity: Major
            Found in Client/api.js and 1 other location - About 1 hr to fix
            Client/api.js on lines 95..100

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

            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

                if (profile_id == null || profile_id == "") {
                  result.profile_id_error = 'O usuário é obrigatório';
                  console.log(result.profile_id_error);
                } else if (IsInvalidObjectId(profile_id)) {
                  result.invalid_profile_id_error = 'profile_id inválido'
            Severity: Major
            Found in Client/api.js and 1 other location - About 1 hr to fix
            Client/api.js on lines 87..92

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

            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

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

            require('seneca')()
             .use("entity")
             .use('mongo-store',{
                name:process.env.MONGO_DATABASE,
                host:process.env.MONGO_HOST,
            Severity: Major
            Found in Server/schedule.js and 1 other location - About 1 hr to fix
            Client/client_schedule.js on lines 45..56

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

            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

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

                seneca.use(senecaWeb,senecaWebConfig)
                .use('seneca-amqp-transport')
                .use("entity")
                .use('api')
                .client({
            Severity: Major
            Found in Client/client_schedule.js and 1 other location - About 1 hr to fix
            Server/schedule.js on lines 3..19

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

            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

            function get_schedule_duration( start_time, end_time){
              // The diference between Dates are given in milliseconds.
              // So we divide by the amount of milliseconds in 1 hour
              console.log(start_time);
              console.log(end_time);
            Severity: Major
            Found in Server/plg_schedule.js and 1 other location - About 1 hr to fix
            Client/api.js on lines 32..43

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

            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

            function get_schedule_duration( start_time, end_time){
              // The diference between Dates are given in milliseconds.
              // So we divide by the amount of milliseconds in 1 hour
              console.log(start_time);
              console.log(end_time);
            Severity: Major
            Found in Client/api.js and 1 other location - About 1 hr to fix
            Server/plg_schedule.js on lines 11..22

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

            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

                if (msg.args.body.start_time == null) {
                  result.start_time_null_error = 'Horário inicial não pode ser nulo';
                  console.log(result.start_time_null_error);
                } else {
                  start_time = new Date(msg.args.body.start_time);
            Severity: Major
            Found in Client/api.js and 1 other location - About 1 hr to fix
            Client/api.js on lines 75..84

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

            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