Abhi347/NoobFileChooser

View on GitHub

Showing 11 of 24 total issues

NoobFile has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

public class NoobFile {
    private String mName;
    private String mMimeType;
    private String mDocId;
    private Uri mUri;

    NoobFileActivity has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class NoobFileActivity extends AppCompatActivity implements NoobFileFragmentDelegate, NoobDrawerFragmentDelegate {
    
        @BindView(R2.id.drawer_noob_activity)
        protected DrawerLayout mDrawerLayout;
    
    

      Method takePermission has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static boolean takePermission(final Activity activity, final String permission, final String rationaleMessage, final boolean shouldShowDialog) {
              if (checkPermission(activity, permission))
                  return true;
              boolean shouldRequestPermission = true;
              if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && shouldShowDialog && activity.shouldShowRequestPermissionRationale(permission)) {

        Method initializeRecyclerView has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected void initializeRecyclerView() {
        
                turnOnMultiSelectMode(false);
        
                mFileRecyclerView.setHasFixedSize(true);

          Method getNameFromUri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
              public static String getNameFromUri(Uri uri, Context context) {
                  String title = null;
                  if (isRootUri(uri)) {
                      DocumentFile documentFile = DocumentFile.fromTreeUri(context, uri);

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

              public boolean renameTo(String fileName) {
                  if (getDocumentFile() != null) {
                      boolean success = getDocumentFile().renameTo(fileName);
                      if (success)
                          mIsInvalid = true;

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

              @Override
              protected void onActivityResult(int requestCode, int resultCode, Intent data) {
                  if (resultCode == RESULT_OK) {
                      boolean result = false;
                      if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {

          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

          Avoid too many return statements within this method.
          Open

                  return NoobManager.getInstance().getConfig().getFileDrawableResource();

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

                public boolean addStorage(NoobStorage storage) {
                    if (mNoobStorageList != null) {
                        for (NoobStorage store : mNoobStorageList) {
                            if (storage.toString().equalsIgnoreCase(store.toString())) {
                                store.load(storage);

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

                public boolean loadImage(ImageView imageView) {
                    if (mThumbnail == null && isImageFile()) {
                        if (mDocumentFile != null)
                            loadThumbnailSAF(imageView.getContext());
                        else

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

                public List<NoobFile> getChildren() {
                    List<NoobFile> children = new ArrayList<>();
                    if (getDocumentFile() != null) {
                        DocumentFile[] _files = getDocumentFile().listFiles();
                        for (DocumentFile docFile : _files) {

            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