Showing 126 of 199 total issues

Function slideDown has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function slideDown($element, duration, fromCss = {}, toCss = {}) {
  const originalStyl = $element.attr('style') || '';
  $element.css({
    position: 'absolute',
    visibility: 'none',
Severity: Minor
Found in vj4/ui/utils/slide.js - About 1 hr to fix

    Function _hide has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async _hide() {
        this.$dom.trigger('vjDomDialogHide');
        this.isAnimating = true;
    
        $(document).off(`keyup.${this.eventNS}`);
    Severity: Minor
    Found in vj4/ui/components/dialog/DomDialog.js - About 1 hr to fix

      Function connection_route has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def connection_route(prefix, name, global_route=False):
        def decorate(conn):
          conn.GLOBAL = global_route
          async def handler(msg, session):
            try:
      Severity: Minor
      Found in vj4/app.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 _oi_scoreboard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _oi_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 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 get_setting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_setting(self, key):
          if self.has_priv(builtin.PRIV_USER_PROFILE):
            if key in self.user:
              return self.user[key]
            if key in self.domain_user:
      Severity: Minor
      Found in vj4/model/adaptor/setting.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const page = new NamedPage('homework_main', () => {
        // Homework Calendar
        if (Context.docs) {
          const events = Context.docs.map(doc => ({
            beginAt: doc.begin_at * 1000,
      Severity: Minor
      Found in vj4/ui/pages/homework_main.page.js - About 1 hr to fix

        Function __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def __init__(self):
            middlewares = []
            if options.sentry_dsn:
              middlewares.append(SentryMiddleware({
                'dsn': options.sentry_dsn,
        Severity: Minor
        Found in vj4/app.py - About 1 hr to fix

          Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              return (
                <SplitPane
                  defaultSize={this.props.ui.main.size}
                  minSize={250}
          Severity: Minor
          Found in vj4/ui/components/scratchpad/index.js - About 1 hr to fix

            Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const { data } = this.props;
                const submitAt = parseMongoId(data._id).timestamp * 1000;
                return (
                  <tr onClick={ev => this.handleRowClick(ev, data._id)}>
            Severity: Minor
            Found in vj4/ui/components/scratchpad/ScratchpadRecordsRowContainer.js - About 1 hr to fix

              Function touch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function touch(mtime) {
              
                async function touchFile(file) {
                  const fd = await fs.open(file.path, 'a');
                  try {
              Severity: Minor
              Found in scripts/build/plugins/gulpTouch.js - About 1 hr to fix

                Function handleClickRemoveSelected has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async function handleClickRemoveSelected() {
                    const selectedUsers = ensureAndGetSelectedUsers();
                    if (selectedUsers === null) {
                      return;
                    }
                Severity: Minor
                Found in vj4/ui/pages/domain_manage_user.page.js - About 1 hr to fix

                  Function onCommentClickEdit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function onCommentClickEdit(mode, ev) {
                    const $evTarget = $(ev.currentTarget);
                  
                    if (CommentBox.get($evTarget)) {
                      CommentBox
                  Severity: Minor
                  Found in vj4/ui/components/discussion/comments.page.js - About 1 hr to fix

                    Function default has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function (env = {}) {
                      function eslintLoader() {
                        return {
                          loader: 'eslint-loader',
                          options: {
                    Severity: Minor
                    Found in scripts/build/config/webpack.js - About 55 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 constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      constructor(name, autoload, afterLoading, beforeLoading) {
                        if (process.env.NODE_ENV !== 'production') {
                          if (typeof name !== 'string' && !(name instanceof Array)) {
                            // eslint-disable-next-line quotes
                            throw new Error(`'name' should be a string or [string]`);
                    Severity: Minor
                    Found in vj4/ui/misc/PageLoader.js - About 55 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 highlightBlocks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      highlightBlocks: $dom => {
                        $dom.find('pre code').get().forEach(code => {
                          const $pre = $(code).parent();
                          $pre.addClass('syntax-hl');
                          if ($pre.closest('[data-syntax-hl-show-line-number]')) {
                    Severity: Minor
                    Found in vj4/ui/components/highlighter/prismjs.js - About 55 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_scoreboard has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _acm_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
                    Severity: Major
                    Found in vj4/model/adaptor/contest.py - About 50 mins to fix

                      Function get_user_in_problem_multi has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def get_user_in_problem_multi(uid: int, domain_id: str, pid: document.convert_doc_id,
                      Severity: Major
                      Found in vj4/model/record.py - About 50 mins to fix

                        Function _oi_scoreboard has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def _oi_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
                        Severity: Major
                        Found in vj4/model/adaptor/contest.py - About 50 mins to fix

                          Function _assignment_scoreboard has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def _assignment_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
                          Severity: Major
                          Found in vj4/model/adaptor/contest.py - About 50 mins to fix

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

                            def sanitize(func):
                              @functools.wraps(func)
                              def wrapped(self, **kwargs):
                                new_kwargs = {}
                                for key, value in kwargs.items():
                            Severity: Minor
                            Found in vj4/handler/base.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

                            Severity
                            Category
                            Status
                            Source
                            Language