bykovme/nswallet

View on GitHub
src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs

Summary

Maintainability
C
1 day
Test Coverage

Class FileService has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

    public class FileService : IFile
    {
        const string DATABASE_IOS_FOLDER = @"/.nsw/nswallet";

        public string CheckOldFile()
Severity: Minor
Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs - About 2 hrs to fix

    FIXME found
    Open

                return GetInternalDirPath(); // FIXME

    FIXME found
    Open

                return ""; // FIXME

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            public List<string> ReadZip(string path)
            {
                try {
                    var zip = ZipFile.OpenRead(path);
                    var entries = new List<string>();
    Severity: Major
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 2 other locations - About 1 hr to fix
    src/NSWallet/Droid/Interfaces/FileService.cs on lines 195..212
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 175..198

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

    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

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

            public IEnumerable<string> GetFilePaths(string path)
            {
                try {
                    return Directory.EnumerateFiles(path);
                } catch (DirectoryNotFoundException ex) {
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 1 other location - About 55 mins to fix
    src/NSWallet/Droid/Interfaces/FileService.cs on lines 95..104

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            public string ReadFromFile(string path)
            {
                try {
                    using (var streamReader = new StreamReader(path)) {
                        string content = streamReader.ReadToEnd();
    Severity: Major
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 2 other locations - About 55 mins to fix
    src/NSWallet/Droid/Interfaces/FileService.cs on lines 182..193
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 162..173

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            public void WriteInFile(string path, string content)
            {
                try {
                    using (var streamWriter = new StreamWriter(path, false)) {
                        streamWriter.WriteLine(content);
    Severity: Major
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 2 other locations - About 50 mins to fix
    src/NSWallet/Droid/Interfaces/FileService.cs on lines 171..180
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 151..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 82.

    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

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

            public bool CreateZip(string pathSourceFolder, string pathDestinationFolder, string fileName)
            {
                try {
                    ZipFile.CreateFromDirectory(pathSourceFolder, pathDestinationFolder + "/" + fileName);
                    return true;
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 1 other location - About 50 mins to fix
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 213..225

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

    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

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

            public byte[] GetBytesFromFile(string path)
            {
                try {
                    var bytes = File.ReadAllBytes(path);
                    return bytes;
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 1 other location - About 45 mins to fix
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 227..239

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

    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

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

            {
                string dbFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + DATABASE_IOS_FOLDER;
    
                if (!Directory.Exists(dbFolderPath)) {
                    Directory.CreateDirectory(dbFolderPath);
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 1 other location - About 45 mins to fix
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 34..42

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            public long GetFileSize(string path)
            {
                try {
                    var fi = new FileInfo(path);
                    return fi.Length;
    Severity: Major
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 2 other locations - About 40 mins to fix
    src/NSWallet/Droid/Interfaces/FileService.cs on lines 123..132
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 89..98

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

    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

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

            public string GetTempFolder()
            {
                try {
                    var temp = NSFileManager.DefaultManager.GetTemporaryDirectory().Path;
                    return temp;
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 1 other location - About 40 mins to fix
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 264..276

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

    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

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

            public string GetInternalDirPath()
            {
                string dbFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + DATABASE_IOS_FOLDER;
    
                if (!Directory.Exists(dbFolderPath)) {
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 1 other location - About 40 mins to fix
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 48..58

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            public bool RemoveDirectoryWithContents(string path)
            {
                try {
                    Directory.Delete(path, true);
                    return true;
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 2 other locations - About 35 mins to fix
    src/NSWallet/Droid/Interfaces/FileService.cs on lines 262..271
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 250..262

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

            public void MoveFile(string pathFrom, string pathTo)
            {
                try {
                    File.Move(pathFrom, pathTo);
                } catch (Exception ex) {
    Severity: Minor
    Found in src/NSWallet/NSWallet.Mac/Interfaces/FileService.cs and 2 other locations - About 35 mins to fix
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 124..131
    src/NSWallet/iOS/Interfaces/FileService.cs on lines 241..248

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

    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