LarryHsiao/Nyx

View on GitHub

Showing 49 of 153 total issues

Method fire has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void fire() {
        final List<Tag> remoteUpdates = new ArrayList<>();
        final Map<Long, Tag> localTagMap = localTags
            .all()
Severity: Minor
Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncTagsAction.java - About 45 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 fire has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void fire() {
        final List<Metadata> remoteUpdates = new ArrayList<>();
        final Map<Long, Metadata> localMetadataMap = localMetadataSet.all()
            .stream()
Severity: Minor
Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncMetadataAction.java - About 45 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 sync has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void sync() {
        try {
            if (isSyncing) {
                return;
Severity: Minor
Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncImpl.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 updateRemotes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void updateRemotes(List<Jot> remoteUpdates) {
        final List<Future<?>> asyncFuture = new ArrayList<>();
        for (Jot remoteUpdate : remoteUpdates) {
            if (remoteUpdate.deleted()) {
                asyncFuture.add(
Severity: Minor
Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncJotsAction.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 calculate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private long calculate(File file) {
        if (file.isDirectory()) {
            long result = 0;
            File[] files = file.listFiles();
            if (files == null) {
Severity: Minor
Found in app/src/main/java/com/larryhsiao/nyx/attachment/FileSize.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 save has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
Open

    suspend fun save() = withContext(IO) {
        preferTags()
        val savedJot = nyx.jots().update(object : WrappedJot(jot.value ?: ConstJot()) {
            override fun content() = content.value ?: ""
            override fun title() = title.value ?: ""
Severity: Minor
Found in app/src/main/java/com/larryhsiao/nyx/jot/JotViewModel.kt - 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

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

        @Override
        public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
    
            if (requestCode == REQUEST_CODE_PICK_FILE && resultCode == RESULT_OK) {
    Severity: Minor
    Found in app/src/main/java/com/larryhsiao/nyx/attachment/AttachmentsFragment.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 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

    Severity
    Category
    Status
    Source
    Language