Nick9500/ministocks

View on GitHub

Showing 105 of 108 total issues

Method choiceWithCallback has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

            Context context,
            String title,
            String negativeButtonText,
            final CharSequence[] choices,
            final InputAlertCallable callable
Severity: Minor
Found in src/main/java/nitezh/ministock/DialogTools.java - About 35 mins to fix

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

            if (value != null && !value.equals("")) {
                String[] items = value.split(":");
                mHour = Integer.parseInt(items[0]);
                mMinute = Integer.parseInt(items[1]);
            }
    src/main/java/nitezh/ministock/activities/PreferencesActivity.java on lines 778..782

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

    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

                    if (value != null) {
                        String[] items = value.split(":");
                        mHour = Integer.parseInt(items[0]);
                        mMinute = Integer.parseInt(items[1]);
                    }
    src/main/java/nitezh/ministock/activities/PreferencesActivity.java on lines 367..371

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

    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

    Method query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
            if (!TextUtils.isEmpty(selection)) {
                throw new IllegalArgumentException("selection not allowed for " + uri);
            }
    Severity: Minor
    Found in src/main/java/nitezh/ministock/SymbolProvider.java - About 35 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

    Method getImageViewSrcId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private int getImageViewSrcId(String backgroundStyle, Boolean useLargeFont) {
            Integer imageViewSrcId;
            switch (backgroundStyle) {
                case "transparent":
                    if (useLargeFont) {
    Severity: Minor
    Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - About 35 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

    Method updateFromGlobal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private void updateFromGlobal(SharedPreferences sharedPreferences, String key, int valType) {
            // Unregister the listener whenever a key changes
            getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
    
            // Update the widget preferences with the interval
    Severity: Minor
    Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - About 35 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

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

            } else {
                if (useLargeFont) {
                    views = new RemoteViews(packageName, R.layout.widget_1x2_large);
                } else {
                    views = new RemoteViews(packageName, R.layout.widget_1x2);
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 121..127
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 115..121
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 109..115

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

    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 4 locations. Consider refactoring.
    Open

            } else if (widget.getSize() == 2) {
                if (useLargeFont) {
                    views = new RemoteViews(packageName, R.layout.widget_2x2_large);
                } else {
                    views = new RemoteViews(packageName, R.layout.widget_2x2);
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 127..133
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 121..127
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 109..115

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

    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 4 locations. Consider refactoring.
    Open

            if (widget.getSize() == 1) {
                if (useLargeFont) {
                    views = new RemoteViews(packageName, R.layout.widget_1x4_large);
                } else {
                    views = new RemoteViews(packageName, R.layout.widget_1x4);
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 127..133
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 121..127
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 115..121

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

    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 4 locations. Consider refactoring.
    Open

            } else if (widget.getSize() == 3) {
                if (useLargeFont) {
                    views = new RemoteViews(packageName, R.layout.widget_2x4_large);
                } else {
                    views = new RemoteViews(packageName, R.layout.widget_2x4);
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 127..133
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 115..121
    src/main/java/nitezh/ministock/activities/widget/WidgetView.java on lines 109..115

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

    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 4 locations. Consider refactoring.
    Open

        @Override
        public void putLong(String key, Long value) {
            if (this.editor == null) this.editor = this.preferences.edit();
            this.editor.putFloat(key, value);
        }
    Severity: Major
    Found in src/main/java/nitezh/ministock/PreferenceStorage.java and 3 other locations - About 30 mins to fix
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 63..67
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 92..96
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 98..102

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

    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 4 locations. Consider refactoring.
    Open

        @Override
        public void putInt(String key, int value) {
            if (this.editor == null) this.editor = this.preferences.edit();
            this.editor.putInt(key, value);
        }
    Severity: Major
    Found in src/main/java/nitezh/ministock/PreferenceStorage.java and 3 other locations - About 30 mins to fix
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 92..96
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 98..102
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 104..108

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

    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 4 locations. Consider refactoring.
    Open

        @Override
        public void putBoolean(String key, Boolean value) {
            if (this.editor == null) this.editor = this.preferences.edit();
            this.editor.putBoolean(key, value);
        }
    Severity: Major
    Found in src/main/java/nitezh/ministock/PreferenceStorage.java and 3 other locations - About 30 mins to fix
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 63..67
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 98..102
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 104..108

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

    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 4 locations. Consider refactoring.
    Open

        @Override
        public void putFloat(String key, Float value) {
            if (this.editor == null) this.editor = this.preferences.edit();
            this.editor.putFloat(key, value);
        }
    Severity: Major
    Found in src/main/java/nitezh/ministock/PreferenceStorage.java and 3 other locations - About 30 mins to fix
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 63..67
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 92..96
    src/main/java/nitezh/ministock/PreferenceStorage.java on lines 104..108

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

    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

            if (dailyChangeValue != null && quantityValue != null) {
                plDailyChange = String.format(Locale.getDefault(), "%.0f", dailyChangeValue * quantityValue);
            }
    Severity: Minor
    Found in src/main/java/nitezh/ministock/domain/WidgetStock.java and 1 other location - About 30 mins to fix
    src/main/java/nitezh/ministock/domain/WidgetStock.java on lines 122..124

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

    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

            if (priceChangeValue != null && quantityValue != null) {
                plTotalChange = String.format(Locale.getDefault(), "%.0f", priceChangeValue * quantityValue);
            }
    Severity: Minor
    Found in src/main/java/nitezh/ministock/domain/WidgetStock.java and 1 other location - About 30 mins to fix
    src/main/java/nitezh/ministock/domain/WidgetStock.java on lines 118..120

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

    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

    Method getLabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private String getLabel(int widgetDisplay) {
            // Set the widget view text in the footer
            String label = "";
            if (widget.isNarrow()) {
                switch (ViewType.values()[widgetDisplay]) {
    Severity: Minor
    Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - About 25 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

    Method buildRequestUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private String buildRequestUrl(List<String> symbols) {
            StringBuilder sQuery = new StringBuilder();
            for (String s : symbols) {
                if (!s.equals("")) {
                    if (!sQuery.toString().equals("")) {

    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

    Method buildRequestUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private String buildRequestUrl(List<String> symbols) {
            StringBuilder sQuery = new StringBuilder();
            for (String s : symbols) {
                if (!s.equals("")) {
                    if (!sQuery.toString().equals("")) {
    Severity: Minor
    Found in src/main/java/nitezh/ministock/dataaccess/YahooStockQuoteRepository.java - About 25 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

    Method buildRequestUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private String buildRequestUrl(List<String> symbols) {
            StringBuilder sQuery = new StringBuilder();
            for (String s : symbols) {
                if (!s.equals("")) {
                    if (!sQuery.toString().equals("")) {
    Severity: Minor
    Found in src/main/java/nitezh/ministock/dataaccess/IexStockQuoteRepository.java - About 25 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