morrisjdev/FileContextCore

View on GitHub

Showing 34 of 167 total issues

Method UseFileContextDatabase has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

            [NotNull] this DbContextOptionsBuilder<TContext> optionsBuilder,
            string databaseName = "",
            string location = null,
            string password = null,
            [CanBeNull] FileContextDatabaseRoot databaseRoot = null,
Severity: Minor
Found in FileContextCore/Extensions/FileContextDbContextOptionsExtensions.cs - About 45 mins to fix

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

                private IPropertyBase InferPropertyFromInner(Expression expression)
                {
                    if (expression is MethodCallExpression methodCallExpression
                        && methodCallExpression.Method.IsGenericMethod
                        && methodCallExpression.Method.GetGenericMethodDefinition() == EntityMaterializerSource.TryReadValueMethod)
    FileContextCore/Query/Internal/FileContextQueryExpression.cs on lines 314..324

    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

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

                if (!EntityType.IsAssignableFrom(navigation.DeclaringEntityType)
                    && !navigation.DeclaringEntityType.IsAssignableFrom(EntityType))
                {
                    throw new InvalidOperationException(
                        $"Called EntityProjectionExpression.AddNavigationBinding() with incorrect INavigation. " +
    Severity: Minor
    Found in FileContextCore/Query/Internal/EntityProjectionExpression.cs and 1 other location - About 40 mins to fix
    FileContextCore/Query/Internal/EntityProjectionExpression.cs on lines 75..81

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

    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

                if (!EntityType.IsAssignableFrom(navigation.DeclaringEntityType)
                    && !navigation.DeclaringEntityType.IsAssignableFrom(EntityType))
                {
                    throw new InvalidOperationException(
                        $"Called EntityProjectionExpression.BindNavigation() with incorrect INavigation. " +
    Severity: Minor
    Found in FileContextCore/Query/Internal/EntityProjectionExpression.cs and 1 other location - About 40 mins to fix
    FileContextCore/Query/Internal/EntityProjectionExpression.cs on lines 62..68

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

    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

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

            private static Func<IFileContextTable> CreateFactory<TKey>(IKey key, IEntityType entityType, bool sensitiveLoggingEnabled, IFileContextScopedOptions options, IServiceProvider serviceProvider)
    Severity: Minor
    Found in FileContextCore/Storage/Internal/FileContextTableFactory.cs - About 35 mins to fix

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

                          using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write))
                          {
                              cs.Write(clearBytes, 0, clearBytes.Length);
                              cs.Dispose();
                          }
      Severity: Minor
      Found in FileContextCore/FileManager/EncryptedFileManager.cs and 1 other location - About 35 mins to fix
      FileContextCore/FileManager/EncryptedFileManager.cs on lines 118..122

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

      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

                          using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write))
                          {
                              cs.Write(cipherBytes, 0, cipherBytes.Length);
                              cs.Dispose();
                          }
      Severity: Minor
      Found in FileContextCore/FileManager/EncryptedFileManager.cs and 1 other location - About 35 mins to fix
      FileContextCore/FileManager/EncryptedFileManager.cs on lines 139..143

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

      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 _inMemoryStore.GetIntegerValueGenerator<sbyte>(property);

        Avoid too many return statements within this method.
        Open

                        return arr.ToArray();
        Severity: Major
        Found in FileContextCore/Serializer/SerializerHelper.cs - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return Enum.Parse(type, input);
          Severity: Major
          Found in FileContextCore/Serializer/SerializerHelper.cs - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return _inMemoryStore.GetIntegerValueGenerator<ulong>(property);

              Avoid too many return statements within this method.
              Open

                              return _inMemoryStore.GetIntegerValueGenerator<uint>(property);

                Avoid too many return statements within this method.
                Open

                                return _inMemoryStore.GetIntegerValueGenerator<ushort>(property);

                  Method Initialize has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                          public void Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory)
                          {
                              _options = options;
                              _entityType = entityType;
                              _propertyKeys = entityType.GetProperties().Select(p => p.GetColumnName()).ToArray();
                  Severity: Minor
                  Found in FileContextCore/StoreManager/EXCELStoreManager.cs - 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