Showing 126 of 199 total issues

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

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

          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

          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

            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

                    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

                      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

                        Function reducer has 47 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, '']));
                        Severity: Minor
                        Found in vj4/ui/components/messagepad/reducers/inputs.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language