DemocracyOS/democracyos

View on GitHub

Showing 430 of 430 total issues

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

  render () {
    const voted = this.props.user.state.fulfilled && this.props.item.voted

    return (
      <li className='sidebar-link' data-id={this.props.item.id}>
Severity: Minor
Found in lib/site/topic-layout/sidebar/list/list-item/component.js - About 1 hr to fix

    Function mixin has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function mixin (Base, ...theMixins) {
      let constructors = []
    
      if (typeof Base !== 'function') {
        theMixins.unshift(Base)
    Severity: Minor
    Found in lib/utils/mixin.js - About 1 hr to fix

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

        render () {
          let renderState
      
          if (!this.props.isLoading && !this.props.noMoreResults) {
            renderState = (
      Severity: Minor
      Found in lib/site/home-multiforum/search-results/load-more/index.js - About 1 hr to fix

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

                      <th scope="col">
                        {t('admin-tags-moderation.column.tag')}
                        <SortButtons
                          onSort={this.onSort}
                          sortString='tag'
        Severity: Major
        Found in lib/admin/admin-tags-moderation/component.js and 1 other location - About 1 hr to fix
        lib/admin/admin-tags-moderation/component.js on lines 142..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 56.

        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

        export function privileges (privilege) {
          return function privilegesMiddleware (ctx, next) {
            if (ctx.forum && ctx.forum.privileges[privilege]) return next()
          }
        }
        Severity: Major
        Found in lib/middlewares/forum-middlewares/forum-middlewares.js and 1 other location - About 1 hr to fix
        lib/middlewares/topic-middlewares/topic-middlewares.js on lines 85..89

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

        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

                <div className='container-401'>
                  <span className='icon-ban' />
                  <h1 className='title'>
                    {t('privileges-alert.not-can-view')}
                  </h1>
        Severity: Major
        Found in lib/site/error-pages/not-allowed/component.js and 1 other location - About 1 hr to fix
        lib/site/topic-layout/topic-article/cant-comment/component.js on lines 5..10

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

        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

          handleDownvote = (evt) => {
            if (this.showNeedsLoginOverlay()) return
            evt.currentTarget.classList.add('active')
            this.props.onDownvote()
          }
        lib/site/topic-layout/topic-article/comments/list/comment/component.js on lines 50..54
        lib/site/topic-layout/topic-article/comments/list/comment/component.js on lines 56..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 56.

        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

          <p className='text-mute overlay-vote'>
            <span className='icon-lock' />
            <span className='text'>
              {t('privileges-alert.not-can-vote-and-comment')}
            </span>
        lib/site/error-pages/not-allowed/component.js on lines 8..13

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

        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

          handleUpvote = (evt) => {
            if (this.showNeedsLoginOverlay()) return
            evt.currentTarget.classList.add('active')
            this.props.onUpvote()
          }
        lib/site/topic-layout/topic-article/comments/list/comment/component.js on lines 50..54
        lib/site/topic-layout/topic-article/comments/list/comment/component.js on lines 62..66

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

        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

                      <th scope="col">
                        {t('admin-tags-moderation.column.count')}
                        <SortButtons
                          onSort={this.onSort}
                          sortString='count'
        Severity: Major
        Found in lib/admin/admin-tags-moderation/component.js and 1 other location - About 1 hr to fix
        lib/admin/admin-tags-moderation/component.js on lines 135..141

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

        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

          componentWillUnmount () {
            bus.off('user-form:load', this.onLoadUserForm)
            bus.off('sidebar:enable', this.showToggleSidebarChange)
            bus.off('sidebar:show', this.showSidebarChange)
          }
        Severity: Major
        Found in lib/header/component.js and 1 other location - About 1 hr to fix
        lib/header/component.js on lines 22..26

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

        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

        export function privileges (privilege) {
          return function privilegesMiddleware (ctx, next) {
            if (ctx.topic && ctx.topic.privileges[privilege]) return next()
          }
        }
        Severity: Major
        Found in lib/middlewares/topic-middlewares/topic-middlewares.js and 1 other location - About 1 hr to fix
        lib/middlewares/forum-middlewares/forum-middlewares.js on lines 57..61

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

        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

          componentWillMount () {
            bus.on('user-form:load', this.onLoadUserForm)
            bus.on('sidebar:enable', this.showToggleSidebarChange)
            bus.on('sidebar:show', this.showSidebarChange)
          }
        Severity: Major
        Found in lib/header/component.js and 1 other location - About 1 hr to fix
        lib/header/component.js on lines 28..32

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

        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

          handleUnvote = (evt) => {
            if (this.showNeedsLoginOverlay()) return
            evt.currentTarget.classList.remove('active')
            this.props.onUnvote()
          }
        lib/site/topic-layout/topic-article/comments/list/comment/component.js on lines 56..60
        lib/site/topic-layout/topic-article/comments/list/comment/component.js on lines 62..66

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

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

            watch: function () {
              const log = newLog('js:watch')
        
              const bs = Object.keys(entries).map(function (target) {
                const opts = {
        Severity: Minor
        Found in lib/build/js.js - About 1 hr to fix

          Function up has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.up = function up (done) {
            dbReady()
              .then(() => config.blackListEmails ? Promise.resolve() : Promise.reject())
              .then(() => User.collection.find({ email: { $in: config.blackListEmails.map((d) => new RegExp(`@${d}*$`)) } }).toArray())
              .then((users) => User.collection.deleteMany({ email: { $in: config.blackListEmails.map((d) => new RegExp(`@${d}*$`)) } })
          Severity: Minor
          Found in migrations/1503424667703-add-blacklist-email.js - About 1 hr to fix

            Function doSignUp has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.doSignUp = function doSignUp (profile, meta, callback) {
              const strategySignup = () => {
                profile.email = normalizeEmail(profile.email)
                var user = new User(profile)
            
            
            Severity: Minor
            Found in lib/api/signup/lib/signup.js - About 1 hr to fix

              Function getTopics has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getTopics (req, res, next) {
                Promise.all([
                  api.topics.list({
                    user: req.user,
                    forum: req.forum,
              Severity: Minor
              Found in lib/api-v2/topics/index.js - About 1 hr to fix

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

                  const comment = {
                    id: req.comment.id,
                    author: userScopes.ordinary.expose(req.user),
                    text: req.comment.text
                  }
                Severity: Major
                Found in lib/api-v2/middlewares/notifications.js and 1 other location - About 1 hr to fix
                lib/api-v2/middlewares/notifications.js on lines 47..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 55.

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

                exports.ordinary.select = exports.ordinary.keys.expose.concat(
                  exports.ordinary.keys.select
                ).join(' ')
                Severity: Major
                Found in lib/api-v2/db-api/forums/scopes.js and 3 other locations - About 1 hr to fix
                lib/api-v2/db-api/comments/scopes.js on lines 32..34
                lib/api-v2/db-api/topics/scopes.js on lines 60..62
                lib/api-v2/db-api/users/scopes.js on lines 22..24

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

                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