Skip to content

Commit d28e7c1

Browse files
Docs Update
1 parent abe35df commit d28e7c1

File tree

20 files changed

+650
-116
lines changed

20 files changed

+650
-116
lines changed

README.rst

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ This repository is automatically generated. To do so, run ``./generate``. This w
55

66
The aspect tree is given below:
77

8+
- `Formatting <Root/Formatting/README.rst>`_
9+
10+
811
- `Metadata <Root/Metadata/README.rst>`_
912

1013

@@ -92,18 +95,27 @@ The aspect tree is given below:
9295
- `Complexity <Root/Smell/Complexity/README.rst>`_
9396

9497

98+
- `CylomaticComplexity <Root/Smell/Complexity/CylomaticComplexity/README.rst>`_
99+
100+
95101
- `MethodSmell <Root/Smell/MethodSmell/README.rst>`_
96102

97103

104+
- `MethodLength <Root/Smell/MethodSmell/MethodLength/README.rst>`_
105+
106+
107+
- `ParameterListLength <Root/Smell/MethodSmell/ParameterListLength/README.rst>`_
108+
109+
98110
- `Naming <Root/Smell/Naming/README.rst>`_
99111

100112

101113
- `Spelling <Root/Spelling/README.rst>`_
102114

103115

104-
- `aspectsYEAH <Root/Spelling/aspectsYEAH/README.rst>`_
116+
- `CompanySpecificWordSpelling <Root/Spelling/CompanySpecificWordSpelling/README.rst>`_
105117

106118

107-
- `coalaCorrect <Root/Spelling/coalaCorrect/README.rst>`_
119+
- `GeneralWordSpelling <Root/Spelling/GeneralWordSpelling/README.rst>`_
108120

109121

Root/Metadata/README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
| ``Root.Metadata`` | `Parent <../README.rst>`_ | `Index <//github.com/coala/aspect-docs/blob/master/README.rst>`_ |
33
+-------------------+----------------------------+------------------------------------------------------------------+
44

5-
+---------------------+------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
6-
| **Sibling aspects** | `Redundancy <../Redundancy/README.rst>`_ | `Security <../Security/README.rst>`_ | `Smell <../Smell/README.rst>`_ | `Spelling <../Spelling/README.rst>`_ |
7-
+---------------------+------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
5+
+---------------------+------------------------------------------+------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
6+
| **Sibling aspects** | `Formatting <../Formatting/README.rst>`_ | `Redundancy <../Redundancy/README.rst>`_ | `Security <../Security/README.rst>`_ | `Smell <../Smell/README.rst>`_ | `Spelling <../Spelling/README.rst>`_ |
7+
+---------------------+------------------------------------------+------------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
88

99
Metadata
1010
========

Root/Redundancy/README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
| ``Root.Redundancy`` | `Parent <../README.rst>`_ | `Index <//github.com/coala/aspect-docs/blob/master/README.rst>`_ |
33
+---------------------+----------------------------+------------------------------------------------------------------+
44

5-
+---------------------+--------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
6-
| **Sibling aspects** | `Metadata <../Metadata/README.rst>`_ | `Security <../Security/README.rst>`_ | `Smell <../Smell/README.rst>`_ | `Spelling <../Spelling/README.rst>`_ |
7-
+---------------------+--------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
5+
+---------------------+------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
6+
| **Sibling aspects** | `Formatting <../Formatting/README.rst>`_ | `Metadata <../Metadata/README.rst>`_ | `Security <../Security/README.rst>`_ | `Smell <../Smell/README.rst>`_ | `Spelling <../Spelling/README.rst>`_ |
7+
+---------------------+------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------+--------------------------------------+
88

99
Redundancy
1010
==========

Root/Security/README.rst

129 Bytes
Binary file not shown.

Root/Smell/ClassSmell/ClassLength/README.rst

+24-15
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,31 @@
88

99
ClassLength
1010
===========
11-
This aspect checks on classes' definitions length in your codebase.
11+
This aspect checks for large classes in your code base. A large class
12+
is a class that contains many fields, methods or lines of code.
1213

1314
Tastes
1415
========
1516

16-
+---------------------+--------------------------------------------------------------+--------------------------------------------------------------+
17-
| Taste | Meaning | Values |
18-
+=====================+==============================================================+==============================================================+
19-
| | | |
20-
|``max_class_length`` | Represents the max number of lines for a class's definition. | **999** +
21-
| | | |
22-
+---------------------+--------------------------------------------------------------+--------------------------------------------------------------+
23-
| | | |
24-
|``min_class_length`` | Represents the min number of lines for a class's definition. | **1** +
25-
| | | |
26-
+---------------------+--------------------------------------------------------------+--------------------------------------------------------------+
17+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
18+
| Taste | Meaning | Values |
19+
+==========================+==============================================================+==============================================================+
20+
| | | |
21+
|``max_class_length`` | Represents the max number of lines for a class's definition. | **999** +
22+
| | | |
23+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
24+
| | | |
25+
|``max_constants`` | Represents the max number of constants for a class | **3** +
26+
| | | |
27+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
28+
| | | |
29+
|``max_instance_variable`` | Represents the max number of instance variables for a class | **3** +
30+
| | | |
31+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
32+
| | | |
33+
|``max_methods`` | Represents the max number of methods for a class | **3** +
34+
| | | |
35+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
2736

2837

2938
\* bold denotes default value
@@ -71,9 +80,9 @@ Example
7180
Importance
7281
==========
7382

74-
Too large classes also known as God objects, result in ambiguous and
75-
difficult to debug source code; whereas too small classes (or lazy
76-
classes or freeloader) are sometimes useless.
83+
Refactoring these classes spares developers from the need to remember
84+
a large number of attributes and methods. Splitting these classes
85+
avoids duplication, and makes the code shorter and easier to maintain.
7786

7887
How to fix this
7988
==========

Root/Smell/ClassSmell/DataClump/README.rst

+19-18
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,34 @@ Example
2323

2424
.. code-block:: java
2525
26-
public static void main(String args[]) {
26+
public static void main(String args[]) {
2727
28-
String firstName = args[0];
29-
String lastName = args[1];
30-
Integer age = new Integer(args[2]);
31-
String gender = args[3];
32-
String occupation = args[4];
33-
String city = args[5];
28+
String firstName = args[0];
29+
String lastName = args[1];
30+
Integer age = new Integer(args[2]);
31+
String gender = args[3];
32+
String occupation = args[4];
33+
String city = args[5];
3434
35-
welcomeNew(firstName,lastName,age,gender,occupation,city);
36-
}
35+
welcomeNew(firstName,lastName,age,gender,occupation,city);
36+
}
3737
38-
public static void welcomeNew(String firstName, String lastName,
39-
Integer age, String gender,
40-
String occupation, String city){
38+
public static void welcomeNew(String firstName, String lastName,
39+
Integer age, String gender,
40+
String occupation, String city){
4141
42-
System.out.printf("Welcome %s %s, a %d-year-old %s ""from %s who works as a%s
43-
",firstName, lastName, age, gender, city, occupation);
44-
}
45-
42+
System.out.printf(
43+
"Welcome %s %s, a %d-year-old %s from %s who works as a%s",
44+
firstName, lastName, age, gender, city, occupation
45+
);
46+
}
4647
4748
4849
Importance
4950
==========
5051

51-
Data clumps make codes difficult to read, debug, scale, and also
52-
hardly reusable.
52+
Data clumps make codes difficult to read and understand, hardly
53+
reusable, and less organized.
5354

5455
How to fix this
5556
==========
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
+--------------------------------------+----------------------------+------------------------------------------------------------------+
2+
| ``Root.Smell.ClassSmell.LargeClass`` | `Parent <../README.rst>`_ | `Index <//github.com/coala/aspect-docs/blob/master/README.rst>`_ |
3+
+--------------------------------------+----------------------------+------------------------------------------------------------------+
4+
5+
+---------------------+----------------------------------------+--------------------------------------------+
6+
| **Sibling aspects** | `DataClump <../DataClump/README.rst>`_ | `FeatureEnvy <../FeatureEnvy/README.rst>`_ |
7+
+---------------------+----------------------------------------+--------------------------------------------+
8+
9+
LargeClass
10+
==========
11+
This aspect checks for large classes in your code base. A large class
12+
is a class that contains many fields, methods or lines of code.
13+
14+
Tastes
15+
========
16+
17+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
18+
| Taste | Meaning | Values |
19+
+==========================+==============================================================+==============================================================+
20+
| | | |
21+
|``max_class_length`` | Represents the max number of lines for a class's definition. | **999** +
22+
| | | |
23+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
24+
| | | |
25+
|``max_constants`` | Represents the max number of constants for a class | **3** +
26+
| | | |
27+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
28+
| | | |
29+
|``max_instance_variable`` | Represents the max number of instance variable for a class | **3** +
30+
| | | |
31+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
32+
| | | |
33+
|``max_methods`` | Represents the max number of method for a class | **3** +
34+
| | | |
35+
+--------------------------+--------------------------------------------------------------+--------------------------------------------------------------+
36+
37+
38+
\* bold denotes default value
39+
40+
Subaspects
41+
==========
42+
43+
This aspect does not have any sub aspects.
44+
45+
Example
46+
=======
47+
48+
.. code-block:: Java
49+
50+
// This is large class given that the `max_class_length` is 20
51+
52+
public class Employee
53+
{
54+
private float salary;
55+
private float bonusPercentage;
56+
private EmployeeType employeeType;
57+
public Employee(float salary, float bonusPercentage,
58+
EmployeeType employeeType)
59+
{
60+
this.salary = salary;
61+
this.bonusPercentage = bonusPercentage;
62+
this.employeeType = employeeType;
63+
}
64+
public float CalculateSalary()
65+
{
66+
switch (employeeType)
67+
{
68+
case EmployeeType.Worker:
69+
return salary;
70+
case EmployeeType.Supervisor:
71+
return salary + (bonusPercentage * 0.5F);
72+
case EmployeeType.Manager:
73+
return salary + (bonusPercentage * 0.7F);
74+
}
75+
return 0.0F;
76+
}
77+
}
78+
79+
80+
Importance
81+
==========
82+
83+
Refactoring these classes spares developers from the need to remember
84+
a large number of attributes and methods. Splitting these classes
85+
avoids duplication, and makes the code shorter and easier to maintain.
86+
87+
How to fix this
88+
==========
89+
90+
Usually splitting up those classes into many other classes solves the
91+
problem.
92+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
+-----------------------------------------------+----------------------------+------------------------------------------------------------------+
2+
| ``Root.Smell.Complexity.CylomaticComplexity`` | `Parent <../README.rst>`_ | `Index <//github.com/coala/aspect-docs/blob/master/README.rst>`_ |
3+
+-----------------------------------------------+----------------------------+------------------------------------------------------------------+
4+
5+
+---------------------+
6+
| **Sibling aspects** |
7+
+---------------------+
8+
9+
CylomaticComplexity
10+
===================
11+
This aspect checks on the cyclomatic complexity of your code.
12+
13+
Tastes
14+
========
15+
16+
+--------------------------+----------------------------------------------------------+----------------------------------------------------------+
17+
| Taste | Meaning | Values |
18+
+==========================+==========================================================+==========================================================+
19+
| | | |
20+
|``cyclomatic_complexity`` | This the maximum number of embedded branches or embedded | **6** |
21+
| | loops allowed. | |
22+
| | | |
23+
+--------------------------+----------------------------------------------------------+----------------------------------------------------------+
24+
25+
26+
\* bold denotes default value
27+
28+
Subaspects
29+
==========
30+
31+
This aspect does not have any sub aspects.
32+
33+
Example
34+
=======
35+
36+
.. code-block:: C++
37+
38+
// The cyclomatic complexity of this program is 4.
39+
40+
int foo (int a, int b) {
41+
if (a > 17 && b < 42 && a+b < 55) {
42+
return 1;
43+
}
44+
return 2;
45+
}
46+
47+
48+
Importance
49+
==========
50+
51+
Very complex code are difficult to read, debug and maintain.
52+
It is always a good idea to keep things as simple as possible.
53+
54+
How to fix this
55+
==========
56+
57+
This can be solved by breaking down complex functions into smaller
58+
onces.
59+

0 commit comments

Comments
 (0)