sah4ez/erp_vaadin_framework

View on GitHub

Showing 32 of 32 total issues

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

    @Override
    public Collection<?> getChildren(Object itemId) {
        ArrayList<Object> children = new ArrayList<>();

        //TODO: Find new implementation
Severity: Minor
Found in core/src/main/java/com/github/sah4ez/core/data/TreeDataContainer.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

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

    @Override
    public Collection<?> rootItemIds() {
        ArrayList<Object> result = new ArrayList<>();
        for (Object candidateId : getItemIds()) {
            Object parentRef = null;
Severity: Minor
Found in core/src/main/java/com/github/sah4ez/core/data/TreeDataContainer.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

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

    public void editOff() {
        mode = Mode.NORMAL;
        getTable().removeItemClickListener(editItemClickListener);
        getTableAll().removeItemClickListener(editItemClickListenerAll);

core/src/main/java/com/github/sah4ez/core/elements/Workspace.java on lines 349..356

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

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

        } else if (filterTableIsNotNull()) {
            if (filterTable.getContainerDataSource() instanceof TreeDataContainer) {
                treeContainer = ((TreeDataContainer) filterTable.getContainerDataSource());
            } else {
                container = ((DataContainer) filterTable.getContainerDataSource());
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 228..234

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

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

        if (tableIsNotNull()) {
            if (table.getContainerDataSource() instanceof TreeDataContainer) {
                treeContainer = ((TreeDataContainer) table.getContainerDataSource());
            } else {
                container = ((DataContainer) table.getContainerDataSource());
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 234..240

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

    public FilterPanel(FilterTreeTable filterTreeTable) {
        this.filterTreeTable = filterTreeTable;
        this.filterTable = null;
        this.table = null;
        init();
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 29..35
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 37..43

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

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 FilterPanel(Table table) {
        this.table = table;
        this.filterTable = null;
        this.filterTreeTable = null;
        init();
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 37..43
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 45..50

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

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 FilterPanel(FilterTable table) {
        this.filterTable = table;
        this.table = null;
        this.filterTreeTable = null;
        init();
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 29..35
core/src/main/java/com/github/sah4ez/core/elements/FilterPanel.java on lines 45..50

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

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 multiCellInColumnAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void multiCellInColumnAction(Item item, Object property){
        if (contains(item, property)) {
            setPrevValue(item, property);
            remove(item, property);
        } else if (!selectedCell.containsKey(item) && !selectedCell.isEmpty()) {
Severity: Minor
Found in core/src/main/java/com/github/sah4ez/core/elements/CrossTable.java - About 25 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

Method replacePermissionAccess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void replacePermissionAccess(Map<String, ModifierAccess> map, String name, ModifierAccess newValue) {
        switch (map.get(name)) {
            case EDIT: {
                if (newValue.equals(ModifierAccess.HIDE) || newValue.equals(ModifierAccess.READ)) break;
                map.replace(name, newValue);

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 cellStyleGenerator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private CustomTable.CellStyleGenerator cellStyleGenerator() {
        return (CustomTable.CellStyleGenerator) (customTable, itemId, property) -> {
            if (customTable == null || itemId == null || property == null) return null;

            String result = null;
Severity: Minor
Found in core/src/main/java/com/github/sah4ez/core/elements/CrossTable.java - About 25 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

Method replacePermissionAccess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void replacePermissionAccess(PermissionAccessUI component, ModifierAccess newValue) {
        switch (component.getModifierAccess()) {
            case EDIT: {
                if (newValue.equals(ModifierAccess.HIDE) || newValue.equals(ModifierAccess.READ)) break;
                component.setModifierAccess(newValue);

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

Severity
Category
Status
Source
Language