ilyalehchylin/educats-xamarin

View on GitHub

Showing 251 of 326 total issues

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

        public static Style GetLabelStyle(NamedSize size = NamedSize.Medium, bool bold = false)
        {
            return new Style(typeof(Label)) {
                Setters = {
                    getSetter(Label.FontSizeProperty, FontSizeController.GetSize(size, typeof(Label))),
Severity: Major
Found in source/EduCATS/Helpers/Forms/Styles/AppStyles.cs and 2 other locations - About 1 hr to fix
source/EduCATS/Helpers/Forms/Styles/AppStyles.cs on lines 8..17
source/EduCATS/Helpers/Forms/Styles/AppStyles.cs on lines 19..28

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

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

        public static Style GetButtonStyle(NamedSize size = NamedSize.Medium, bool bold = false)
        {
            return new Style(typeof(Button)) {
                Setters = {
                    getSetter(Button.FontSizeProperty, FontSizeController.GetSize(size, typeof(Button))),
Severity: Major
Found in source/EduCATS/Helpers/Forms/Styles/AppStyles.cs and 2 other locations - About 1 hr to fix
source/EduCATS/Helpers/Forms/Styles/AppStyles.cs on lines 8..17
source/EduCATS/Helpers/Forms/Styles/AppStyles.cs on lines 30..39

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

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

        protected void chooseSubject()
        {
            try
            {
                if (CurrentSubjects == null)
Severity: Major
Found in source/EduCATS/Pages/Pickers/SubjectsViewModel.cs and 1 other location - About 1 hr to fix
source/EduCATS/Pages/Pickers/GroupsViewModel.cs on lines 114..131

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

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

        protected void chooseGroup()
        {
            try {
                if (CurrentGroups == null) {
                    return;
Severity: Major
Found in source/EduCATS/Pages/Pickers/GroupsViewModel.cs and 1 other location - About 1 hr to fix
source/EduCATS/Pages/Pickers/SubjectsViewModel.cs on lines 69..91

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

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

        void openFile(object selectedObject)
        {
            try {
                if (AppDemo.Instance.IsDemoAccount) {
                    PlatformServices.Device.MainThread(
Severity: Minor
Found in source/EduCATS/Pages/Files/ViewModels/FilesPageViewModel.cs - About 1 hr to fix

    Method CheckNameOfUser has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
    Open

            public bool CheckNameOfUser(string nameOfUser)
            {
                bool name = true;
                try
                {

    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 calculateChartData has a Cognitive Complexity of 27 (exceeds 20 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;

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

            StackLayout createChekInForm()
            {
                var entryStyle = getEntryStyle();
                var userNameEntry = createUsernameEntry(entryStyle);
                var passwordEntry = createPasswordGrid(entryStyle);
    Severity: Minor
    Found in source/EduCATS/Pages/Registration/Views/RegistrationPageView.cs - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                      if (Servers.Current == Servers.EduCatsAddress)
                      {
      
                          if (worksModel is not null && worksModel.PracticalsMarks.Count == 0 || worksModel is null && averages[2] == 0)
                          {
      Severity: Critical
      Found in source/EduCATS/Pages/Statistics/Base/ViewModels/StatsPageViewModel.cs - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    if (string.IsNullOrEmpty(UserName) ||
                        string.IsNullOrEmpty(Password) ||
                        string.IsNullOrEmpty(ConfirmPassword) ||
                        string.IsNullOrEmpty(Name) ||
                        string.IsNullOrEmpty(Surname) ||

          Method createLabsMarks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  void createLabsMarks()
                  {
                      var group = new Label
                      {
                          TextColor = Color.FromHex(Theme.Current.StatisticsDetailsTitleColor),

            Method setDefaultProps has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    void setDefaultProps(Schedule schedule)
                    {
                        if (schedule != null)
                        {
                            Color = schedule.Color;
            Severity: Minor
            Found in source/EduCATS/Pages/Today/Base/Models/SubjectPageModel.cs - About 1 hr to fix

              Method setPagesList has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public void setPagesList()
                      {
                          if (_isPract && _isLabs)
                          {
                              PagesList = new List<StatsPageModel> {

                Method getData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        async Task getData()
                        {
                            try {
                                switch (_statisticsPage) {
                                    case StatsPageEnum.LabsRating:

                  Method speechToText has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                  Open

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

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

                          protected async Task openParental()
                          {
                              if (string.IsNullOrEmpty(GroupNumber))
                              {
                                  _service.Dialogs.ShowError(CrossLocalization.Translate("parental_error_empty_group_number"));

                    Method openPage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            protected virtual void openPage(object selectedObject)
                            {
                                try
                                {
                                    if (selectedObject == null || selectedObject.GetType() != typeof(StatsPageModel))

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

                              protected virtual async Task<List<StatsStudentModel>> getStatistics()
                              {
                                  if (CurrentGroup == null) {
                                      return null;
                                  }
                      source/EduCATS/Pages/Parental/Statistics/StudentListPage/ViewModels/ParentalStudentsPageViewModel.cs on lines 65..80

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

                      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

                                  {
                                      string link = Links.GetLecturesCalendarData + "subjectId=" + subjectId + "&groupId=" + groupId;
                                      var obj = requestDataAsync(link, httpContent);
                                      groupData = JsonConvert.DeserializeObject<VisitingLecturesList>(obj.Result.ToString());
                                      BindingContext = new SaveMarksPageViewModel(new PlatformServices(), subjectId, groupData, groupId, title);
                      Severity: Major
                      Found in source/EduCATS/Pages/SaveMarks/Views/SaveMarksPageView.cs and 1 other location - About 1 hr to fix
                      source/EduCATS/Pages/SaveMarks/Views/SaveMarksPageView.cs on lines 53..58

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

                      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

                              protected override async Task<List<StatsStudentModel>> getStatistics()
                              {
                                  if (CurrentGroup == null)
                                  {
                                      return null;
                      source/EduCATS/Pages/Statistics/Students/ViewModels/StudentsPageViewModel.cs on lines 166..179

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

                      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