cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

Method LoadModelIntoGeneratedView has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        private static async Task LoadModelIntoGeneratedView(ViewStack viewStack, ModelToJsonSchema schemaGenerator, JsonSchema schema) {
            MyUserModel model = NewExampleUserInstance();
            {
                await Dialog.ShowInfoDialog("Manually connecting the model instance to the view", "First an example to connect the " +
                    "model to a generated view via a manual presenter 'MyManualPresenter1'", "Show manual presenter example");

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

            private static byte[] GetColorAt(byte[] img, int x, int y, int bytesPerPixel, int width) {
                var startIdx = (y * width + x) * bytesPerPixel;
                return new byte[] { img[startIdx], img[startIdx + 1], img[startIdx + 2], img[startIdx + 3] };
            }
    CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/GenerateCutOut.cs on lines 63..66

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

    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

            private static byte[] GetColorAt(byte[] img, int x, int y, int bytesPerPixel, int width) {
                var startIdx = (y * width + x) * bytesPerPixel;
                return new byte[] { img[startIdx], img[startIdx + 1], img[startIdx + 2], img[startIdx + 3] };
            }
    CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/TrimapGeneration.cs on lines 42..45

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

    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

                        case Positions.OuterTop:
                            topLeft.x = pixelRect.xMin;
                            topLeft.y = pixelRect.yMax + Properties[i].Size;
    
                            ShapeUtils.Rects.AddVerticalTwoColorRect(
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/UiShapes/EdgeGradient.cs on lines 76..89

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

    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

                        case Positions.Bottom:
                            topLeft.x = pixelRect.xMin;
                            topLeft.y = pixelRect.yMin + Properties[i].Size;
    
                            ShapeUtils.Rects.AddVerticalTwoColorRect(
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/UiShapes/EdgeGradient.cs on lines 121..134

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

    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 static UnityAction<string> SetOnValueChangedActionThrottled(this TMP_InputField self, Action<string> onValueChanged, double delayInMs = 500) {
                if (self.onValueChanged != null && self.onValueChanged.GetPersistentEventCount() > 0) {
                    Log.w("Overriding old onValueChanged listener for input field " + self, self.gameObject);
                }
                self.onValueChanged = new TMP_InputField.OnChangeEvent(); // clear previous onValueChanged listeners
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensions.cs on lines 168..174

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

    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

                        case Positions.OuterLeft:
                            topLeft.x = pixelRect.xMin - Properties[i].Size;
                            topLeft.y = pixelRect.yMax;
    
                            ShapeUtils.Rects.AddHorizontalTwoColorRect(
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/UiShapes/EdgeGradient.cs on lines 106..119

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

    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 static UnityAction<float> SetOnValueChangedActionThrottled(this Slider self, Action<float> onValueChanged, double delayInMs = 200) {
                if (self.onValueChanged != null && self.onValueChanged.GetPersistentEventCount() > 0) {
                    Log.w("Overriding old onValueChanged listener for input field " + self, self.gameObject);
                }
                self.onValueChanged = new Slider.SliderEvent(); // clear previous onValueChanged listeners
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiInputFieldExtensions.cs on lines 11..17

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

    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

                        case Positions.Right:
                            topLeft.x = pixelRect.xMax - Properties[i].Size;
                            topLeft.y = pixelRect.yMax;
    
                            ShapeUtils.Rects.AddHorizontalTwoColorRect(
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/UiShapes/EdgeGradient.cs on lines 151..164

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

    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 OnPopulateMesh has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
    Open

            protected override void OnPopulateMesh(VertexHelper vh)    {
                vh.Clear();
    
                Rect pixelRect = RectTransformUtility.PixelAdjustRect(rectTransform, canvas);
    
    

    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 AddRoundedRectLine has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                ref VertexHelper vh,
                Vector2 center,
                float width,
                float height,
                UI.GeoUtils.OutlineProperties outlineProperties,

      Method Fetch has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
      Open

              public void Fetch(TransactionService trans, DataService data)
              {
                  // empty document buffer
                  this.Documents.Clear();
      
      

      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 patch_make has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
      Open

          public List<Patch> patch_make(string text1, List<Diff> diffs) {
            // Check for null inputs not needed since null can't be passed in C#.
            List<Patch> patches = new List<Patch>();
            if (diffs.Count == 0) {
              return patches;  // Get rid of the null case.

      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 Normalize has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
      Open

              private string Normalize(string text)
              {
                  var output = new StringBuilder(text.Length);
                  var line = new StringBuilder();
                  bool valid = false;

      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

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

              [Obsolete("Use CalcEntryChangesToOldState instead", true)]
              public static void CalcEntryChanges<K, V>(this IDictionary<K, V> oldState, IDictionary<K, V> newState, Action<KeyValuePair<K, V>> onEntryAdded, Action<KeyValuePair<K, V>> onEntryUpdated, Action<K> onEntryRemoved) {
                  CalcEntryChanges(oldState, newState, getKey: x => x.Key, onEntryAdded, onEntryUpdated, onEntryRemoved);
              }
      CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/model/immutable/IEnumerableDiffHelpers.cs on lines 10..13

      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

              [Obsolete("Use CalcEntryChangesToOldStateV2 instead", true)]
              public static void CalcEntryChangesV2<K, V>(this IReadOnlyDictionary<K, V> oldState, IReadOnlyDictionary<K, V> newState, Action<KeyValuePair<K, V>> onEntryAdded, Action<KeyValuePair<K, V>> onEntryUpdated, Action<K> onEntryRemoved) {
                  CalcEntryChanges(oldState, newState, getKey: x => x.Key, onEntryAdded, onEntryUpdated, onEntryRemoved);
              }
      CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/model/immutable/IEnumerableDiffHelpers.cs on lines 19..22

      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 static Query Or(params Query[] queries)
              {
                  if (queries == null || queries.Length < 2) throw new ArgumentException("At least two Query should be passed");
      
                  var left = queries[0];
      CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Engine/Query/Query.cs on lines 221..232

      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 static Query And(params Query[] queries)
              {
                  if (queries == null || queries.Length < 2) throw new ArgumentException("At least two Query should be passed");
      
                  var left = queries[0];
      CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Engine/Query/Query.cs on lines 248..259

      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

      Method SetUnitPositionData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public static void SetUnitPositionData(
                  ref UnitPositionData unitPositionData,
                  int resolution,
                  float baseAngle = 0.0f,
                  float direction = 1.0f

        Method EnsureIndex has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public bool EnsureIndex(string collection, string field, bool unique = false)
                {
                    if (collection.IsNullOrWhiteSpace()) throw new ArgumentNullException(nameof(collection));
                    if (!CollectionIndex.IndexPattern.IsMatch(field)) throw new ArgumentException("Invalid field format pattern: " + CollectionIndex.IndexPattern.ToString(), "field");
                    if (field == "_id") return false; // always exists
          Severity
          Category
          Status
          Source
          Language