Showing 199 of 199 total issues

File problem.py has 718 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import functools
import io
import os.path
import zipfile
Severity: Major
Found in vj4/handler/problem.py - About 1 day to fix

    Function default has 203 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function (env = {}) {
      function eslintLoader() {
        return {
          loader: 'eslint-loader',
          options: {
    Severity: Major
    Found in scripts/build/config/webpack.js - About 1 day to fix

      File builtin.py has 498 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import collections
      import datetime
      import functools
      import itertools
      
      
      Severity: Minor
      Found in vj4/model/builtin.py - About 7 hrs to fix

        File contest.py has 491 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import asyncio
        import collections
        import datetime
        import functools
        import itertools
        Severity: Minor
        Found in vj4/model/adaptor/contest.py - About 7 hrs to fix

          Function buildBodyData has 179 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            File base.py has 424 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import accept
            import asyncio
            import calendar
            import functools
            import hmac
            Severity: Minor
            Found in vj4/handler/base.py - About 6 hrs to fix

              File homework.py has 394 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import asyncio
              import collections
              import datetime
              import io
              import pytz
              Severity: Minor
              Found in vj4/handler/homework.py - About 5 hrs to fix

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

                const page = new NamedPage('domain_manage_user', () => {
                  const addUserSelector = UserSelectAutoComplete.getOrConstruct($('.dialog__body--add-user [name="user"]'));
                  const addUserDialog = new ActionDialog({
                    $body: $('.dialog__body--add-user > div'),
                    onDispatch(action) {
                Severity: Major
                Found in vj4/ui/pages/domain_manage_user.page.js - About 5 hrs to fix

                  File document.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import itertools
                  from bson import objectid
                  from pymongo import ReturnDocument
                  
                  from vj4 import db
                  Severity: Minor
                  Found in vj4/model/document.py - About 4 hrs to fix

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

                    async function handleSectionCollapse(ev) {
                      const $section = $(ev.currentTarget).closest('.training__section');
                      if ($section.is('.collapsed, .animating')) {
                        return;
                      }
                    Severity: Major
                    Found in vj4/ui/pages/training_detail.page.js and 1 other location - About 4 hrs to fix
                    vj4/ui/pages/training_detail.page.js on lines 4..15

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

                    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

                    async function handleSectionExpand(ev) {
                      const $section = $(ev.currentTarget).closest('.training__section');
                      if ($section.is('.expanded, .animating')) {
                        return;
                      }
                    Severity: Major
                    Found in vj4/ui/pages/training_detail.page.js and 1 other location - About 4 hrs to fix
                    vj4/ui/pages/training_detail.page.js on lines 17..28

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

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

                    const page = new NamedPage('domain_manage_user', () => {
                      const addUserSelector = UserSelectAutoComplete.getOrConstruct($('.dialog__body--add-user [name="user"]'));
                      const addUserDialog = new ActionDialog({
                        $body: $('.dialog__body--add-user > div'),
                        onDispatch(action) {
                    Severity: Minor
                    Found in vj4/ui/pages/domain_manage_user.page.js - About 4 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

                    File contest.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import asyncio
                    import calendar
                    import datetime
                    import io
                    import pytz
                    Severity: Minor
                    Found in vj4/handler/contest.py - About 4 hrs to fix

                      File index.js has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import _ from 'lodash';
                      import moment from 'moment';
                      import tpl from 'vj/utils/tpl';
                      
                      export default class Calendar {
                      Severity: Minor
                      Found in vj4/ui/components/calendar/index.js - About 4 hrs to fix

                        Function invoke_by_args has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def invoke_by_args():
                          import argparse
                          import asyncio
                          import coloredlogs
                          import inspect
                        Severity: Minor
                        Found in vj4/util/argmethod.py - About 4 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

                        File discussion.py has 328 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import asyncio
                        import functools
                        from bson import objectid
                        
                        from vj4 import app
                        Severity: Minor
                        Found in vj4/handler/discussion.py - About 3 hrs to fix

                          Function main has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def main():
                            if not options.syslog:
                              coloredlogs.install(level=logging.DEBUG if options.debug else logging.INFO,
                                                  fmt='[%(levelname).1s %(asctime)s %(module)s:%(lineno)d] %(message)s',
                                                  datefmt='%y%m%d %H:%M:%S')
                          Severity: Minor
                          Found in vj4/server.py - About 3 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

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

                          import asyncio
                          import collections
                          import datetime
                          import functools
                          
                          
                          Severity: Minor
                          Found in vj4/handler/domain.py - About 3 hrs to fix

                            Function layout has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  .map(banners => {
                                    const dayBitmap = _
                                      .fill(new Array(7), 1)
                                      .map(() => []);
                                    banners.forEach(banner => {
                            Severity: Major
                            Found in vj4/ui/components/calendar/index.js - About 3 hrs to fix

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

                                      <ToolbarButton
                                        activated={this.props.pretestVisible}
                                        onClick={() => this.props.togglePanel('pretest')}
                                        data-global-hotkey="alt+p"
                                        data-tooltip={`${i18n('Toggle Pretest Panel')} (Alt+P)`}
                              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 134..143

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language