Risoluto/Risoluto-Core

View on GitHub
risoluto/apps/RisolutoApps/Admin/AdminCommon.php

Summary

Maintainability
F
5 days
Test Coverage

Function checkEnteredUserData has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkEnteredUserData( $target, $csrf_token, $selfno = '' )
    {
        // 戻り値を初期化
        $retval = [ ];
        $retval[ 'entered' ] = [ ];
Severity: Minor
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php - About 4 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

Function checkEnteredGroupData has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkEnteredGroupData( $target, $csrf_token, $selfno = '' )
    {
        // 戻り値を初期化
        $retval = [ ];
        $retval[ 'entered' ] = [ ];
Severity: Minor
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php - 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 checkEnteredUserData has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkEnteredUserData( $target, $csrf_token, $selfno = '' )
    {
        // 戻り値を初期化
        $retval = [ ];
        $retval[ 'entered' ] = [ ];
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php - About 3 hrs to fix

Method checkEnteredGroupData has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkEnteredGroupData( $target, $csrf_token, $selfno = '' )
    {
        // 戻り値を初期化
        $retval = [ ];
        $retval[ 'entered' ] = [ ];
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php - About 2 hrs to fix

Method checkEnteredSelfData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkEnteredSelfData( $target, $csrf_token, $no )
    {
        // 戻り値を初期化
        $retval = [ ];
        $retval[ 'entered' ] = [ ];
Severity: Minor
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php - About 1 hr to fix

Function checkEnteredSelfData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkEnteredSelfData( $target, $csrf_token, $no )
    {
        // 戻り値を初期化
        $retval = [ ];
        $retval[ 'entered' ] = [ ];
Severity: Minor
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php - About 55 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

        if (isset( $target[ 'groupid' ] ) and !empty( $target[ 'groupid' ] )) {
            if (!empty( $selfno )) {
                // 自分自身のユーザnoがセットされている場合は、重複データにそれが含まれていないかを確認する
                $retval[ 'entered' ][ 'no' ] = $selfno;
                $dups = [ ];
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 1 other location - About 6 hrs to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 117..143

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

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 (isset( $target[ 'userid' ] ) and !empty( $target[ 'userid' ] )) {
            if (!empty( $selfno )) {
                // 自分自身のユーザnoがセットされている場合は、重複データにそれが含まれていないかを確認する
                $retval[ 'entered' ][ 'no' ] = $selfno;
                $dups = [ ];
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 1 other location - About 6 hrs to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 249..275

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

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 (isset( $target[ 'password' ] ) and !empty( $target[ 'password' ] )) {
            // フォーマットチェック
            if ($target[ 'password' ] != $target[ 'password_confirm' ]) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_password';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 1 other location - About 2 hrs to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 164..177

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

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 (isset( $target[ 'password' ] ) and !empty( $target[ 'password' ] )) {
            // フォーマットチェック
            if ($target[ 'password' ] != $target[ 'password_confirm' ]) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_password';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 1 other location - About 2 hrs to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 364..377

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

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 (isset( $target[ 'username' ] ) and !empty( $target[ 'username' ] )) {
            // フォーマットチェック
            if (strlen( $target[ 'username' ] ) > 255) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_username';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 1 other location - About 2 hrs to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 279..291

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

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 (isset( $target[ 'groupname' ] ) and !empty( $target[ 'groupname' ] )) {
            // フォーマットチェック
            if (strlen( $target[ 'groupname' ] ) > 255) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_groupname';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 1 other location - About 2 hrs to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 147..159

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

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

        if (isset( $target[ 'status' ] )) {
            // フォーマットチェック
            if (!preg_match( '/\d{1,}/', $target[ 'status' ] )) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_status';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 2 other locations - About 1 hr to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 181..193
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 295..307

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

        if (isset( $target[ 'status' ] )) {
            // フォーマットチェック
            if (!preg_match( '/\d{1,}/', $target[ 'status' ] )) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_status';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 2 other locations - About 1 hr to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 181..193
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 197..209

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

        if (isset( $target[ 'groupno' ] )) {
            // フォーマットチェック
            if (!preg_match( '/\d{1,}/', $target[ 'groupno' ] )) {
                // フォーマットにそぐわない場合はエラーにする
                $retval[ 'error' ][ 'msg' ][ ] = 'invalid_groupno';
Severity: Major
Found in risoluto/apps/RisolutoApps/Admin/AdminCommon.php and 2 other locations - About 1 hr to fix
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 197..209
risoluto/apps/RisolutoApps/Admin/AdminCommon.php on lines 295..307

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

There are no issues that match your filters.

Category
Status