DemocracyOS/democracyos

View on GitHub

Showing 430 of 430 total issues

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

    confirm(_t('title'), _t('body'))
      .cancel(_t('cancel'))
      .ok(_t('ok'))
      .modal()
      .closable()
Severity: Major
Found in lib/admin/admin-topics/view.js and 1 other location - About 1 hr to fix
lib/admin/admin-topics-form/view.js on lines 316..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 70.

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

    confirm(_t('title'), _t('body'))
      .cancel(_t('cancel'))
      .ok(_t('ok'))
      .modal()
      .closable()
Severity: Major
Found in lib/admin/admin-topics-form/view.js and 1 other location - About 1 hr to fix
lib/admin/admin-topics/view.js on lines 86..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 70.

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 3 locations. Consider refactoring.
Open

page(urlBuilder.for('admin.forum.edit'), (ctx) => {
  ctx.sidebar.set('edit-forum')
  render(<EditForum forum={ctx.forum} />, document.querySelector('.admin-content'))
})
Severity: Major
Found in lib/admin/admin/admin.js and 2 other locations - About 1 hr to fix
lib/admin/admin/admin.js on lines 142..145
lib/admin/admin/admin.js on lines 147..150

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

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 3 locations. Consider refactoring.
Open

page(urlBuilder.for('admin.tags-moderation'), (ctx) => {
  ctx.sidebar.set('tags-moderation')
  render(<ModerateTags forum={ctx.forum} />, document.querySelector('.admin-content'))
})
Severity: Major
Found in lib/admin/admin/admin.js and 2 other locations - About 1 hr to fix
lib/admin/admin/admin.js on lines 142..145
lib/admin/admin/admin.js on lines 152..155

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

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

try {
  app = require('ext')
} catch (err) {
  if (err.code === 'MODULE_NOT_FOUND' &&
      err.message === 'Cannot find module \'ext\'') {
Severity: Major
Found in lib/ext/index.js and 1 other location - About 1 hr to fix
lib/ext/routes.js on lines 5..14

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

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

try {
  routes = require('ext/lib/boot/routes')
} catch (err) {
  if (err.code === 'MODULE_NOT_FOUND' &&
      err.message === 'Cannot find module \'ext/lib/boot/routes\'') {
Severity: Major
Found in lib/ext/routes.js and 1 other location - About 1 hr to fix
lib/ext/index.js on lines 5..14

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

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.props.isOwner || this.props.forum.privileges.canDeleteComments) &&
                      (
                        <button onClick={this.props.onToggleDeleteConfirmation}>
                          {t('comment-card.remove-argument')}
lib/site/topic-layout/topic-article/comments/list/comment/replies/list/header/component.js on lines 45..52

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

                    {
                      (this.props.isOwner || this.props.forum.privileges.canDeleteComments) &&
                      (
                        <button onClick={this.props.onToggleDeleteConfirmation}>
                          {t('comment-card.remove-argument')}
lib/site/topic-layout/topic-article/comments/list/comment/header/component.js on lines 46..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 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

Function render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { reply, user, forum } = this.props
    const userAttrs = user.state.value || {}
    const isOwner = userAttrs.id === reply.author.id

    Function calcResult has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.calcResult = function calcResult (topic) {
      return Vote.find({ topic: topic._id }).then((votes) => {
        const options = topic.action.results.map((o) => o.value)
        const votesPercentages = {}
    
    
    Severity: Minor
    Found in lib/api-v2/db-api/topics/utils.js - About 1 hr to fix

      Function removeComment has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.removeComment = (function () {
        function verifyPrivileges (forum, user, comment) {
          if (privileges.canDeleteComments(forum, user)) return comment
      
          if (!comment.author.equals(user._id)) {
      Severity: Minor
      Found in lib/api-v2/db-api/comments/index.js - About 1 hr to fix

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

            if (this.find('.method-input')[0].value === 'poll' && this.find('.poll-options > input')[0].value === '') {
              this.messages(t('admin-topics-form.message.validation.pollOptions-required'), 'error')
              return
            }
        Severity: Major
        Found in lib/admin/admin-topics-form/view.js and 1 other location - About 1 hr to fix
        lib/admin/admin-topics-form/view.js on lines 215..218

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

        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 (this.find('.method-input')[0].value === 'hierarchy' && this.find('.hierarchy-options > input')[0].value === '') {
              this.messages(t('admin-topics-form.message.validation.hierarchyOptions-required'), 'error')
              return
            }
        Severity: Major
        Found in lib/admin/admin-topics-form/view.js and 1 other location - About 1 hr to fix
        lib/admin/admin-topics-form/view.js on lines 211..214

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

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

          switchOn () {
            this.bind('click', '.add-link', this.bound('onaddlinkclick'))
            this.bind('click', '.forum-tag', this.bound('onaddforumtagclick'))
            this.bind('click', '[data-remove-link]', this.bound('onremovelinkclick'))
            this.bind('click', '.save', this.bound('onsaveclick'))
        Severity: Minor
        Found in lib/admin/admin-topics-form/view.js - About 1 hr to fix

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

          module.exports = function () {
            const callbackURL = utils.buildUrl(config, {
              pathname: '/auth/facebook/callback'
            })
          
          
          Severity: Minor
          Found in lib/site/auth-facebook/strategy.js - About 1 hr to fix

            Function buildJs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function buildJs (entries) {
              return {
                build: function () {
                  const log = newLog('js:build')
            
            
            Severity: Minor
            Found in lib/build/js.js - About 1 hr to fix

              Function parseComment has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function parseComment (comment) {
                return new Promise((resolve, reject) => {
                  if (!comment.text) return resolve(comment)
                  marked(comment.text, {
                    sanitize: true,
              Severity: Minor
              Found in lib/site/topic-layout/topic-article/comments/parse-comment.js - About 1 hr to fix

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

                              <div className='title-page'>
                                <div className='circle'>
                                  <i className='icon-user' />
                                </div>
                                <h1>{t('signup.with-email')}</h1>
                Severity: Major
                Found in lib/site/sign-up/component.js and 4 other locations - About 1 hr to fix
                lib/site/forgot/component.js on lines 43..48
                lib/site/resend/component.js on lines 61..66
                lib/site/resend/component.js on lines 137..142
                lib/site/reset/component.js on lines 54..59

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

                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

                              <div className='title-page'>
                                <div className='circle'>
                                  <span className='loader' />
                                </div>
                                <h1>{t('signup.validating')}</h1>
                Severity: Major
                Found in lib/site/resend/component.js and 4 other locations - About 1 hr to fix
                lib/site/forgot/component.js on lines 43..48
                lib/site/resend/component.js on lines 61..66
                lib/site/reset/component.js on lines 54..59
                lib/site/sign-up/component.js on lines 109..114

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

                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

                          <div className='title-page'>
                            <div className='circle'>
                              <i className='icon-energy' />
                            </div>
                            <h1>{t('forgot.reset')}</h1>
                Severity: Major
                Found in lib/site/reset/component.js and 4 other locations - About 1 hr to fix
                lib/site/forgot/component.js on lines 43..48
                lib/site/resend/component.js on lines 61..66
                lib/site/resend/component.js on lines 137..142
                lib/site/sign-up/component.js on lines 109..114

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

                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