Showing 199 of 199 total issues

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

        <ToolbarButton
          activated={this.props.recordsVisible}
          onClick={() => this.props.togglePanel('records')}
          data-global-hotkey="alt+r"
          data-tooltip={`${i18n('Toggle Records Panel')} (Alt+R)`}
Severity: Major
Found in vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js and 1 other location - About 3 hrs to fix
vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js on lines 124..133

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

Function reducer has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function reducer(state = {}, action) {
  switch (action.type) {
  case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': {
    const { messages, udict } = action.payload;
    return _.keyBy(
Severity: Major
Found in vj4/ui/components/messagepad/reducers/dialogues.js - About 3 hrs to fix

    Function buildCategoryFilter has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function buildCategoryFilter() {
      const $container = $('[data-widget-cf-container]');
      if (!$container) {
        return;
      }
    Severity: Major
    Found in vj4/ui/pages/problem_main.page.js - About 3 hrs to fix

      Function constructor has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(options = {}) {
          super({
            autoDownloadFontAwesome: false,
            spellChecker: false,
            forceSync: true,
      Severity: Major
      Found in vj4/ui/components/cmeditor/vjcmeditor.js - About 2 hrs to fix

        Function _acm_scoreboard has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def _acm_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
          columns = []
          columns.append({'type': 'rank', 'value': _('Rank')})
          columns.append({'type': 'user', 'value': _('User')})
          columns.append({'type': 'display_name', 'value': _('Display Name')})
        Severity: Minor
        Found in vj4/model/adaptor/contest.py - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

        USER_SYSTEM = {
            '_id': UID_SYSTEM,
            'uname': UNAME_SYSTEM,
            'uname_lower': UNAME_SYSTEM.strip().lower(),
            'mail': '',
        Severity: Major
        Found in vj4/model/builtin.py and 1 other location - About 2 hrs to fix
        vj4/model/builtin.py on lines 294..308

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

        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

        USER_GUEST = {
            '_id': UID_GUEST,
            'uname': UNAME_GUEST,
            'uname_lower': UNAME_GUEST.strip().lower(),
            'mail': '',
        Severity: Major
        Found in vj4/model/builtin.py and 1 other location - About 2 hrs to fix
        vj4/model/builtin.py on lines 276..290

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

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

        pjax.request = async opt => {
          const options = {
            method: 'get',
            push: true,
            ...opt,
        Severity: Major
        Found in vj4/ui/utils/pjax.js - About 2 hrs to fix

          File domain.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import datetime
          
          from pymongo import errors
          from pymongo import ReturnDocument
          
          
          Severity: Minor
          Found in vj4/model/domain.py - About 2 hrs to fix

            Function page has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const page = new NamedPage('domain_manage_role', () => {
              const createRoleDialog = new ActionDialog({
                $body: $('.dialog__body--create-role > div'),
                onDispatch(action) {
                  const $role = createRoleDialog.$dom.find('[name="role"]');
            Severity: Major
            Found in vj4/ui/pages/domain_manage_role.page.js - About 2 hrs to fix

              Function reducer has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function reducer(state = {}, action) {
                switch (action.type) {
                case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': {
                  const dialogues = action.payload.messages;
                  return _.fromPairs(_.map(dialogues, d => [d._id, false]));
              Severity: Major
              Found in vj4/ui/components/messagepad/reducers/isPosting.js - About 2 hrs to fix

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

                  const createRoleDialog = new ActionDialog({
                    $body: $('.dialog__body--create-role > div'),
                    onDispatch(action) {
                      const $role = createRoleDialog.$dom.find('[name="role"]');
                      if (action === 'ok' && $role.val() === '') {
                Severity: Major
                Found in vj4/ui/pages/domain_manage_role.page.js and 1 other location - About 2 hrs to fix
                vj4/ui/pages/domain_manage_user.page.js on lines 38..48

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

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                  const setRolesDialog = new ActionDialog({
                    $body: $('.dialog__body--set-role > div'),
                    onDispatch(action) {
                      const $role = setRolesDialog.$dom.find('[name="role"]');
                      if (action === 'ok' && $role.val() === '') {
                Severity: Major
                Found in vj4/ui/pages/domain_manage_user.page.js and 1 other location - About 2 hrs to fix
                vj4/ui/pages/domain_manage_role.page.js on lines 13..23

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

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

                  buildBodyData() {
                    const now = moment();
                    const days = [];
                    {
                      // back fill
                Severity: Minor
                Found in vj4/ui/components/calendar/index.js - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function _assignment_scoreboard has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                def _assignment_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
                  columns = []
                  columns.append({'type': 'rank', 'value': _('Rank')})
                  columns.append({'type': 'user', 'value': _('User')})
                  columns.append({'type': 'display_name', 'value': _('Display Name')})
                Severity: Minor
                Found in vj4/model/adaptor/contest.py - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                  function ensureAndGetSelectedRoles() {
                    const roles = _.map(
                      $('.domain-roles tbody [type="checkbox"]:checked'),
                      ch => $(ch).closest('tr').attr('data-role'),
                    );
                Severity: Major
                Found in vj4/ui/pages/domain_manage_role.page.js and 1 other location - About 2 hrs to fix
                vj4/ui/pages/domain_manage_user.page.js on lines 73..83

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

                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 ensureAndGetSelectedUsers() {
                    const users = _.map(
                      $('.domain-users tbody [type="checkbox"]:checked'),
                      ch => $(ch).closest('tr').attr('data-uid'),
                    );
                Severity: Major
                Found in vj4/ui/pages/domain_manage_user.page.js and 1 other location - About 2 hrs to fix
                vj4/ui/pages/domain_manage_role.page.js on lines 29..39

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

                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 const STATUS_TEXTS = {
                  [STATUS_WAITING]: 'Waiting',
                  [STATUS_ACCEPTED]: 'Accepted',
                  [STATUS_WRONG_ANSWER]: 'Wrong Answer',
                  [STATUS_TIME_LIMIT_EXCEEDED]: 'Time Exceeded',
                Severity: Major
                Found in vj4/ui/constant/record.js and 1 other location - About 2 hrs to fix
                vj4/ui/constant/record.js on lines 42..58

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 86.

                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 const STATUS_CODES = {
                  [STATUS_WAITING]: 'pending',
                  [STATUS_ACCEPTED]: 'pass',
                  [STATUS_WRONG_ANSWER]: 'fail',
                  [STATUS_TIME_LIMIT_EXCEEDED]: 'fail',
                Severity: Major
                Found in vj4/ui/constant/record.js and 1 other location - About 2 hrs to fix
                vj4/ui/constant/record.js on lines 23..39

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

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

                  render() {
                    return (
                      <Toolbar>
                        <ToolbarButton
                          disabled={this.props.isPosting || !this.props.pretestValid}
                Severity: Major
                Found in vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language