-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
484 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
+----------------------+----------------------------+------------------------------------------------------------------+ | ||
| ``Redundancy.Clone`` | `Parent <../README.rst>`_ | `Index <//github.com/coala/aspect-docs/blob/master/README.rst>`_ | | ||
+----------------------+----------------------------+------------------------------------------------------------------+ | ||
|
||
+---------------------+----------------------------------------------------+----------------------------------------------+--------------------------------------------------+ | ||
| **Sibling aspects** | `UnreachableCode <../UnreachableCode/README.rst>`_ | `UnusedImport <../UnusedImport/README.rst>`_ | `UnusedVariable <../UnusedVariable/README.rst>`_ | | ||
+---------------------+----------------------------------------------------+----------------------------------------------+--------------------------------------------------+ | ||
|
||
Clone | ||
===== | ||
Code clones are multiple pieces of source code in your | ||
codebase that are very similar. | ||
|
||
Settings | ||
======== | ||
|
||
+--------------------+---------------------------------------------------------+---------------------------------------------------------+ | ||
| Setting | Meaning | Values | | ||
+====================+=========================================================+=========================================================+ | ||
| | | | | ||
|``min_clone_token`` | The number of tokens that have to be equal for it to be | **20** | | ||
| | detected as a code clone. | | | ||
| | | | | ||
+--------------------+---------------------------------------------------------+---------------------------------------------------------+ | ||
|
||
|
||
\* bold denotes default value | ||
|
||
Subaspects | ||
========== | ||
|
||
This aspect does not have any sub aspects. | ||
|
||
Example | ||
======= | ||
|
||
.. code-block:: C++ | ||
|
||
extern int array_a[]; | ||
extern int array_b[]; | ||
|
||
int sum_a = 0; | ||
|
||
for (int i = 0; i < 4; i++) | ||
sum_a += array_a[i]; | ||
|
||
int average_a = sum_a / 4; | ||
|
||
int sum_b = 0; | ||
|
||
for (int i = 0; i < 4; i++) | ||
sum_b += array_b[i]; | ||
|
||
int average_b = sum_b / 4; | ||
|
||
|
||
Importance | ||
========== | ||
|
||
Code clones make editing more difficult due to unnecessary increases | ||
in complexity and length. | ||
|
||
How to fix this | ||
========== | ||
|
||
Usually code clones can be simplified to only one occurrence. In a | ||
lot of cases, both just use different values or variables and can | ||
be reduced to one function called with different parameters or | ||
loops. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
+----------------+-------------------------------------------------------------------+------------------------------------------------------------------+ | ||
| ``Redundancy`` | `Parent <//github.com/coala/aspect-docs/blob/master/README.rst>`_ | `Index <//github.com/coala/aspect-docs/blob/master/README.rst>`_ | | ||
+----------------+-------------------------------------------------------------------+------------------------------------------------------------------+ | ||
|
||
+---------------------+--------------------------------------+ | ||
| **Sibling aspects** | `Metadata <../Metadata/README.rst>`_ | | ||
+---------------------+--------------------------------------+ | ||
|
||
Redundancy | ||
========== | ||
This aspect describes redundancy in your source code. | ||
|
||
Subaspects | ||
========== | ||
|
||
* `Clone <Clone/README.rst>`_ | ||
* `UnreachableCode <UnreachableCode/README.rst>`_ | ||
* `UnusedImport <UnusedImport/README.rst>`_ | ||
* `UnusedVariable <UnusedVariable/README.rst>`_ | ||
Importance | ||
========== | ||
|
||
Redundant code makes your code harder to read and understand. | ||
|
||
How to fix this | ||
========== | ||
|
||
Redundant code can usually be removed without consequences. | ||
|
Oops, something went wrong.