Showing 126 of 199 total issues

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

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

    Function load has 40 lines of code (exceeds 25 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 1 hr to fix

      Function _assignment_stat has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _assignment_stat(tdoc, journal):
        effective = {}
        for j in journal:
          if j['pid'] in tdoc['pids'] and not (j['pid'] in effective and effective[j['pid']]['accept']):
            effective[j['pid']] = j
      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 smoothScrollPage has 39 lines of code (exceeds 25 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

        Function printLiteralOrObject has 39 lines of code (exceeds 25 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

          Function updateSelection has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function updateSelection(sendRequest = true) {
            dirtyCategories.forEach(({ type, category, subcategory }) => {
              let item = categories[category];
              const isSelected = item.select || _.some(item.children, c => c.select);
              setDomSelected(item.$tag, isSelected);
          Severity: Minor
          Found in vj4/ui/pages/problem_main.page.js - About 1 hr to fix

            Function attach has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              attach() {
                if (this.attached) {
                  return false;
                }
            
            
            Severity: Minor
            Found in vj4/ui/components/tab/Tab.js - About 1 hr to fix

              Function _show has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async _show() {
                  this.$dom.css('z-index', zIndexManager.getNext());
                  this.$dom.trigger('vjDomDialogShow');
                  this.isAnimating = true;
              
              
              Severity: Minor
              Found in vj4/ui/components/dialog/DomDialog.js - About 1 hr to fix

                Function __await__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def __await__(self):
                    try:
                      self.response = web.Response()
                      yield from HandlerBase.prepare(self).__await__()
                      yield from super(Handler, self).__await__()
                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 render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const orderedDialogues = _.orderBy(
                      _.values(this.props.dialogues),
                      dialogue => (dialogue.isPlaceholder
                        ? Number.POSITIVE_INFINITY
                Severity: Minor
                Found in vj4/ui/components/messagepad/MessagePadDialogueListContainer.js - About 1 hr to fix

                  Function apply has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    apply(compiler) {
                      compiler.plugin('emit', (compilation, callback) => {
                        const stats = compilation.getStats().toJson();
                        const manifest = _(stats.assets)
                          .map((asset) => {
                  Severity: Minor
                  Found in scripts/build/plugins/webpackStaticManifestPlugin.js - About 1 hr to fix

                    Function constructor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      constructor(events) {
                        this.$dom = $(tpl`
                          <div class="calendar">
                            <div class="calendar__header">
                              <button name="prev"><span class="icon icon-chevron_left"></span></button>
                    Severity: Minor
                    Found in vj4/ui/components/calendar/index.js - About 1 hr to fix

                      Function generateConstants has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function generateConstants() {
                      
                        let lastFile = null;
                        const packages = [];
                      
                      
                      Severity: Minor
                      Found in scripts/build/plugins/gulpGenerateConstants.js - About 1 hr to fix

                        Function navigationPage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const navigationPage = new AutoloadPage('navigationPage', () => {
                          if (!document.getElementById('panel') || !document.getElementById('menu')) {
                            return;
                          }
                          if ($nav.length > 0
                        Severity: Minor
                        Found in vj4/ui/components/navigation/navigation.page.js - About 1 hr to fix

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

                          export default function ({ watch, production }) {
                          
                            const compiler = webpack(webpackConfig({ watch, production }));
                          
                            const outputOptions = {
                          Severity: Minor
                          Found in scripts/build/runWebpack.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 paginate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def paginate(page, num_pages):
                            radius = 2
                            if page > 1:
                              yield 'first', 1
                              yield 'previous', page - 1
                          Severity: Minor
                          Found in vj4/util/misc.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 build_query has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def build_query(query_string):
                              category_groups = ProblemCategoryHandler.my_split(query_string, ' ')
                              if not category_groups:
                                return {}
                              query = {'$or': []}
                          Severity: Minor
                          Found in vj4/handler/problem.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 constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            constructor($dom, options = {}) {
                              super($dom);
                              this.options = {
                                items: async () => [],
                                render: () => '',
                          Severity: Minor
                          Found in vj4/ui/components/autocomplete/index.js - About 1 hr to fix

                            Function updateBody has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              async updateBody(direction) {
                                this.animating = true;
                                const $newBody = this.buildBody();
                                $newBody.appendTo(this.$dom.find('.calendar__body-container'));
                                if (this.$lastBody !== null) {
                            Severity: Minor
                            Found in vj4/ui/components/calendar/index.js - About 1 hr to fix

                              Function signinDialogPage has 30 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language