jsperf/jsperf.com

View on GitHub

Showing 232 of 232 total issues

Function register has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.register = function (server, options, next) {
  server.route({
    method: 'GET',
    path: '/faq',
    handler: function (request, reply) {
Severity: Major
Found in server/web/faq/index.js - About 4 hrs to fix

    Function register has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.register = function (server, options, next) {
      const pagesService = server.plugins['services/pages'];
    
      server.route({
        method: 'GET',
    Severity: Major
    Found in server/web/home/index.js - About 4 hrs to fix

      Function handler has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          handler: function (request, reply) {
            reply.view('faq/index', {
              headTitle: 'Frequently asked questions',
              faq: [
                {
      Severity: Major
      Found in server/web/faq/index.js - About 3 hrs to fix

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

          lab.test('it redirects @ to twitter profile', function (done) {
            request.url = '/@';
        
            server.inject(request, function (response) {
              Code.expect(response.statusCode).to.equal(301);
        Severity: Major
        Found in test/unit/server/web/redirects.js and 1 other location - About 3 hrs to fix
        test/unit/server/web/redirects.js on lines 37..46

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

        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

          lab.test('it redirects aliases to relative URLs', function (done) {
            request.url = '/donate';
        
            server.inject(request, function (response) {
              Code.expect(response.statusCode).to.equal(301);
        Severity: Major
        Found in test/unit/server/web/redirects.js and 1 other location - About 3 hrs to fix
        test/unit/server/web/redirects.js on lines 26..35

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

        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

              lab.test('title required', function (done) {
                delete request.payload.title;
        
                server.inject(request, function (response) {
                  Code.expect(response.statusCode).to.equal(400);
        Severity: Major
        Found in test/unit/server/web/home/index.js and 1 other location - About 3 hrs to fix
        test/unit/server/web/home/index.js on lines 160..170

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

        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

              lab.test('slug required', function (done) {
                delete request.payload.slug;
        
                server.inject(request, function (response) {
                  Code.expect(response.statusCode).to.equal(400);
        Severity: Major
        Found in test/unit/server/web/home/index.js and 1 other location - About 3 hrs to fix
        test/unit/server/web/home/index.js on lines 148..158

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

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

        exports.register = function (server, options, next) {
          const db = server.plugins.db;
        
          server.expose('create', function (payload) {
            return db.genericQuery('INSERT INTO ?? SET ?', [table, payload]).then((result) => result.insertId);
        Severity: Major
        Found in server/repositories/pages.js - About 3 hrs to fix

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

              lab.test('adds browserscope test, page, and tests', function (done) {
                bsRepoStub.addTest.returns(Promise.resolve('abc123'));
                pagesRepoStub.create.returns(Promise.resolve());
                testsRepoStub.bulkCreate.returns(Promise.resolve());
          
          
          Severity: Major
          Found in test/unit/server/services/pages.js and 1 other location - About 3 hrs to fix
          test/unit/server/services/pages.js on lines 356..363

          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

              lab.test('adds browserscope test, page, and tests', function (done) {
                bsRepoStub.addTest.returns(Promise.resolve('abc123'));
                pagesRepoStub.create.returns(Promise.resolve());
                testsRepoStub.bulkCreate.returns(Promise.resolve());
          
          
          Severity: Major
          Found in test/unit/server/services/pages.js and 1 other location - About 3 hrs to fix
          test/unit/server/services/pages.js on lines 273..280

          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

              lab.test('revisions above 1 deletes just one revision', (done) => {
                pagesRepoStub.deleteOneRevisionBySlug.returns(Promise.resolve(1));
          
                pages.deleteBySlug('oh-yea', 2)
                  .then(values => {
          Severity: Major
          Found in test/unit/server/services/pages.js and 1 other location - About 3 hrs to fix
          test/unit/server/services/pages.js on lines 665..675

          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

              lab.test('revision 1 deletes all revisions', (done) => {
                pagesRepoStub.deleteAllRevisionsBySlug.returns(Promise.resolve(3));
          
                pages.deleteBySlug('oh-yea', 1)
                  .then(values => {
          Severity: Major
          Found in test/unit/server/services/pages.js and 1 other location - About 3 hrs to fix
          test/unit/server/services/pages.js on lines 677..687

          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

            lab.test('it responds with the sponsor page', function (done) {
              server.inject(request, function (response) {
                Code.expect(response.statusCode).to.equal(200);
                Code.expect(response.result).to.include([
                  'PayPal',
          Severity: Major
          Found in test/unit/server/web/sponsor/index.js and 1 other location - About 3 hrs to fix
          test/unit/server/web/search/index.js on lines 60..70

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

          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

            lab.test('it presents a save option to a user if they have already auth’d with GitHub', function (done) {
              pagesServiceStub.getBySlug.returns(
                Promise.resolve([defaultPageData, [], [], []])
              );
          
          
          Severity: Major
          Found in test/unit/server/web/edit/index.js and 1 other location - About 3 hrs to fix
          test/unit/server/web/edit/index.js on lines 163..173

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

          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

            lab.test('it responds with search form', function (done) {
              server.inject(request, function (response) {
                Code.expect(response.statusCode).to.equal(200);
                Code.expect(response.result).to.include([
                  'Search jsPerf',
          Severity: Major
          Found in test/unit/server/web/search/index.js and 1 other location - About 3 hrs to fix
          test/unit/server/web/sponsor/index.js on lines 41..51

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

          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

            lab.test('visible page warning if page is visible', function (done) {
              pagesServiceStub.getBySlug.returns(
                Promise.resolve([defaultPageData, [], [], []])
              );
          
          
          Severity: Major
          Found in test/unit/server/web/edit/index.js and 1 other location - About 3 hrs to fix
          test/unit/server/web/edit/index.js on lines 151..161

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

          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

            lab.experiment('_css', function () {
              lab.test('it serves main.css', function (done) {
                request.url = '/public/_css/main.css';
                server.inject(request, function (response) {
                  Code.expect(response.statusCode).to.equal(200);
          Severity: Major
          Found in test/unit/server/web/public.js and 1 other location - About 3 hrs to fix
          test/unit/server/web/public.js on lines 55..64

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

          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

            lab.experiment('_js', function () {
              lab.test('it serves main.js', function (done) {
                request.url = '/public/_js/main.js';
                server.inject(request, function (response) {
                  Code.expect(response.statusCode).to.equal(200);
          Severity: Major
          Found in test/unit/server/web/public.js and 1 other location - About 3 hrs to fix
          test/unit/server/web/public.js on lines 44..53

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

          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

            lab.test('bypass custom error pages for all allowed routes', function (done) {
              server.inject('/web/bypass', function (response) {
                Code.expect(response.statusCode).to.equal(200);
                Code.expect(response.result).to.include('bypassed any boom errors');
          
          
          Severity: Major
          Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
          test/unit/server/web/errors/index.js on lines 105..112
          test/unit/server/web/errors/index.js on lines 114..121
          test/unit/server/web/errors/index.js on lines 123..130
          test/unit/server/web/errors/index.js on lines 132..139

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

          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

            lab.test('display a general error page', function (done) {
              server.inject('/web/405', function (response) {
                Code.expect(response.statusCode).to.equal(500);
                Code.expect(response.result).to.include('something went wrong');
          
          
          Severity: Major
          Found in test/unit/server/web/errors/index.js and 4 other locations - About 3 hrs to fix
          test/unit/server/web/errors/index.js on lines 105..112
          test/unit/server/web/errors/index.js on lines 114..121
          test/unit/server/web/errors/index.js on lines 123..130
          test/unit/server/web/errors/index.js on lines 141..148

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

          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