cesardl/facultad-sample-app

View on GitHub
src/main/java/org/sanmarcux/view/JDialogTeacher.java

Summary

Maintainability
D
2 days
Test Coverage
B
86%

Method initComponents has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @PostConstruct
    private void initComponents() {

        javax.swing.JPanel panel = new javax.swing.JPanel();
        javax.swing.JLabel labelCode = new javax.swing.JLabel();
Severity: Major
Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java - About 4 hrs to fix

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

        @Override
        public boolean validateData() {
            code = textFieldCode.getText().trim();
            names = textFieldNames.getText().trim();
            birthday = dateChooserBirthday.getDate();
    Severity: Minor
    Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java - About 1 hr to fix

      Method validateData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public boolean validateData() {
              code = textFieldCode.getText().trim();
              names = textFieldNames.getText().trim();
              birthday = dateChooserBirthday.getDate();
      Severity: Minor
      Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java - About 35 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

      Avoid too many return statements within this method.
      Open

                  return false;
      Severity: Major
      Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return true;
        Severity: Major
        Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java - About 30 mins to fix

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

                        if (state) {
                            key = "app.success.teacher.save";
                            LOG.info(key);
                            Toast.makeText(this, bundle.getString(key), Toast.Style.SUCCESS).display();
                            dispose();
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 1 other location - About 1 hr to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 336..345

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

            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

                    if (DialogAction.INSERT.equals(dialogAction) && teacherController.existsCode(code)) {
                        key = "app.warning.teacher.code.already.exists";
                        LOG.warn(key);
                        Toast.makeText(this, bundle.getString(key), Toast.Style.WARNING).display();
                        selectTextField(textFieldCode);
            Severity: Minor
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 1 other location - About 1 hr to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 70..76

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

            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 3 locations. Consider refactoring.
            Open

                                                    .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                            .addComponent(labelNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(labelCode, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 2 other locations - About 55 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 212..214
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 168..170

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

            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 3 locations. Consider refactoring.
            Open

                                                    .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                            .addComponent(labelBirthday, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(labelEmail, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 2 other locations - About 55 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 212..214
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 171..173

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

            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 6 locations. Consider refactoring.
            Open

                    if (code.length() == 0) {
                        key = "app.warning.teacher.code.empty";
                        LOG.warn(key);
                        Toast.makeText(this, bundle.getString(key), Toast.Style.WARNING).display();
                        selectTextField(textFieldCode);
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 5 other locations - About 50 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 63..69
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 77..83
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 91..97
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 67..73
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 81..87

            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

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

                    if (names.length() == 0) {
                        key = "app.warning.teacher.name.empty";
                        LOG.warn(key);
                        Toast.makeText(this, bundle.getString(key), Toast.Style.WARNING).display();
                        selectTextField(textFieldNames);
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 5 other locations - About 50 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 63..69
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 77..83
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 91..97
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 53..59
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 81..87

            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

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

                    if (email.length() == 0) {
                        key = "app.warning.teacher.email.empty";
                        LOG.warn(key);
                        Toast.makeText(this, bundle.getString(key), Toast.Style.WARNING).display();
                        selectTextField(textFieldEmail);
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 5 other locations - About 50 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 63..69
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 77..83
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 91..97
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 53..59
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 67..73

            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

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

                    if (birthday == null) {
                        key = "app.warning.teacher.birthday.empty";
                        LOG.warn(key);
                        Toast.makeText(this, bundle.getString(key), Toast.Style.WARNING).display();
                        dateChooserBirthday.requestFocusInWindow();
            Severity: Minor
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 1 other location - About 50 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 84..90

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

            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

                                    .addGroup(panelLayout.createSequentialGroup()
                                            .addContainerGap()
                                            .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                                                    .addComponent(labelCode)
                                                    .addComponent(textFieldCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            Severity: Minor
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 1 other location - About 45 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 241..245

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

            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 7 locations. Consider refactoring.
            Open

                                            .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                                                    .addComponent(dateChooserBirthday, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(labelBirthday))
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 6 other locations - About 35 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 247..249
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 251..253
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 264..266
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 268..270
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 190..192
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 198..200

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

            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 7 locations. Consider refactoring.
            Open

                                            .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                                                    .addComponent(textFieldEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(labelEmail))
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 6 other locations - About 35 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 247..249
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 251..253
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 264..266
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 268..270
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 190..192
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 194..196

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

            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 7 locations. Consider refactoring.
            Open

                                            .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                                                    .addComponent(textFieldNames, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(labelNames))
            Severity: Major
            Found in src/main/java/org/sanmarcux/view/JDialogTeacher.java and 6 other locations - About 35 mins to fix
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 247..249
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 251..253
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 264..266
            src/main/java/org/sanmarcux/view/JDialogStudent.java on lines 268..270
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 194..196
            src/main/java/org/sanmarcux/view/JDialogTeacher.java on lines 198..200

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

            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