BUTR/Bannerlord.BLSE

View on GitHub

Showing 122 of 240 total issues

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

    private static Assembly? ResolveLauncherExAssemblies(AssemblyName assemblyName)
    {
        var @namespace = "Bannerlord.BLSE.Shared.";
        var resources = typeof(ModuleInitializer).Assembly.GetManifestResourceNames().Select(x => x.Remove(0, @namespace.Length));
        var versions = resources.Where(x => x.StartsWith("Bannerlord.LauncherEx_")).Select(x =>
Severity: Minor
Found in src/Bannerlord.BLSE.Shared/ModuleInitializer.cs - About 1 hr to fix

    Method Transpiler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            [MethodImpl(MethodImplOptions.NoInlining)]
            static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
            {
                var returnNull = new List<CodeInstruction>
                    {
    Severity: Minor
    Found in src/Bannerlord.LauncherEx/Patches/WidgetPrefabPatch.cs - About 1 hr to fix

      Method Verify has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static void Verify()
          {
              var assemblyFile = new FileInfo(typeof(GameConsistencyChecker).Assembly.Location);
      
              var platform = assemblyFile.Directory!.Name;
      Severity: Minor
      Found in src/Bannerlord.BLSE.Loaders.Standalone/GameConsistencyChecker.cs - About 1 hr to fix

        Method Main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static void Main(string[] args)
            {
                //PInvoke.ShowWindow(PInvoke.GetConsoleWindow(), SHOW_WINDOW_CMD.SW_HIDE);
        
                if (PlatformHelper.IsSteam())
        Severity: Minor
        Found in src/Bannerlord.BLSE.Shared/Program.cs - About 1 hr to fix

          Method SendNotification has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void SendNotification(string id, NotificationType type, string message, uint displayMs)
              {
                  if (string.IsNullOrEmpty(id)) id = Guid.NewGuid().ToString();
          
                  // Prevents message spam
          Severity: Minor
          Found in src/Bannerlord.LauncherEx/Adapters/NotificationProviderImpl.cs - About 1 hr to fix

            Method ReadBlock has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    protected override void ReadBlock(SimpleBinaryStream stream, byte[][] cache, int blockX)
                    {
                        var posX = blockX * 4;
            
                        var baseColor = new RGB565[4];
            Severity: Minor
            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

              Method Main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static void Main(string[] args)
                  {
                      GameConsistencyChecker.Verify();
              
              #if STANDALONE
              Severity: Minor
              Found in src/Bannerlord.BLSE.Loaders.Standalone/Program.cs - About 1 hr to fix

                Method PopulateVertices has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        private static void PopulateVertices(Texture texture, float screenX, float screenY, float[] outVertices, int verticesStartIndex, float scale, float customWidth, float customHeight)
                Severity: Major
                Found in src/Bannerlord.LauncherEx/ResourceManagers/SpriteDataManager.cs - About 1 hr to fix

                  Method GetMethodImpl has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => null;
                  Severity: Major
                  Found in src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs - About 1 hr to fix

                    Method GetPropertyImpl has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        protected override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => null;
                    Severity: Major
                    Found in src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs - About 1 hr to fix

                      Method GetMethodImpl has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => null;
                      Severity: Major
                      Found in src/Bannerlord.BLSE/Utils/TypeWrapper.cs - About 1 hr to fix

                        Method GetPropertyImpl has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            protected override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => null;
                        Severity: Major
                        Found in src/Bannerlord.BLSE/Utils/TypeWrapper.cs - About 1 hr to fix

                          Method RegQueryValueEx has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              internal static extern int RegQueryValueEx(RegistryHandle hKey, string lpValueName, int lpReserved, ref int lpType, [Out] byte[]? lpData, ref int lpcbData);
                          Severity: Major
                          Found in src/Bannerlord.BLSE.Shared/Utils/RegistryHandle.cs - About 50 mins to fix

                            Method Show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public static MessageBoxResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton button, MessageBoxModal modal) =>
                            Severity: Minor
                            Found in src/Bannerlord.BLSE.Shared/Utils/MessageBoxDialog.cs - About 45 mins to fix

                              Method Show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public static MessageBoxResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton button, MessageBoxModal modal) =>
                              Severity: Minor
                              Found in src/Bannerlord.BLSE/Utils/MessageBoxDialog.cs - About 45 mins to fix

                                Method Write has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public static void Write(string? value, IntPtr ptr, out int byteCnt, bool nullTerm = true, CharSet charSet = CharSet.Auto, long allocatedBytes = long.MaxValue)
                                Severity: Minor
                                Found in src/Bannerlord.LauncherEx/Helpers/Input/OpenSaveDialogs.cs - About 45 mins to fix

                                  Method Start has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                      public void Start()
                                      {
                                          _isActive = true;
                                  
                                          switch (ThreadConfig)
                                  Severity: Minor
                                  Found in src/Bannerlord.BLSE.Shared/NoExceptions/WindowsFrameworkEx.cs - About 45 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Method Show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public static MessageBoxResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton button, MessageBoxModal modal) =>
                                  Severity: Minor
                                  Found in src/Bannerlord.LauncherEx/Helpers/Input/MessageBoxDialog.cs - About 45 mins to fix

                                    Method DecodeTextureDataToWriter has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        private static void DecodeTextureDataToWriter(byte[] data, int width, int height, TextureFormat format, PipelineWriter writer, bool silentlyFail = false)
                                    Severity: Minor
                                    Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 45 mins to fix

                                      Method GetConstructorImpl has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          protected override ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => null;
                                      Severity: Minor
                                      Found in src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language