Derek-R-S/Light-Reflective-Mirror

View on GitHub
LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint/Endpoint.cs

Summary

Maintainability
C
1 day
Test Coverage

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

        [RestRoute("Get", "/api/join/")]
        public async Task JoinRelay(IHttpContext context)
        {
            // need to copy over in order to avoid
            // collection being modified while iterating.

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

            [RestRoute("Get", "/api/auth")]
            public async Task ReceiveAuthKey(IHttpContext context)
            {
                var req = context.Request;
                string receivedAuthKey = req.Headers["Authorization"];

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

              public bool Start(ushort port = 7070)
              {
                  try
                  {
                      // Initialize the region variables

        Consider simplifying this complex logical expression.
        Open

                    if (receivedAuthKey != null && region != null && int.TryParse(region, out int regionId) &&
                        address != null && endpointPort != null && gamePort != null && receivedAuthKey == Program.conf.AuthKey)
                    {
                        Logger.WriteLogMessage($"Server accepted: {address}:{gamePort}");
        
        

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

                  [RestRoute("Options", "/api/join/")]
                  public async Task JoinRelayOptions(IHttpContext context)
                  {
                      var originHeaders = context.Request.Headers["Access-Control-Request-Headers"];
          
          
          LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint/Endpoint.cs on lines 181..191
          ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Endpoint.cs on lines 82..92

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

          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

                  [RestRoute("Options", "/api/masterlist/")]
                  public async Task GetMasterServerListOptions(IHttpContext context)
                  {
                      var originHeaders = context.Request.Headers["Access-Control-Request-Headers"];
          
          
          LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint/Endpoint.cs on lines 149..159
          ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Endpoint.cs on lines 82..92

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

          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

                          var config = new ConfigurationBuilder()
                          .SetBasePath(System.IO.Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .Build();
          ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Endpoint.cs on lines 101..104

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

          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

                          (services) =>
                          {
                              services.AddLogging(configure => configure.AddConsole());
                              services.Configure<LoggerFilterOptions>(options => options.MinLevel = LogLevel.None);
                          }, (server) =>
          ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Endpoint.cs on lines 107..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 60.

          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

          There are no issues that match your filters.

          Category
          Status