patrickfav/under-the-hood

View on GitHub

Showing 108 of 108 total issues

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

            @Override
            public SpinnerElement getValue() {
                String currentId = prefs.getString(backendIdPrefKey, defaultId);
                if (currentId != null) {
                    for (SpinnerElement element : elements) {

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 saveState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Parcelable saveState() {
        Bundle state = new Bundle();
        if (viewPager != null) {
            for (int i = 0; i < viewPager.getChildCount(); i++) {
Severity: Minor
Found in hood-core/src/main/java/at/favre/lib/hood/view/DebugViewPageAdapter.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 createSectionSourceControlAndCI has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static Section.HeaderSection createSectionSourceControlAndCI(@Nullable String scmRev, @Nullable String scmBranch, @Nullable String scmCommitDate,
                                                                        @Nullable String ciBuildId, @Nullable String ciBuildJob, @Nullable String ciBuildTime) {
        Section.ModifiableHeaderSection section = Hood.ext().createSection("Source Control & CI");
        if (scmBranch != null) {
            section.add(Hood.get().createPropertyEntry("scm-branch", scmBranch));

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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void add(@Nullable PageEntry<?> pageEntry) {
        if (pageEntry != null) {
            entries.add(pageEntry);
            ViewTemplate<?> template = pageEntry.createViewTemplate();
Severity: Minor
Found in hood-core/src/release/java/at/favre/lib/hood/internal/DebugPage.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 setContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        @Override
        public void setContent(final Map.Entry<CharSequence, KeyValueEntry.Value<String>> entry, @NonNull final View view) {
            ((TextView) view.findViewById(R.id.key)).setText(entry.getKey());
            TextView tvValue = view.findViewById(R.id.value);

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 createPmServiceInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<PageEntry<?>> createPmServiceInfo(@NonNull PackageInfo packageInfo) {
        List<PageEntry<?>> entries = new ArrayList<>();
        if (packageInfo.services != null) {
            for (ServiceInfo service : packageInfo.services) {
                if (service != null) {
Severity: Minor
Found in hood-core/src/main/java/at/favre/lib/hood/util/PackageInfoAssembler.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 createPmBroadcastReceiversInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<PageEntry<?>> createPmBroadcastReceiversInfo(@NonNull PackageInfo packageInfo) {
        List<PageEntry<?>> entries = new ArrayList<>();
        if (packageInfo.receivers != null) {
            for (ActivityInfo receiver : packageInfo.receivers) {
                if (receiver != null) {
Severity: Minor
Found in hood-core/src/main/java/at/favre/lib/hood/util/PackageInfoAssembler.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 createPmActivitiesInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<PageEntry<?>> createPmActivitiesInfo(@NonNull PackageInfo packageInfo) {
        List<PageEntry<?>> entries = new ArrayList<>();
        if (packageInfo.activities != null) {
            for (ActivityInfo receiver : packageInfo.activities) {
                if (receiver != null) {
Severity: Minor
Found in hood-core/src/main/java/at/favre/lib/hood/util/PackageInfoAssembler.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