cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

        internal override IEnumerable<IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index)
        {
            // define order
            var order = _start.CompareTo(_end) <= 0 ? Query.Ascending : Query.Descending;

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

        protected int diff_commonOverlap(string text1, string text2) {
          // Cache the text lengths to prevent multiple calls.
          int text1_length = text1.Length;
          int text2_length = text2.Length;
          // Eliminate the null case.

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

              private void ThreadBasedDispatchLoop(Action threadInit, Action threadFinally) {
                  if (threadInit != null) threadInit();
                  try {
                      // If the scheduler is disposed, the cancellation token will be set and
                      // we'll receive an OperationCanceledException.  That OCE should not crash the process.

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

                    internal IDisposable TryObtainLock(TimeSpan timeout)
                    {
                        // In case of zero-timeout, don't even wait for protective lock contention
                        if (timeout == TimeSpan.Zero)
                        {

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

                  private static int stbi__high_bit(uint z)
                  {
                      var n = 0;
                      if (z == 0)
                          return -1;

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

                    public Matrix4x4 SolveKabsch(IReadOnlyList<Vector3> inPoints, IReadOnlyList<Vector4> refPoints, bool solveRotation = true, bool solveScale = false) {
                        var inPointsCount = inPoints.Count;
                        if (inPointsCount != refPoints.Count) { throw new InvalidDataException($"Length of the point lists was not equal: {inPointsCount} vs {refPoints.Count}"); }
            
                        //Calculate the centroid offset and construct the centroid-shifted point matrices

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

                      private void CreateTagIndex()
                      {
                          // The next 4 bytes are the size of the Exif data.
                          ReadUShort();
              
              

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

                            public Matrix4x4 SolveKabsch(Vector3[] inPoints, Vector4[] refPoints, bool solveRotation = true, bool solveScale = false) {
                                if (inPoints.Length != refPoints.Length) { return Matrix4x4.identity; }
                
                                //Calculate the centroid offset and construct the centroid-shifted point matrices
                                Vector3 inCentroid = Vector3.zero;

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

                          public virtual bool ExtractFieldDocu(JsonSchema field, MemberInfo m, Type modelType, JTokenType t, object pInstance, JToken jpInstance) {
                              var descrAttr = m?.GetCustomAttribute<DescriptionAttribute>(true);
                              if (descrAttr != null) {
                                  field.description = descrAttr.description;
                                  field.defaultVal = descrAttr.defaultVal;

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

                            private void TestTexture2dVsRawByteLoadingSpeeds() {
                                var img = links.Get<Image>("Image1");
                                img.type = Image.Type.Simple;
                                img.preserveAspect = true;
                    
                    

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

                              public override async Task<GameObject> NewIntegerFieldView(JsonSchema field) {
                                  if (field.minimum != null && field.maximum != null) {
                                      if (field.readOnly == true) { return await LoadFieldViewPrefab(progressFieldPrefab); }
                                      return await LoadFieldViewPrefab(sliderFieldPrefab);
                                  }
                      CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/jsonschema/JsonSchemaToView.cs on lines 68..75

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

                      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 override async Task<GameObject> NewFloatFieldView(JsonSchema field) {
                                  if (field.minimum != null && field.maximum != null) {
                                      if (field.readOnly == true) { return await LoadFieldViewPrefab(progressFieldPrefab); }
                                      return await LoadFieldViewPrefab(sliderFieldPrefab);
                                  }
                      CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/jsonschema/JsonSchemaToView.cs on lines 59..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 104.

                      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 void AddUserLineWithJsonResultStructure<T>(this ICollection<ChatGpt.Line> self, string userMessage, T exampleResponse) {
                                  self.Add(new ChatGpt.Line(ChatGpt.Role.user, content: userMessage));
                                  self.Add(new ChatGpt.Line(ChatGpt.Role.system, content: CreateJsonInstructions(exampleResponse)));
                              }
                      CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/http/apis/OpenAi.cs on lines 468..471

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

                      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 void AddUserLineWithJsonResultStructure<T>(this ICollection<VisionGpt.Line> self, string userMessage, T exampleResponse) {
                                  self.Add(new VisionGpt.Line(ChatGpt.Role.user, content: userMessage));
                                  self.Add(new VisionGpt.Line(ChatGpt.Role.system, content: CreateJsonInstructions(exampleResponse)));
                              }
                      CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/http/apis/OpenAi.cs on lines 393..396

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

                      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 SwitchBackToLastView has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public bool SwitchBackToLastView(GameObject gameObjectToClose, bool destroyFinalView = false, bool hideNotDestroyCurrentView = false, bool destroyViewStackOnFinalView = false) {
                                  var currentView = GetRootViewOf(gameObjectToClose);
                                  if (!currentView.IsGrandChildOf(gameObject)) {
                                      Log.w("A view was passed to a viewstack that did not belong to this view stack! Will not close that view", currentView);
                                      return false;

                        Method ShouldCheckRectTransform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                private static bool ShouldCheckRectTransform(RectTransform rectTransform, Vector2 pointerPos, Camera camera, ref bool culledByCanvasGroup) {
                        #if UNITY_2019_3_OR_NEWER
                                    if (SceneVisibilityManager.instance.IsHidden(rectTransform.gameObject, false))
                                        return false;
                        
                        

                          Method UpdateGoFor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  private void UpdateGoFor(IEntity<T> iEntity, T oldState, T newState, EntityComponentSystem<T>.UpdateType type) {
                                      var go = _entityViews[iEntity.Id];
                                      if (go.IsDestroyed()) {
                                          throw Log.e($"The entity view for {iEntity.GetFullEcsPathString()} was destroyed");
                                      }

                            Method AddRectVertRing has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    public static void AddRectVertRing(
                                        ref VertexHelper vh,
                                        Vector2 center,
                                        float width,
                                        float height,

                              Method AddOnClickAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      public static Task<T> AddOnClickAction<T>(this Button self, Func<GameObject, T> onClickFunc) {
                                          onClickFunc.ThrowErrorIfNull("Passed onClickFunc was null");
                                          var tcs = new TaskCompletionSource<T>();
                                          StackTrace originTrace = null; // new StackTrace();
                                          Task alreadyRunningTask = null;

                                Method Initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        protected override void Initialize(bool setMesh = true)
                                        {
                                            base.Initialize(setMesh);
                                
                                            m_MaxTrailPoints = Mathf.Max(m_MaxTrailPoints, 3);
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language