LarryHsiao/Nyx

View on GitHub
app/src/main/java/com/larryhsiao/nyx/attachment/AttachmentAdapter.java

Summary

Maintainability
C
7 hrs
Test Coverage

File AttachmentAdapter.java has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.larryhsiao.nyx.attachment;

import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;

    Method onCreateViewHolder has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @NonNull
        @Override
        public ViewHolder onCreateViewHolder(
            @NonNull ViewGroup parent, int viewType) {
            ViewHolder holder;

      Method onBindVideo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void onBindVideo(Uri uri, ViewHolder holder) {
              ImageView imageView =
                  holder.itemView.findViewById(R.id.itemAttachmentVideo_icon);
              if (new IsLocalExist(context, uri.toString()).value()) {
                  MediaMetadataRetriever mmr = new MediaMetadataRetriever();

        Method onBindPreview has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void onBindPreview(Uri uri, ViewHolder holder) {
                RichPreview preview = new RichPreview(new ResponseListener() {
                    @Override
                    public void onData(MetaData metaData) {
                        final View root = holder.getRootView();

          Avoid too many return statements within this method.
          Open

                      return ITEM_TYPE_VIDEO;
          Severity: Major
          Found in app/src/main/java/com/larryhsiao/nyx/attachment/AttachmentAdapter.java - About 30 mins to fix

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

                @Override
                public int getItemViewType(int position) {
                    final Uri uri = data.get(position);
                    final String mimeType = new UriMimeType(
                        context,
            Severity: Minor
            Found in app/src/main/java/com/larryhsiao/nyx/attachment/AttachmentAdapter.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

            Parameter name 'e' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
            Open

                        public void onError(Exception e) {

            Checks that method parameter names conform to a specified pattern.By using accessModifiers property it is possibleto specify different formats for methods at different visibility levels.

            To validate catch parameters please useCatchParameterName.

            To validate lambda parameters please useLambdaParameterName.

            This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

            First sentence of Javadoc is missing an ending period.
            Open

                /**

            Checks thatJavadoc summary sentence does not contain phrases that are not recommended to use.Summaries that contain only the {@inheritDoc} tag are skipped. Check alsoviolate Javadoc that does not contain first sentence.

            This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

            First sentence of Javadoc is missing an ending period.
            Open

                /**

            Checks thatJavadoc summary sentence does not contain phrases that are not recommended to use.Summaries that contain only the {@inheritDoc} tag are skipped. Check alsoviolate Javadoc that does not contain first sentence.

            This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

            First sentence of Javadoc is missing an ending period.
            Open

                /**

            Checks thatJavadoc summary sentence does not contain phrases that are not recommended to use.Summaries that contain only the {@inheritDoc} tag are skipped. Check alsoviolate Javadoc that does not contain first sentence.

            This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

            There are no issues that match your filters.

            Category
            Status