lightyears1998/a-cycle-maui

View on GitHub

Showing 12 of 14 total issues

Method RunFullSyncProtocolAsync has 177 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        private Task RunFullSyncProtocolAsync(WebsocketClient client, List<EntryMetadata> metadata)
        {
            var tcs = new TaskCompletionSource();

            var sendMessage = (WebSocketMessage message) =>
Severity: Major
Found in ACycle/Services/Synchronization/SynchronizationWorker.cs - About 7 hrs to fix

Method RunFullSyncProtocolAsync has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
Open

        private Task RunFullSyncProtocolAsync(WebsocketClient client, List<EntryMetadata> metadata)
        {
            var tcs = new TaskCompletionSource();

            var sendMessage = (WebSocketMessage message) =>
Severity: Minor
Found in ACycle/Services/Synchronization/SynchronizationWorker.cs - About 6 hrs 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

File SynchronizationWorker.cs has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using ACycle.Models;
using ACycle.Repositories;
using ACycle.Repositories.Entry;
using CommunityToolkit.Diagnostics;
using Microsoft.Extensions.Logging;
Severity: Minor
Found in ACycle/Services/Synchronization/SynchronizationWorker.cs - About 2 hrs to fix

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

        public async Task<string> MigrateDatabaseAsync(SQLiteAsyncConnection migrationDatabase)
        {
            StringBuilder migrationResultBuilder = new();
            long? lastSchemaVersion = null;
            long? schemaVersion = await migrationDatabase.GetSchemaAsync();
Severity: Minor
Found in ACycle/Services/DatabaseMigration/DatabaseMigrationService.cs - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public Uri HttpUri
        {
            get
            {
                var schema = UseTLS ? "https" : "http";
Severity: Minor
Found in ACycle/Models/User/SynchronizationEndpoint.cs and 1 other location - About 45 mins to fix
ACycle/Models/User/SynchronizationEndpoint.cs on lines 46..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 77.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public Uri WsUri
        {
            get
            {
                var schema = UseTLS ? "wss" : "ws";
Severity: Minor
Found in ACycle/Models/User/SynchronizationEndpoint.cs and 1 other location - About 45 mins to fix
ACycle/Models/User/SynchronizationEndpoint.cs on lines 37..44

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 77.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Consider simplifying this complex logical expression.
Open

            if (SynchronizationEnabled)
            {
                var connectionProfiles = Connectivity.Current.ConnectionProfiles;
                var isEthernetConnected = connectionProfiles.Any(profile => profile == ConnectionProfile.Ethernet);
                var isWiFiConnected = connectionProfiles.Any(profile => profile == ConnectionProfile.WiFi);
Severity: Major
Found in ACycle/Services/Synchronization/SynchronizationService.cs - About 40 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            public DiaryRelay(Diary item, Func<DiaryRelay, (ICommand EditCommand, ICommand RemoveCommand)> commandBuilder) : base(item)
            {
                var commands = commandBuilder(this);
                EditCommand = commands.EditCommand;
                RemoveCommand = commands.RemoveCommand;
Severity: Minor
Found in ACycle/ViewModels/DiaryViewModel.cs and 1 other location - About 35 mins to fix
ACycle/ViewModels/ActivityViewModel.cs on lines 155..160

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            public ActivityRelay(Activity item, Func<ActivityRelay, (ICommand EditCommand, ICommand RemoveCommand)> commandBuilder) : base(item)
            {
                var commands = commandBuilder(this);
                EditCommand = commands.EditCommand;
                RemoveCommand = commands.RemoveCommand;
Severity: Minor
Found in ACycle/ViewModels/ActivityViewModel.cs and 1 other location - About 35 mins to fix
ACycle/ViewModels/DiaryViewModel.cs on lines 189..194

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        {
            get => _migrationDatabasePath;
            set
            {
                if (SetProperty(ref _migrationDatabasePath, value))
Severity: Minor
Found in ACycle/ViewModels/DatabaseMigrationViewModel.cs and 1 other location - About 30 mins to fix
ACycle/ViewModels/DiaryViewModel.cs on lines 36..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        {
            get => _selectedDiary;
            set
            {
                if (SetProperty(ref _selectedDiary, value))
Severity: Minor
Found in ACycle/ViewModels/DiaryViewModel.cs and 1 other location - About 30 mins to fix
ACycle/ViewModels/DatabaseMigrationViewModel.cs on lines 20..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this method.
Open

            return tcs.Task;
Severity: Major
Found in ACycle/Services/Synchronization/SynchronizationWorker.cs - About 30 mins to fix
Severity
Category
Status
Source
Language