Showing 199 of 199 total issues

File home.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import hmac
import itertools

from bson import objectid
Severity: Minor
Found in vj4/handler/home.py - About 2 hrs to fix

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

    import collections
    import datetime
    import itertools
    import random
    from bson import objectid
    Severity: Minor
    Found in vj4/model/adaptor/problem.py - About 2 hrs to fix

      File error.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from vj4.model import builtin
      
      
      class Error(Exception):
        pass
      Severity: Minor
      Found in vj4/error.py - About 2 hrs to fix

        Function switchToTab has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async switchToTab(idx) {
            if (idx === this.currentIndex) {
              return;
            }
            if (this.isAnimating) {
        Severity: Major
        Found in vj4/ui/components/tab/Tab.js - About 2 hrs to fix

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

            tasks['constant'] = () => gulp
              .src('vj4/ui/constant/*.js')
              .pipe(plumber({ errorHandler }))
              .pipe(vjGenerateConstants())
              .pipe(gulp.dest('vj4/constant'))
          Severity: Major
          Found in scripts/build/config/gulp.js and 1 other location - About 2 hrs to fix
          scripts/build/config/gulp.js on lines 73..78

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

          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

            tasks['locale'] = () => gulp
              .src('vj4/locale/*.yaml')
              .pipe(plumber({ errorHandler }))
              .pipe(vjGenerateLocales())
              .pipe(gulp.dest('vj4/ui/static/locale'))
          Severity: Major
          Found in scripts/build/config/gulp.js and 1 other location - About 2 hrs to fix
          scripts/build/config/gulp.js on lines 66..71

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

          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

            postReply(id, value) {
              if (id === null) {
                return;
              }
              const req = request.post('', {
          Severity: Major
          Found in vj4/ui/components/messagepad/MessagePadInputContainer.js and 1 other location - About 2 hrs to fix
          vj4/ui/components/messagepad/MessagePadInputContainer.js on lines 39..55

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

          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

            postSend(placeholderId, uid, value) {
              if (placeholderId === null) {
                return;
              }
              const req = request.post('', {
          Severity: Major
          Found in vj4/ui/components/messagepad/MessagePadInputContainer.js and 1 other location - About 2 hrs to fix
          vj4/ui/components/messagepad/MessagePadInputContainer.js on lines 56..72

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

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

          async function load() {
            const loadSequence = [
              ...buildSequence(includedPages, 'before'),
              ...buildSequence([currentPage], 'before'),
              ...buildSequence(includedPages, 'after'),
          Severity: Minor
          Found in vj4/ui/Entry.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 buildBody has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            buildBody() {
              const data = this.buildBodyData();
              const $body = $('<div class="calendar__body"></div>');
              data.forEach(week => {
                const $row = $(tpl`<div class="calendar__row">
          Severity: Major
          Found in vj4/ui/components/calendar/index.js - About 2 hrs to fix

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

            export const LANG_CODEMIRROR_MODES = {
              c: 'text/x-csrc',
              cc: 'text/x-c++src',
              cs: 'text/x-csharp',
              pas: 'text/x-pascal',
            Severity: Major
            Found in vj4/ui/constant/language.js and 2 other locations - About 2 hrs to fix
            vj4/ui/constant/language.js on lines 3..17
            vj4/ui/constant/language.js on lines 19..33

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

            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

            export const LANG_TEXTS = {
              c: 'C',
              cc: 'C++',
              cs: 'C#',
              pas: 'Pascal',
            Severity: Major
            Found in vj4/ui/constant/language.js and 2 other locations - About 2 hrs to fix
            vj4/ui/constant/language.js on lines 19..33
            vj4/ui/constant/language.js on lines 35..49

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

            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

            export const LANG_HIGHLIGHT_ID = {
              c: 'c',
              cc: 'cpp',
              cs: 'csharp',
              pas: 'pascal',
            Severity: Major
            Found in vj4/ui/constant/language.js and 2 other locations - About 2 hrs to fix
            vj4/ui/constant/language.js on lines 3..17
            vj4/ui/constant/language.js on lines 35..49

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

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

              render() {
                return (
                  <Panel
                    title={(
                      <span>
            Severity: Minor
            Found in vj4/ui/components/scratchpad/ScratchpadPretestContainer.js - About 2 hrs to fix

              Function printLiteralOrObject has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              function printLiteralOrObject(v) {
                if (typeof v === 'number') {
                  print(String(v));
                  return;
                }
              Severity: Minor
              Found in scripts/build/utils/transformConstant.js - About 1 hr 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 smoothScrollPage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              const smoothScrollPage = new AutoloadPage('smoothScrollPage', null, () => {
                const HISTORY_SUPPORT = !!(typeof window.history === 'object' && window.history.pushState);
                const ANCHOR_REGEX = /^#[^ ]+$/;
                const OFFSET_HEIGHT = 10 + ($('.nav').height() || 0);
              
              
              Severity: Minor
              Found in vj4/ui/components/smoothscroll/smoothscroll.page.js - About 1 hr 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 multipart_argument has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              def multipart_argument(coro):
                @functools.wraps(coro)
                async def wrapped(self, **kwargs):
                  file_ids = list()
                  try:
              Severity: Minor
              Found in vj4/handler/base.py - About 1 hr 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 page has a Cognitive Complexity of 15 (exceeds 5 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: Minor
              Found in vj4/ui/pages/domain_manage_role.page.js - About 1 hr 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

              BASIC_PERMISSIONS = (
                  PERM_VIEW |
                  PERM_VIEW_PROBLEM |
                  PERM_VIEW_PROBLEM_SOLUTION |
                  PERM_VIEW_DISCUSSION |
              Severity: Major
              Found in vj4/model/builtin.py and 1 other location - About 1 hr to fix
              vj4/model/builtin.py on lines 206..213

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

              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

                  PERM_VIEW |
                  PERM_VIEW_PROBLEM |
                  PERM_EDIT_PROBLEM_SELF |
                  PERM_SUBMIT_PROBLEM |
                  PERM_READ_PROBLEM_DATA_SELF |
              Severity: Major
              Found in vj4/model/builtin.py and 1 other location - About 1 hr to fix
              vj4/model/builtin.py on lines 194..202

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

              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