cmspsgp31/anubis

View on GitHub

Showing 120 of 120 total issues

Function getActionsMenu has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getActionsMenu() {
        if (this.props.actions.size == 0) return null;

        return (
            <ToolbarGroup>
Severity: Minor
Found in anubis/frontend/src/components/record_list.js - About 1 hr to fix

    Function renderFAB has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderFAB() {
            const isExpanded = this.state.expandFAB;
            const icon = (isExpanded) ?
                key => <NavigationClose key={key} /> :
                key => <ActionSearch key={key} />;
    Severity: Minor
    Found in anubis/frontend/src/components/TokenField/token_selector.js - About 1 hr to fix

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

              this.setState({tokens: this.props.expression.map((obj, i) => {
                  const key = obj.get('key');
                  let fieldset = this.props.fieldsets.get(key);
                  let values = obj.get('args', null);
                  const id = obj.get('index');
      Severity: Minor
      Found in anubis/frontend/src/components/TokenField/token_list.js - About 1 hr to fix

        Function renderGroup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderGroup(group) {
                const depth = group.get('__depth');
        
                const rootGroup = depth == 0;
                const offset = depth * 5;
        Severity: Minor
        Found in anubis/app/templates/record_list.jsx - About 1 hr to fix

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

                      let tiles = this.props.results.map(record => {
                          const id = record.get('id', null);
                          const link = (id) ? this.searchAndDetailsHtml(id) : null;
                          const groupName = (!id) ? record.get('__groupName') : null;
                          const extraStyle = (Item.getExtraStyle) ?
          Severity: Minor
          Found in anubis/frontend/src/components/record_list.js - About 1 hr to fix

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

                def get_filters(self):
                    if not self.is_multi_modeled:
                        return self.filters
            
                    def check_conversion(filter_name, filter_):
            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

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

                    params: RPropTypes.shape({
                        id: RPropTypes.string,
                        model: RPropTypes.string,
                        page: RPropTypes.string,
                        sorting: RPropTypes.string,
            Severity: Major
            Found in anubis/frontend/src/components/record_zoom.js and 2 other locations - About 1 hr to fix
            anubis/frontend/src/app.js on lines 81..87
            anubis/frontend/src/app.js on lines 88..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 59.

            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

                    user: IPropTypes.contains({
                        email: RPropTypes.string,
                        first_name: RPropTypes.string,
                        last_name: RPropTypes.string,
                        profile_link: RPropTypes.string,
            Severity: Major
            Found in anubis/frontend/src/app.js and 2 other locations - About 1 hr to fix
            anubis/frontend/src/app.js on lines 81..87
            anubis/frontend/src/components/record_zoom.js on lines 75..81

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

            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

                    if (!this.props.isSearch) {
                        this.fetchSearch(this.props.params);
                    }
                    else {
                        this.conditionalCache(this.props.params);
            Severity: Major
            Found in anubis/frontend/src/components/record_list.js and 1 other location - About 1 hr to fix
            anubis/frontend/src/components/record_zoom.js on lines 102..107

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

            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

                    sidebarLinks: IPropTypes.contains({
                        admin: RPropTypes.string,
                        list: IPropTypes.list,
                        login: RPropTypes.string,
                        logout: RPropTypes.string,
            Severity: Major
            Found in anubis/frontend/src/app.js and 2 other locations - About 1 hr to fix
            anubis/frontend/src/app.js on lines 88..94
            anubis/frontend/src/components/record_zoom.js on lines 75..81

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

            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

                    if (!this.props.hasDetails) {
                        this.fetchDetails(this.props.params);
                    }
                    else {
                        this.conditionalCache(this.props.params);
            Severity: Major
            Found in anubis/frontend/src/components/record_zoom.js and 1 other location - About 1 hr to fix
            anubis/frontend/src/components/record_list.js on lines 139..144

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

            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 database_forwards(self, app_label, schema_editor, from_state,
                                      to_state):
                    sql = "create or replace view {name} as {query};" \
                          .format(name=self.name, query=self.query)
            
            
            Severity: Major
            Found in anubis/operations/views.py and 1 other location - About 1 hr to fix
            anubis/operations/views.py on lines 59..64

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

            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 ElasticMatchPhrasePrefixFilter(ElasticFilter):
                def make_query_body(self, args):
                    text = args[0]
            
                    return {
            Severity: Major
            Found in anubis/elastic.py and 1 other location - About 1 hr to fix
            anubis/elastic.py on lines 270..277

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

            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

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

                renderAction() {
                    const open = !!this.props.currentAction;
            
                    let actionData = I.fromJS({});
            
            
            Severity: Minor
            Found in anubis/frontend/src/app.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

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

            class ElasticMatchPhraseFilter(ElasticFilter):
                def make_query_body(self, args):
                    text = args[0]
            
                    return {
            Severity: Major
            Found in anubis/elastic.py and 1 other location - About 1 hr to fix
            anubis/elastic.py on lines 283..290

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

            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 database_forwards(self, app_label, schema_editor, from_state,
                                      to_state):
                    sql = "create materialized view {name} as ({query});" \
                          .format(name=self.name, query=self.query)
            
            
            Severity: Major
            Found in anubis/operations/views.py and 1 other location - About 1 hr to fix
            anubis/operations/views.py on lines 39..44

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

            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

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

                def es_query(self, body, timeout=None, min_score=None, save_score=True,
                             save_highlights=True):
                    es_server = self.model.es_get_server()
                    path = self.model._elastic["path"]
                    body = dict(body)
            Severity: Minor
            Found in anubis/elastic.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

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

                    self.condition = "" if kwargs.get("condition", None) is None \
                                        else "when ( {} )".format(kwargs["condition"])
            Severity: Major
            Found in anubis/operations/triggers.py and 1 other location - About 1 hr to fix
            anubis/operations/triggers.py on lines 52..53

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

            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

                    self.condition = "" if kwargs.get("condition", None) is None \
                                        else "when ( {} )".format(kwargs["condition"])
            Severity: Major
            Found in anubis/operations/triggers.py and 1 other location - About 1 hr to fix
            anubis/operations/triggers.py on lines 115..116

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

            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

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

                def get_serialized_queryset(self, queryset):
                    if self.group_by is None:
                        return self.get_serializer(queryset, many=True).data
            
                    groupers = [getattr(self, "group_by_{}".format(g), None)
            Severity: Minor
            Found in anubis/views/state_view_mixin.py - 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

            Severity
            Category
            Status
            Source
            Language