ilyalehchylin/educats-xamarin

View on GitHub

Showing 106 of 326 total issues

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 275 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

    File LoginPageViewModel.cs has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Threading.Tasks;
    using EduCATS.Data;
    using EduCATS.Data.Models;
    using EduCATS.Data.User;
    Severity: Minor
    Found in source/EduCATS/Pages/Login/ViewModels/LoginPageViewModel.cs - About 2 hrs to fix

      Class TodayPageViewModel has 23 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 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

          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)

            Class TestPassingPageViewModel has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public partial class TestPassingPageViewModel : ViewModel
                {
                    readonly IPlatformServices _services;
                    readonly DateTime _startedEntireTest;
                    readonly int _testId;

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

                        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;

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

                                  Frame createUserLayout()
                                  {
                                      var avatar = createAvatar();
                                      var userLabel = createUserLabel();
                          
                          
                          Severity: Minor
                          Found in source/EduCATS/Pages/Settings/Base/Views/SettingsPageView.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 openPage has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      async Task openPage(string title)
                                      {
                                          try
                                          {
                                              var serverTitle = CrossLocalization.Translate("settings_server");

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

                                        Frame createMainInfoBlock()
                                        {
                                            var surnameLabel = createLabel("surname");
                                            var surnameText = createInfoLabel();
                                            surnameText.SetBinding(Label.TextProperty, "SecondName");
                                Severity: Minor
                                Found in source/EduCATS/Pages/Settings/Profile/Views/ProfilePageView.cs - About 1 hr 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;
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language