SiLeBAT/FSK-Lab

View on GitHub
org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java

Summary

Maintainability
D
2 days
Test Coverage

Method doExport has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    public void doExport(final String filename, final MyDBTable myDB, final JProgressBar progress, final boolean exportFulltext, final String zeilen2Do) {
        //filename = "C:/Users/Armin/Documents/private/freelance/BfR/Data/100716/Matrices_BLS-Liste.xls";
      Runnable runnable = new Runnable() {
      public void run() {
            try {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 5 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 getDblVal has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    private void getDblVal(MyDBTable myDBTable, int row, int col, HSSFRow row0, HSSFRow rowi) {
        Object key = myDBTable.getValueAt(row, col);
        if (key != null) {
            try {
            ResultSet rs = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("DoubleKennzahlen") +
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 5 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 run has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

      public void run() {
            try {
              if (progress != null) {
                  progress.setVisible(true);
                  progress.setStringPainted(true);
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 3 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 doExport has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void doExport(final String filename, final MyDBTable myDB, final JProgressBar progress, final boolean exportFulltext, final String zeilen2Do) {
        //filename = "C:/Users/Armin/Documents/private/freelance/BfR/Data/100716/Matrices_BLS-Liste.xls";
      Runnable runnable = new Runnable() {
      public void run() {
            try {
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 2 hrs to fix

Method getDblVal has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void getDblVal(MyDBTable myDBTable, int row, int col, HSSFRow row0, HSSFRow rowi) {
        Object key = myDBTable.getValueAt(row, col);
        if (key != null) {
            try {
            ResultSet rs = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("DoubleKennzahlen") +
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

                            if (row0 != null) {
                                String kennzahl = rs.getMetaData().getColumnName(i);
                                String colStr = columnName + "-" + kennzahl;
                                int theCol;
                                if (kennzahl.equals("Wert")) {//if (kennzahl.equals("Einzelwert")) {
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 45 mins to fix

Method doExport has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public void doExport(final String filename, final MyDBTable myDB, final JProgressBar progress, final boolean exportFulltext, final String zeilen2Do) {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 35 mins to fix

Method getDblVal has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private void getDblVal(MyDBTable myDBTable, int row, int col, HSSFRow row0, HSSFRow rowi) {
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java - About 35 mins to fix

Refactor this method to reduce its Cognitive Complexity from 39 to the 15 allowed.
Open

    public void doExport(final String filename, final MyDBTable myDB, final JProgressBar progress, final boolean exportFulltext, final String zeilen2Do) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 34 to the 15 allowed.
Open

    private void getDblVal(MyDBTable myDBTable, int row, int col, HSSFRow row0, HSSFRow rowi) {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Identical blocks of code found in 5 locations. Consider refactoring.
Open

    private String getExtension(File f) {
      String s = f.getName();
      int i = s.lastIndexOf('.');
      if (i > 0 &&  i < s.length() - 1) return s.substring(i+1).toLowerCase();
      return "";
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java and 4 other locations - About 55 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/imports/GeneralXLSImporter.java on lines 92..97
org.hsh.bfr.db/src/org/hsh/bfr/db/imports/custom/LieferkettenImporterEFSA.java on lines 155..160
org.hsh.bfr.db/src/org/hsh/bfr/db/imports/custom/MyProzessXMLImporter.java on lines 73..78
org.hsh.bfr.db/src/org/hsh/bfr/db/imports/custom/MyRisImporter.java on lines 82..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 66.

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 (progress != null) {
                  progress.setVisible(true);
                  progress.setStringPainted(true);
                  progress.setString("Exporting Excel Datei...");
                  progress.setMinimum(0);
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java and 1 other location - About 50 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/actions/PlausibleAction.java on lines 87..94

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

Identical blocks of code found in 4 locations. Consider refactoring.
Open

                      if (j>0 && myFs != null && myFs.length > j-1 && myFs[j-1] != null && myFs[j-1].getTablename().equals("DoubleKennzahlen")) {
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java and 3 other locations - About 35 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/dbtable/MyDBTable.java on lines 393..393
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/dbtable/editoren/MyFilter.java on lines 134..134
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/dbtable/editoren/MyFilter.java on lines 138..138

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

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

    public boolean accept(File f) {
      if (f.isDirectory()) return true;
    
      String extension = getExtension(f);
      if ((extension.equals("xls"))) return true; 
Severity: Minor
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java and 2 other locations - About 30 mins to fix
org.hsh.bfr.db/src/org/hsh/bfr/db/imports/GeneralXLSImporter.java on lines 80..86
org.hsh.bfr.db/src/org/hsh/bfr/db/imports/custom/LieferkettenImporterEFSA.java on lines 143..149

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

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

            ResultSet rs = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("DoubleKennzahlen") +
                    " WHERE " + DBKernel.delimitL("ID") + "=" + key, false);
Severity: Major
Found in org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java and 3 other locations - About 30 mins to fix
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 172..173
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 281..282
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/dbtable/MyDBTable.java on lines 726..727

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

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