Showing 126 of 199 total issues

Function get_problem_multi has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_problem_multi(domain_id: str, pid: document.convert_doc_id,
Severity: Minor
Found in vj4/model/record.py - About 45 mins to fix

    Function checkResources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function checkResources() {
      for (let i = res.length - 1; i >= 0; --i) {
        if (res[i].detached || !document.body.contains(res[i].$dom[0])) {
          if (!res[i].detached) {
            res[i].detach();
    Severity: Minor
    Found in vj4/ui/components/DOMAttachedObject.js - About 45 mins 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 footerPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const footerPage = new AutoloadPage('footerPage', () => {
      if ($('.footer').length === 0) {
        return;
      }
      $('.footer__category.expandable > h1').click(async ev => {
    Severity: Minor
    Found in vj4/ui/components/footer/footer.page.js - About 45 mins 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 _acm_stat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _acm_stat(tdoc, journal):
      naccept = collections.defaultdict(int)
      effective = {}
      for j in journal:
        if j['pid'] in tdoc['pids'] and not (j['pid'] in effective and effective[j['pid']]['accept']):
    Severity: Minor
    Found in vj4/model/adaptor/contest.py - About 45 mins 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 a Cognitive Complexity of 8 (exceeds 5 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: Minor
    Found in vj4/ui/components/messagepad/reducers/dialogues.js - About 45 mins 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 ip2geo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def ip2geo(ip: str, locale: str='en'):
      if _reader is None:
        return 'Not available'
    
      # Map VJ locale string to MaxMind locale string
    Severity: Minor
    Found in vj4/util/geoip.py - About 45 mins 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 get_all_multi has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def get_all_multi(end_id: objectid.ObjectId=None, get_hidden: bool=False, *, fields=None,
    Severity: Minor
    Found in vj4/model/record.py - About 35 mins to fix

      Function updateOpenState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        updateOpenState() {
          if (this.isFocus && this.$dom.val().length >= this.options.minChar) {
            if (!this.isOpen) {
              this.open();
              this.renderList();
      Severity: Minor
      Found in vj4/ui/components/autocomplete/index.js - About 35 mins 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 signinDialogPage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const signinDialogPage = new AutoloadPage('signinDialogPage', null, () => {
        const signInDialog = DomDialog.getOrConstruct($('.dialog--signin'), {
          cancelByClickingBack: true,
          cancelByEsc: true,
        });
      Severity: Minor
      Found in vj4/ui/components/signin/signInDialog.page.js - About 35 mins 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 generateConstants has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function generateConstants() {
      
        let lastFile = null;
        const packages = [];
      
      
      Severity: Minor
      Found in scripts/build/plugins/gulpGenerateConstants.js - About 35 mins 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 componentDidUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        componentDidUpdate(prevProps) {
          const node = this.refs.list;
          if (this.props.activeId !== prevProps.activeId) {
            this.scrollToBottom = true;
            this.scrollWithAnimation = false;
      Severity: Minor
      Found in vj4/ui/components/messagepad/MessagePadDialogueContentContainer.js - About 35 mins 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 _get_difficulty has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_difficulty(pdoc, calculated_difficulty):
        # allow admin set difficulty
        setting = pdoc.get('difficulty_setting', next(iter(problem.SETTING_DIFFICULTY_RANGE)))
        if setting == problem.SETTING_DIFFICULTY_ALGORITHM:
          return calculated_difficulty
      Severity: Minor
      Found in vj4/job/difficulty.py - About 35 mins 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

      Avoid too many return statements within this function.
      Open

        return join_settings
      Severity: Major
      Found in vj4/model/domain.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return {
                ...state,
                [id]: data,
              };
        Severity: Major
        Found in vj4/ui/components/messagepad/reducers/dialogues.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return calculated_difficulty
          Severity: Major
          Found in vj4/job/difficulty.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return {
                  ...state,
                  records: {
                    ...state.records,
                    isLoading: true,
            Severity: Major
            Found in vj4/ui/components/scratchpad/reducers/ui.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return state;
              Severity: Major
              Found in vj4/ui/components/messagepad/reducers/dialogues.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return {
                      ...state,
                      records: {
                        ...state.records,
                        isLoading: false,
                Severity: Major
                Found in vj4/ui/components/scratchpad/reducers/ui.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return {
                        ...state,
                        [id]: false,
                      };
                  Severity: Major
                  Found in vj4/ui/components/messagepad/reducers/isPosting.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return {
                            ...state,
                            [id]: '',
                          };
                    Severity: Major
                    Found in vj4/ui/components/messagepad/reducers/inputs.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language