cmspsgp31/anubis

View on GitHub

Showing 120 of 120 total issues

File state_view_mixin.py has 581 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright © 2016, Ugo Pozo
#             2016, Câmara Municipal de São Paulo

# state_view_mixin.py - a mixin for views that perform searches.

Severity: Major
Found in anubis/views/state_view_mixin.py - About 1 day to fix

    File record_list.js has 507 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright © 2016, Ugo Pozo
    //             2016, Câmara Municipal de São Paulo
    
    // record_list.js - component for listing records that match a search.
    
    
    Severity: Major
    Found in anubis/frontend/src/components/record_list.js - About 1 day to fix

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

          class Or(Type):
              fields = ("left", "right")
      
              @staticmethod
              def repr(expr):
      Severity: Major
      Found in anubis/url.py and 1 other location - About 7 hrs to fix
      anubis/url.py on lines 67..80

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

      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

          class And(Type):
              fields = ("left", "right")
      
              @staticmethod
              def repr(expr):
      Severity: Major
      Found in anubis/url.py and 1 other location - About 7 hrs to fix
      anubis/url.py on lines 82..94

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

      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

      File app.js has 461 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright © 2016, Ugo Pozo
      //             2016, Câmara Municipal de São Paulo
      
      // app.js - main component of the search interface.
      
      
      Severity: Minor
      Found in anubis/frontend/src/app.js - About 7 hrs to fix

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

            def handle_and_expression(self, left_expression, right_expression,
                                      left_parens, right_parens):
                if left_parens:
                    left_expression = [dict(self.left_parens_token)] + \
                        left_expression + [dict(self.right_parens_token)]
        Severity: Major
        Found in anubis/aggregators.py and 1 other location - About 6 hrs to fix
        anubis/aggregators.py on lines 187..197

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

        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

            def handle_or_expression(self, left_expression, right_expression,
                                      left_parens, right_parens):
                if left_parens:
                    left_expression = [dict(self.left_parens_token)] + \
                        left_expression + [dict(self.right_parens_token)]
        Severity: Major
        Found in anubis/aggregators.py and 1 other location - About 6 hrs to fix
        anubis/aggregators.py on lines 175..185

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

        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

        StateViewMixin has 41 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class StateViewMixin:
            """A mixin that performs a search and adds the result to the view context.
        
            This mixin reads from a supposedly pre-filled :attr:`kwargs` attribute,
            performs a search on the database based on the supplied configuration and
        Severity: Minor
        Found in anubis/views/state_view_mixin.py - About 5 hrs to fix

          Function renderAction has 118 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              renderAction() {
                  const open = !!this.props.currentAction;
          
                  let actionData = I.fromJS({});
          
          
          Severity: Major
          Found in anubis/frontend/src/app.js - About 4 hrs to fix

            File editor_token.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Copyright © 2016, Ugo Pozo
            //             2016, Câmara Municipal de São Paulo
            
            // editor_token.js - token with the editing capabilities for the TokenField.
            
            
            Severity: Minor
            Found in anubis/frontend/src/components/TokenField/editor_token.js - About 4 hrs to fix

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

                  render() {
                      let contents = (
                          <div style={{textAlign: "center"}}>
                              <CircularProgress
                                  size={80}
              Severity: Major
              Found in anubis/frontend/src/components/record_list.js - About 4 hrs to fix

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

                    render() {
                        let style = Object.assign({}, this.props.style, {
                            height: 24,
                            padding: 8,
                            marginBottom: 12,
                Severity: Major
                Found in anubis/frontend/src/components/TokenField/editor_token.js - About 4 hrs to fix

                  Function get_application_data has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_application_data(self):
                          react_search_route = "{}/{}{}{}{}".format(
                              self.search_slug,
                              ":model/" if self.is_multi_modeled else "",
                              ":page/" if self.is_paginated else "",
                  Severity: Minor
                  Found in anubis/views/app_view_mixin.py - About 4 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

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

                  class AddGINTrigramIndex(AddCustomIndex):
                      reduces_to_sql = True
                      reversible = True
                  
                      def __init__(self, model, field_name):
                  Severity: Major
                  Found in anubis/operations/indexes.py and 1 other location - About 4 hrs to fix
                  anubis/operations/indexes.py on lines 79..91

                  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

                  class AddTrigramIndex(AddCustomIndex):
                      reduces_to_sql = True
                      reversible = True
                  
                      def __init__(self, model, field_name):
                  Severity: Major
                  Found in anubis/operations/indexes.py and 1 other location - About 4 hrs to fix
                  anubis/operations/indexes.py on lines 93..105

                  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

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

                  def shell_output(*args, **kwargs):
                      kwargs.update(stdout=subprocess.PIPE, shell=True)
                  
                      proc = subprocess.Popen(*args, **kwargs)
                      try:
                  Severity: Major
                  Found in setup.py and 1 other location - About 4 hrs to fix
                  anubis/app/management/commands/compilejs.py on lines 47..58

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

                  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

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

                  def shell_output(*args, **kwargs):
                      kwargs.update(stdout=subprocess.PIPE, shell=True)
                  
                      proc = subprocess.Popen(*args, **kwargs)
                      try:
                  Severity: Major
                  Found in anubis/app/management/commands/compilejs.py and 1 other location - About 4 hrs to fix
                  setup.py on lines 44..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 75.

                  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

                      def handle_or_expression(self, left_expression, right_expression,
                                               left_parens, right_parens):
                          left_open, left_close = self.open_close_parens(left_parens)
                          right_open, right_close = self.open_close_parens(right_parens)
                  
                  
                  Severity: Major
                  Found in anubis/aggregators.py and 1 other location - About 3 hrs to fix
                  anubis/aggregators.py on lines 264..279

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

                  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

                      def handle_and_expression(self, left_expression, right_expression,
                                                left_parens, right_parens):
                          left_open, left_close = self.open_close_parens(left_parens)
                          right_open, right_close = self.open_close_parens(right_parens)
                  
                  
                  Severity: Major
                  Found in anubis/aggregators.py and 1 other location - About 3 hrs to fix
                  anubis/aggregators.py on lines 281..296

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

                  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

                      get searchHtml() {
                          /*eslint-disable no-unused-vars */
                          const model = this.props.params.model;
                          const expr = this.props.params.splat;
                          const page = this.props.params.page;
                  Severity: Major
                  Found in anubis/frontend/src/components/record_zoom.js and 2 other locations - About 3 hrs to fix
                  anubis/frontend/src/app.js on lines 134..143
                  anubis/frontend/src/components/record_list.js on lines 179..188

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

                  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