ilyalehchylin/educats-xamarin

View on GitHub

Showing 104 of 319 total issues

Method startResetPassword has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected async Task<object> startResetPassword()
        { 
            try
            {
                if (checkCredentials())

    Method loginRequest has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            async Task<UserModel> loginRequest()
            {
                var userLogin = await DataAccess.Login(Username, Password);
    
                if(!AppDemo.Instance.IsDemoAccount && _services.Preferences.Server == Servers.EduCatsAddress)
    Severity: Major
    Found in source/EduCATS/Pages/Login/ViewModels/LoginPageViewModel.cs - About 2 hrs to fix

      Method saveMarks has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
      Open

              private async Task<KeyValuePair<string, HttpStatusCode>> saveMarks()
              {
                  string link = "";
                  string body = "";
                  if (_titleOfPage == CrossLocalization.Translate("stats_page_lectures_visiting"))
      Severity: Minor
      Found in source/EduCATS/Pages/SaveMarks/ViewModels/SaveMarksPageViewModel.cs - About 2 hrs 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

      File DataAccess.cs has 271 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using System.Collections.Generic;
      using System.Net;
      using System.Threading.Tasks;
      using EduCATS.Constants;
      using EduCATS.Data.Models;
      Severity: Minor
      Found in source/EduCATS/Data/DataAccess.cs - About 2 hrs to fix

        Method calculateChartData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                List<double> calculateChartData(StatsStudentModel stats, LabsVisitingList studentsPractStatistics, LabsVisitingList studentTestStatistics, LaboratoryWorksModel currentPractStudentStatistics, LaboratoryWorksModel worksModel)
                {
                    double avgLabs = 0;
                    double avgTests = 0;
                    double avgPract = 0;
        Severity: Major
        Found in source/EduCATS/Pages/Statistics/Base/ViewModels/StatsPageViewModel.cs - About 2 hrs to fix

          Class TodayPageViewModel has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

              public class TodayPageViewModel : ViewModel
              {
                  readonly IPlatformServices _services;
          
                  readonly double _subjectHeight;
          Severity: Minor
          Found in source/EduCATS/Pages/Today/Base/ViewModels/TodayPageViewModel.cs - About 2 hrs to fix

            Method setLabsVisiting has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    void setLabsVisiting(StatsStudentModel student, LaboratoryWorksModel labs)
                    {
                        if (_statisticsPage == StatsPageEnum.LabsVisiting)
                        {
                            if (Servers.Current == Servers.EduCatsAddress)

              Method getFiles has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      async Task getFiles()
                      {
                          IEnumerable<FilesPageModel> files = null;
              
                          var appDataDirectory = PlatformServices.Device.GetAppDataDirectory();
              Severity: Major
              Found in source/EduCATS/Pages/Files/ViewModels/FilesPageViewModel.cs - About 2 hrs to fix

                File ForgotPasswordPageView.cs has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                using EduCATS.Helpers.Forms;
                using EduCATS.Helpers.Forms.Styles;
                using EduCATS.Pages.ForgotPassword.ViewModels;
                using EduCATS.Themes;
                using FFImageLoading.Forms;
                Severity: Minor
                Found in source/EduCATS/Pages/ForgotPassword/Views/ForgotPasswordPageView.cs - About 2 hrs to fix

                  Method setChartData has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                  Open

                          void setChartData(StatsStudentModel stats, LabsVisitingList studentsPractStatistics, LabsVisitingList studentTestStatistics, List<double> averages = null)
                          {
                              try {
                                  double rating = 0;
                  
                  
                  Severity: Minor
                  Found in source/EduCATS/Pages/Statistics/Base/ViewModels/StatsPageViewModel.cs - About 2 hrs 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 saveMarks has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          private async Task saveMarks()
                          {
                              string body = ""; 
                              string link = "";
                              if (_title == CrossLocalization.Translate("practice_mark"))

                    File ForgotPasswordPageViewModel.cs has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    using EduCATS.Helpers.Forms;
                    using EduCATS.Helpers.Json;
                    using EduCATS.Helpers.Logs;
                    using EduCATS.Networking;
                    using EduCATS.Networking.AppServices;

                      File SavePracticeAndLabsPageViewModel.cs has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      using EduCATS.Data.Models;
                      using EduCATS.Helpers.Forms;
                      using EduCATS.Helpers.Logs;
                      using EduCATS.Networking;
                      using EduCATS.Networking.Models.SaveMarks;

                        File FilesPageViewModel.cs has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        using System;
                        using System.Collections.Generic;
                        using System.ComponentModel;
                        using System.IO;
                        using System.Linq;
                        Severity: Minor
                        Found in source/EduCATS/Pages/Files/ViewModels/FilesPageViewModel.cs - About 2 hrs to fix

                          Method RefreshToken has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public string RefreshToken()
                                  {
                                      Username = DataAccess.Username;
                                      Password = DataAccess.Password;
                          
                          Severity: Minor
                          Found in source/EduCATS/Pages/Login/ViewModels/LoginPageViewModel.cs - About 2 hrs to fix

                            Consider simplifying this complex logical expression.
                            Open

                                                if (!(((UserName[i] >= 'a') && (UserName[i] <= 'z')) || ((UserName[i] >= 'A') && (UserName[i] <= 'Z'))
                                                    || ((UserName[i] >= '0') && (UserName[i] <= '9'))
                                                    || (UserName[i] == '_')
                                                    || (UserName[i] == '.')
                                                    || (UserName[i] == '-')
                            Severity: Critical
                            Found in source/EduCATS/Pages/Registration/ViewModels/RegistrationPageViewModel.cs - About 2 hrs to fix

                              Method setChartData has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      void setChartData(StatsStudentModel stats, LabsVisitingList studentsPractStatistics, LabsVisitingList studentTestStatistics, List<double> averages = null)
                                      {
                                          try {
                                              double rating = 0;
                              
                              

                                Method speechToText has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        protected async Task speechToText()
                                        {
                                            try {
                                                if (Answers == null || string.IsNullOrEmpty(Question)) {
                                                    return;

                                  Method setMarks has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          void setMarks(StatsStudentModel student, LaboratoryWorksModel labs)
                                          {
                                              if (_statisticsPage == StatsPageEnum.LabsRating)
                                              {
                                                  if (Servers.Current == Servers.EduCatsAddress)

                                    Method createLabsMarksPage has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            private void createLabsMarksPage(LabsVisitingList labsVisitingList)
                                            {
                                                FullNames = new List<string>();
                                                LabsVisitingMarks = new List<StudentsPageModel>();
                                                Date1 = new List<string>();
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language