Abhi347/NoobFileChooser

View on GitHub
noobfilechooser/src/main/java/com/noob/noobfilechooser/models/NoobFile.java

Summary

Maintainability
B
5 hrs
Test Coverage

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;

    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

    Avoid too many return statements within this method.
    Open

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

      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

      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

      There are no issues that match your filters.

      Category
      Status