cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

        private int stbi__parse_uncompressed_block()
        {
            var header = new byte[4];
            var len = 0;
            var nlen = 0;

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

            private string FormParagraphs(string text, bool unhash = true, bool createParagraphs = true)
            {
                // split on two or more newlines
                string[] grafs = _newlinesMultiple.Split(_newlinesLeadingTrailing.Replace(text, ""));
    
    

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

              private Vector3[] TransposeMultSubtract(IReadOnlyList<Vector3> vectors1, IReadOnlyList<Vector4> vectors2, Vector3 vec1Centroid, Vector3 vec2Centroid, Vector3[] covariance) {
                  for (var i = 0; i < 3; i++) { //i is the row in this matrix
                      covariance[i] = Vector3.Zero;
                  }
      
      

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

                public static IEnumerable<IEnumerable<T>> ComputeClusters(IEnumerable<T> collection, Func<T, T, double> weightFunction, Func<T, T, double, bool> connectionFunction = null, int? maxIterations = null) {
                    Graph graph = CreateGraph(collection, weightFunction, connectionFunction);
                    int iterationIndex = 0;
                    bool isChanged = false;
                    Dictionary<int, double> weightMap = new Dictionary<int, double>();

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

                  public static UnityAction<string> SetOnValueChangedAction(this TMP_InputField self, Func<string, bool> onValueChanged) {
                      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 105..111
          CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensions.cs on lines 133..139

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

          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 static UnityAction<bool> SetOnValueChangedAction(this Toggle self, Func<bool, bool> onValueChanged) {
                      if (self.onValueChanged != null && self.onValueChanged.GetPersistentEventCount() > 0) {
                          Log.w("Overriding old onValueChanged listener for toggle " + self, self.gameObject);
                      }
                      self.onValueChanged = new Toggle.ToggleEvent(); // clear previous onValueChanged listeners
          CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensions.cs on lines 133..139
          CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiInputFieldExtensions.cs on lines 71..77

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

          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 static UnityAction<float> SetOnValueChangedAction(this Slider self, Func<float, bool> onValueChanged) {
                      if (self.onValueChanged != null && self.onValueChanged.GetPersistentEventCount() > 0) {
                          Log.w("Overriding old onValueChanged listener for slider " + self, self.gameObject);
                      }
                      self.onValueChanged = new Slider.SliderEvent(); // clear previous onValueChanged listeners
          CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensions.cs on lines 105..111
          CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiInputFieldExtensions.cs on lines 71..77

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

          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

                  private static void GetColorAt(byte[] img, int x, int y, int bytesPerPixel, int width, byte[] color) {
                      int startIdx = (y * width + x) * bytesPerPixel;
                      for (int i = 0; i < bytesPerPixel; i++) {
                          color[i] = img[startIdx + i];
                      }
          CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Filter.cs on lines 179..184

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

          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

                  private static void GetColorAt(double[] img, int x, int y, int bytesPerPixel, int width, double[] color) {
                      int startIdx = (y * width + x) * bytesPerPixel;
                      for (int i = 0; i < bytesPerPixel; i++) {
                          color[i] = img[startIdx + i];
                      }
          CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Filter.cs on lines 106..111

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

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

                      ref VertexHelper vh,
                      Vector2 center,
                      float width,
                      float height,
                      RoundedProperties roundedProperties,

            Method ResizeV2 has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public static bool ResizeV2(this Texture2D self, float width, float height = 0, bool hasMipMap = true, FilterMode filter = FilterMode.Bilinear,
                                                                           float horCropCenter = 0.5f, float vertCropCenter = 0.5f, float horF = 1, float vertF = 1) {

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

                      private void CreateMenuEntryUis() {
                          foreach (string e in field.contentEnum) {
                              var entry = menuEntriesContainer.AddChild(Instantiate(menuEntryPrefab));
                              entry.GetComponentInChildren<Text>().textLocalized(e);
                              entry.GetComponentInChildren<Button>().SetOnClickAction(delegate {

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

                        public BitapResult Search(string text)
                        {
                            if (!_options.caseSensitive)
                            {
                                text = text.ToLower();

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

                          private JObject ObjectUnpatch(JObject obj, JObject patch)
                          {
                              if (obj == null)
                                  obj = new JObject();
                              if (patch == null)

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

                        private string[] diff_halfMatchI(string longtext, string shorttext, int i) {
                          // Start with a 1/4 length Substring at position i as a seed.
                          string seed = longtext.Substring(i, longtext.Length / 4);
                          int j = -1;
                          string best_common = string.Empty;

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

                              private JObject ObjectPatch(JObject obj, JObject patch)
                              {
                                  if (obj == null)
                                      obj = new JObject();
                                  if (patch == null)

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

                                private static byte[] Dilation1D(byte[] imageData, int width, int height, int bytePerPixel, int kernelSize, bool horizontal) {
                                    byte[] dilatedImage = new byte[imageData.Length];
                        
                                    for (int y = 0; y < height; y++) {
                                        for (int x = 0; x < width; x++) {

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

                                  public static ImageInfo? FromStream(Stream stream)
                                  {
                                      ImageInfo? info = null;
                          
                                      if (JpgDecoder.Test(stream))

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

                                    private static object SetSingleton<T, V>(this Injector self, object caller, V singletonInstance, bool overrideExisting = false) where V : T {
                                        lock (syncLock) {
                                            singletonInstance.ThrowErrorIfNull("singletonInstance");
                                            if (!overrideExisting && typeof(T).IsCastableTo<IDisposableV2>()) {
                                                // Cause a injector cleanup if there is a present singleton and this singleton is disposed:

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

                                      private void CalculateAlphaPatchMatch(byte[] trimap, List<Point> foregroundBoundary, List<Point> backgroundBoundary, out Sample[][] samples) {
                                          int w = width;
                                          int h = height;
                              
                                          var t = Log.MethodEntered("Calc forground and background distances");
                                Severity
                                Category
                                Status
                                Source
                                Language