cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

                    case ((3) * 8 + (1)):
                        for (i = (int)(x - 1); (i) >= (0); --i, src += 3, dest += 1)
                        {
                            dest[0] = (byte)(stbi__compute_y((int)(src[0]), (int)(src[1]), (int)(src[2])));
                        }
CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/StbImageSharp/Utility/Conversion.cs on lines 202..207

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

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> AddOnValueChangedActionThrottled(this TMP_InputField self, Action<string> onValueChanged, double delayInMs = 500) {
            EventHandler<string> action = (_, newText) => { onValueChanged(newText); };
            var throttledAction = action.AsThrottledDebounce(delayInMs, skipFirstEvent: true);
            return self.AddOnValueChangedAction((newText) => {
                throttledAction(self, newText);
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensions.cs on lines 176..183

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

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> AddOnValueChangedActionThrottled(this Slider self, Action<float> onValueChanged, double delayInMs = 1000) {
            EventHandler<float> action = (_, newFloat) => { onValueChanged(newFloat); };
            var throttledAction = action.AsThrottledDebounce(delayInMs, skipFirstEvent: true);
            return self.AddOnValueChangedAction((newValue) => {
                throttledAction(self, newValue);
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiInputFieldExtensions.cs on lines 28..35

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

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

        protected override void UpdateColors()
        {
            // See if the data needs initializing
            if (NeedsReinitialize())
            {

    Method ResizeV2 has 37 lines of code (exceeds 25 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) {
    
                if (width == 0 && height == 0) { throw new ArgumentException("Either height or width have to be set, both 0"); }
                var aspect = self.width / (float)self.height;

      Method UpdateWidth has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              protected override void UpdateWidth()
              {
                  // See if the data needs initializing
                  if (NeedsReinitialize())
                  {

        Method AssertNoVisualRegressionCoroutine has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private IEnumerator AssertNoVisualRegressionCoroutine(string id, StackTrace stacktrace) {
                    if (id.IsNullOrEmpty()) { throw new ArgumentNullException("Invalid ID passed"); }
        
                    var idFolder = GetFolderFor(id);
                    var oldImg = idFolder.GetChild("Regression.jpg");

          Method stbi__build_huffman has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private static int stbi__build_huffman(stbi__huffman h, int[] count)
                  {
                      var i = 0;
                      var j = 0;
                      var k = 0;

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

                        var task1 = queue.Run(async (cancelRequest) => {
                            task1WasStarted = true;
                            Log.d("Task 1 started");
                            for (int i = 0; i < 5; i++) {
                                cancelRequest.ThrowIfCancellationRequested();
            CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/async/TaskRunnerTests.cs on lines 68..79

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

            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 TMP_InputField instead of InputField")]
                    public static void textLocalized(this InputField self, string key, params object[] args) {
                        I18n i18n = I18n.instance(self);
                        if (i18n == null) { i18n = SetupDefaultI18nInstance(self).Result; }
                        var localizedText = i18n.Get(key, args);
            CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/localization/LocalizationExtensions.cs on lines 34..40

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

            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 TMP_Text instead of Text")]
                    public static void textLocalized(this Text self, string key, params object[] args) {
                        I18n i18n = I18n.instance(self);
                        if (i18n == null) { i18n = SetupDefaultI18nInstance(self).Result; }
                        var localizedText = i18n.Get(key, args);
            CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/localization/LocalizationExtensions.cs on lines 19..25

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

            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

                        var task1 = TaskRunner.instance.RunInBackground(async (cancelRequest) => {
                            task1WasStarted = true;
                            Log.d("Task 1 started");
                            for (int i = 0; i < 5; i++) {
                                cancelRequest.ThrowIfCancellationRequested();
            CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/async/BackgroundTaskQueueTests.cs on lines 105..116

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

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

                    protected override void Start() {
                        base.Start();
            
                        _historyStore = PlayerPrefsStore.NewPreferencesUsingPlayerPrefs();
                        AssertHistoryStoreHasPersistedData().LogOnError();

              Method RebuildDependencyGraph has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [MenuItem("Window/CsUtil/CsCore/Force Rebuild Of Asset Dependency Graph")]
                      static Dictionary<string, List<string>> RebuildDependencyGraph() {
                          try {
                              var t = Log.MethodEntered();
              
              

                Method Shrink has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public long Shrink(string password = null, IDiskService tempDisk = null)
                        {
                            var originalSize = _disk.FileLength;
                
                            // if temp disk are not passed, use memory stream disk

                  Method Fetch has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

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

                            public static ImageResult FromStream(Stream stream, ColorComponents? requiredComponents = null, bool use8BitsPerChannel = true)
                            {
                                ImageResult result = null;
                                if (JpgDecoder.Test(stream))
                                {

                      Method JsonCouldBeFullyParsed has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private static bool JsonCouldBeFullyParsed(IJsonReader reader, string path, IDictionary input, IDictionary parsed, int depth) {
                                  if (depth > MAX_DEPTH) { Log.e("Deth > " + MAX_DEPTH + ", will abort recursive search on this level, path=" + path); return false; }
                                  foreach (var f in input) {
                                      var field = (DictionaryEntry)f;
                                      var key = field.Key;

                        Method GaussianElimination has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                private static double[] GaussianElimination(double[,] A, double[] B) {
                                    int n = B.Length;
                                    for (int pivot = 0; pivot < n; pivot++) {
                                        int maxrow = pivot;
                                        for (int row = pivot + 1; row < n; row++) {

                          Method CalcPolynomialCoefficients has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public static double[] CalcPolynomialCoefficients(IReadOnlyList<Vector2> points, int coefficientCount = 5) {
                                      if (coefficientCount < 1) {
                                          throw new ArgumentException("Coefficient count must be at least 2 (which is a line).");
                                      }
                                      if (points.Count < coefficientCount) {
                            Severity
                            Category
                            Status
                            Source
                            Language