cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

        public virtual void WritePage(uint pageID, byte[] buffer)
        {
            var position = BasePage.GetSizeOfPages(pageID);

            _log.Write(Logger.DISK, "write page #{0:0000} :: {1}", pageID, (PageType)buffer[PAGE_TYPE_POSITION]);
CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Engine/Disks/FileDiskService.cs on lines 115..128

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

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

        public virtual void WritePage(uint pageID, byte[] buffer)
        {
            var position = BasePage.GetSizeOfPages(pageID);

            _log.Write(Logger.DISK, "write page #{0:0000} :: {1}", pageID, (PageType)buffer[PAGE_TYPE_POSITION]);
CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Engine/Disks/StreamDiskService.cs on lines 85..98

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

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

                for (int y = 0; y < kernalSize; y++) {
                    GetColorAt(hBlur, i, y, channels, width, tmpColor);
                    tSum[0] += tmpColor[0];
                    tSum[1] += tmpColor[1];
                    tSum[2] += tmpColor[2];
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Filter.cs on lines 24..30

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

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

                for (int x = 0; x < kernalSize; x++) {
                    GetColorAt(img, x, j, channels, width, tmpColor);
                    hSum[0] += tmpColor[0];
                    hSum[1] += tmpColor[1];
                    hSum[2] += tmpColor[2];
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Filter.cs on lines 66..72

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

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

        private static IEnumerator SendAndWait<T>(this UnityWebRequest self, Response<T> resp) {
            var timer = Stopwatch.StartNew();
            try {
                SetupDownloadAndUploadHanders(self, resp);
                resp.duration = Stopwatch.StartNew();

    Method CreateDatabase has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public static void CreateDatabase(Stream stream, string password = null, long initialSize = 0)
            {
                // calculate how many empty pages will be added on disk
                var emptyPages = initialSize == 0 ? 0 : (initialSize - (2 * BasePage.PAGE_SIZE)) / BasePage.PAGE_SIZE;
    
    

      Method SetCookie has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public bool SetCookie(Cookie cookie, bool saveToCookieFile = true) {
                  lock (cookieJarLock) {
                      if (cookie.expirationDate.ToUnixTimestampUtc() <= 0) { }
                      bool receivedCookieExpired = cookie.expirationDate.IsBefore(DateTimeV2.UtcNow);
                      if (cookies.ContainsKey(cookie.name)) {

        Method GetJpegThumbnailBytes has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public byte[] GetJpegThumbnailBytes()
                {
                    if (_ifd1Catalogue == null)
                        return null;
        
        

          Method RunTestTask has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public async Task RunTestTask() {
          
                      MyUser1 initialState = null; // Initially no user is logged in
                      var store = new DataStore<MyUser1>(MyReducers1.ReduceUser, initialState, Middlewares.NewLoggingMiddleware<MyUser1>());
          
          

            Method RunAll7GUIsTests has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private async Task RunAll7GUIsTests() {
            
                        var viewStack = gameObject.GetViewStack();
            
                        var map = gameObject.GetLinkMap();

              Method SetUnitPosition has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      static void SetUnitPosition(
                          ref Vector2[] unitPositions,
                          int resolution,
                          float baseAngle,
                          bool makeSharpCorner

                Method SetupButtons has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        private static void SetupButtons(ListFieldView listView, JObject root, JsonSchemaToView viewGenerator, JArray modelArray, Dictionary<FieldView, JToken> map) {
                            listView.add.SetOnClickAction(async delegate {
                                JToken entry = listView.field.items.First().NewDefaultJInstance();
                                modelArray.Add(entry);
                                var fieldName = "" + (modelArray.Count - 1);

                  Method GetMatchedIndices has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          private List<List<int>> GetMatchedIndices(int[] matchMask)
                          {
                              var output = new List<List<int>>();
                              var start = -1;
                              var end = -1;

                    Method HandleTrailingParens has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            private static string HandleTrailingParens(Match match)
                            {
                                // The first group is essentially a negative lookbehind -- if there's a < or a =", we don't touch this.
                                // We're not using a *real* lookbehind, because of links with in links, like <a href="http://web.archive.org/web/20121130000728/http://www.google.com/">
                                // With a real lookbehind, the full link would never be matched, and thus the http://www.google.com *would* be matched.

                      Method CompareTo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public virtual int CompareTo(BsonValue other, Collation collation)
                              {
                                  // first, test if types are different
                                  if (this.Type != other.Type)
                                  {

                        Method Normalize has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Method WithFormContent has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public RestRequest WithFormContent(Dictionary<string, object> formData) {
                          
                                      // For pure string based key value pairs send "application/x-www-form-urlencoded" content:
                                      if (formData.All(entry => entry.Value is string)) {
                                          if (httpContent == null) {

                            Method TestSingletonDisposeHandled has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    [Test]
                                    public void TestSingletonDisposeHandled() {
                                        Injector injector = GetInjectorForTesting();
                            
                                        injector.RemoveAllInjectorsFor<MyExampleMono1>();

                              Method ValidateReadyToRead has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      private void ValidateReadyToRead()
                                      {
                                          if (m_NeedPropertyCheck | ArrayHasChanged())
                                          {
                                              switch (m_TextFieldType)

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

                                                    case ((4) * 8 + (1)):
                                                        for (i = (int)(x - 1); (i) >= (0); --i, src += 4, 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 189..194

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language