cmspsgp31/anubis

View on GitHub

Showing 58 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

      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

        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

                  Function getSortingMenu has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      getSortingMenu() {
                          if (!this.props.sorting.get('available')) return null;
                  
                          const available = this.props.sorting.getIn(['available',
                                                                      this.props.modelName]);
                  Severity: Major
                  Found in anubis/frontend/src/components/record_list.js - About 2 hrs to fix

                    Function renderError has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        renderError() {
                            let error = this.props.globalError;
                    
                            const showErrorDialog = !!error && this.props.showErrorDetails;
                            const showErrorSnackbar = !!error && !this.props.showErrorDetails;
                    Severity: Major
                    Found in anubis/frontend/src/app.js - About 2 hrs to fix

                      Function renderUserInfo has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          renderUserInfo() {
                              let userShow;
                      
                              const firstName = this.props.user.get('first_name', "");
                      
                      
                      Severity: Major
                      Found in anubis/frontend/src/app.js - About 2 hrs to fix

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

                            render() {
                                let title = "Carregando...";
                        
                                let contents = (
                                    <div style={{textAlign: "center"}}>
                        Severity: Major
                        Found in anubis/frontend/src/components/record_zoom.js - About 2 hrs to fix

                          File app_view_mixin.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          # Copyright © 2016, Ugo Pozo
                          #             2016, Câmara Municipal de São Paulo
                          
                          # app_view_mixin.py - mixin for providing a view for the basic search interface.
                          
                          
                          Severity: Minor
                          Found in anubis/views/app_view_mixin.py - About 2 hrs to fix

                            File token_list.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // Copyright © 2016, Ugo Pozo
                            //             2016, Câmara Municipal de São Paulo
                            
                            // token_list.js - a list of tokens in a TokenField.
                            
                            
                            Severity: Minor
                            Found in anubis/frontend/src/components/TokenField/token_list.js - About 2 hrs to fix

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

                                  render() {
                                      let navHeader;
                              
                                      if (I.is(this.props.user, I.Map())) {
                                          navHeader = this.renderLogin();
                              Severity: Major
                              Found in anubis/frontend/src/app.js - About 2 hrs to fix

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

                                    render() {
                                        const styles = this.state.tokens.map(token => ({
                                            key: `token_${token.props.id}`,
                                            data: token,
                                            style: {
                                Severity: Major
                                Found in anubis/frontend/src/components/TokenField/token_list.js - About 2 hrs to fix

                                  File unit_token.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  // Copyright © 2016, Ugo Pozo
                                  //             2016, Câmara Municipal de São Paulo
                                  
                                  // unit_token.js - token representing a unit search.
                                  
                                  
                                  Severity: Minor
                                  Found in anubis/frontend/src/components/TokenField/unit_token.js - About 2 hrs to fix

                                    Function get_templates has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def get_templates(self):
                                            from django.template.loader import get_template
                                    
                                            def render(template):
                                                return get_template("{}.js".format(template)).render()
                                    Severity: Minor
                                    Found in anubis/views/app_view_mixin.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 perform_actions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def perform_actions(self):
                                            action_name = self.request.POST.get('action_name', None)
                                            action = self.actions.get(action_name, None)
                                    
                                            self.action_result = {
                                    Severity: Minor
                                    Found in anubis/views/state_view_mixin.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language