bykovme/nswallet

View on GitHub
src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs

Summary

Maintainability
F
5 days
Test Coverage

File NSWalletDB.cs has 730 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using SQLite;
using System;
using System.Linq;
using NSWallet.Shared.Helpers.Logs.AppLog;
using System.Collections.Generic;
Severity: Major
Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 1 day to fix

    Class NSWalletDB has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public partial class NSWalletDB
        { 
            SQLiteConnection conn;
            string DBFile;
    
    
    Severity: Minor
    Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 5 hrs to fix

      Method UpdateIcon has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public bool UpdateIcon(string iconID, string name, byte[] blob = null, int groupID = -1, int isCircle = -1)
              {
                  try {
                      CheckConnection();
                      BeginTransaction();
      Severity: Minor
      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 1 hr to fix

        Method DeleteItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public void DeleteItem(string itemID, string changeTimestamp)
                {
                    try
                    {
                        CheckConnection();
        Severity: Minor
        Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 1 hr to fix

          Method CreateItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public void CreateItem(string itemID, string parentID, byte[] name, string icon,
                                         bool folder, string createTimestamp, string changeTimestamp, bool deleted)
                  {
                      try
                      {
          Severity: Minor
          Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 1 hr to fix

            Method CreateLabel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public bool CreateLabel(string fieldType, string name, string valueType, string icon, bool system, string changed, bool deleted)
                    {
                        try
                        {
                            CheckConnection();
            Severity: Minor
            Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 1 hr to fix

              Method CreateItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      public void CreateItem(string itemID, string parentID, byte[] name, string icon,
                                             bool folder, string createTimestamp, string changeTimestamp, bool deleted)
              Severity: Major
              Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 1 hr to fix

                Method CreateLabel has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        public bool CreateLabel(string fieldType, string name, string valueType, string icon, bool system, string changed, bool deleted)
                Severity: Major
                Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 50 mins to fix

                  Method CreateField has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          public void CreateField(string itemID, string fieldID, string type, byte[] value, string changeTimestamp, bool deleted, int sortWeight)
                  Severity: Major
                  Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 50 mins to fix

                    Method UpdateIcon has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            public bool UpdateIcon(string iconID, string name, byte[] blob = null, int groupID = -1, int isCircle = -1)
                    Severity: Minor
                    Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs - About 35 mins to fix

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

                              public void UpdateLabelIcon(string fieldType, string icon, string change)
                              {
                                  try
                                  {
                                      CheckConnection();
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 3 other locations - About 2 hrs to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 232..252
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 275..294
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 296..312

                      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 172.

                      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 4 locations. Consider refactoring.
                      Open

                              public void UpdateItemParentID(string itemID, string parentID, string change)
                              {
                                  try {
                                      CheckConnection();
                                      BeginTransaction();
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 3 other locations - About 2 hrs to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 211..230
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 232..252
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 275..294

                      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 172.

                      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 4 locations. Consider refactoring.
                      Open

                              public void UpdateItemIcon(string itemID, string icon, string change)
                              {
                                  try
                                  {
                                      CheckConnection();
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 3 other locations - About 2 hrs to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 211..230
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 232..252
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 296..312

                      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 172.

                      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 4 locations. Consider refactoring.
                      Open

                              public void UpdateLabelTitle(string fieldType, string name, string change)
                              {
                      
                                  try
                                  {
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 3 other locations - About 2 hrs to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 211..230
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 275..294
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 296..312

                      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 172.

                      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 TableQuery<nswallet_fields> RetrieveAllFields()
                              {
                                  try
                                  {
                                      CheckConnection();
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 1 other location - About 1 hr to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 679..691

                      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 105.

                      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 TableQuery<nswallet_items> RetrieveAllItems()
                              {
                                  try
                                  {
                                      CheckConnection();
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 1 other location - About 1 hr to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 693..705

                      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 105.

                      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

                              {
                                  try
                                  {
                                      CheckConnection();
                                      return conn.Table<nswallet_items>().Any(item => item.item_id == GConsts.ROOTID);
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 1 other location - About 1 hr to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 153..161

                      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 93.

                      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

                              {
                                  try {
                                      CheckConnection();
                                      return conn.Table<nswallet_items>().SingleOrDefault(item => item.item_id == GConsts.ROOTID);
                                  } catch (Exception ex) {
                      Severity: Major
                      Found in src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs and 1 other location - About 1 hr to fix
                      src/NSWallet/NSWallet.Shared/Database/NSWalletDB.cs on lines 139..150

                      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 93.

                      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

                      There are no issues that match your filters.

                      Category
                      Status