aws-samples / amazon-codeguru-reviewer-python-detectors
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 146 units with 972 lines of code in units (94.4% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 2 medium size units (54 lines of code)
    • 18 small units (241 lines of code)
    • 126 very small units (677 lines of code)
0% | 0% | 5% | 24% | 69%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 5% | 24% | 69%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
aws_polling_instead_of_waiter0% | 0% | 71% | 28% | 0%
mutually_exclusive_calls_found0% | 0% | 52% | 47% | 0%
sns_unauthenticated_unsubscribe0% | 0% | 0% | 100% | 0%
missing_pagination0% | 0% | 0% | 100% | 0%
improper_certificate_validation0% | 0% | 0% | 100% | 0%
multiprocessing_garbage_collection_prevention0% | 0% | 0% | 68% | 31%
semaphore_overflow_prevention0% | 0% | 0% | 100% | 0%
sns_no_bind_subscribe_publish_rule0% | 0% | 0% | 65% | 34%
aws_kms_reencryption0% | 0% | 0% | 57% | 42%
ldap_injection0% | 0% | 0% | 52% | 47%
aws_logged_credentials0% | 0% | 0% | 52% | 47%
leaky_subprocess_timeout0% | 0% | 0% | 52% | 47%
sql_injection0% | 0% | 0% | 55% | 45%
incorrect_usage_of_process_terminate_api0% | 0% | 0% | 0% | 100%
not_recommended_apis0% | 0% | 0% | 0% | 100%
catch_and_rethrow_exception0% | 0% | 0% | 0% | 100%
xpath_injection0% | 0% | 0% | 0% | 100%
s3_verify_bucket_owner0% | 0% | 0% | 0% | 100%
improper_error_handling0% | 0% | 0% | 0% | 100%
os_command_injection0% | 0% | 0% | 0% | 100%
socket_close_platform_compatibility0% | 0% | 0% | 0% | 100%
sns_set_return_subscription_arn0% | 0% | 0% | 0% | 100%
untrusted_ami_images0% | 0% | 0% | 0% | 100%
unrestricted_file_upload0% | 0% | 0% | 0% | 100%
code_readability0% | 0% | 0% | 0% | 100%
aws_unchecked_batch_failures0% | 0% | 0% | 0% | 100%
missing_none_check0% | 0% | 0% | 0% | 100%
use_of_inefficient_api0% | 0% | 0% | 0% | 100%
string_concatenation0% | 0% | 0% | 0% | 100%
socket_connection_timeout0% | 0% | 0% | 0% | 100%
improper_input_validation0% | 0% | 0% | 0% | 100%
dict_get_method0% | 0% | 0% | 0% | 100%
resource_leak0% | 0% | 0% | 0% | 100%
insecure_cookie0% | 0% | 0% | 0% | 100%
hashlib_constructor0% | 0% | 0% | 0% | 100%
swallow_exceptions0% | 0% | 0% | 0% | 100%
ldap_authentication0% | 0% | 0% | 0% | 100%
path_traversal0% | 0% | 0% | 0% | 100%
insecure_temp_file0% | 0% | 0% | 0% | 100%
insecure_hashing0% | 0% | 0% | 0% | 100%
multiprocessing_deadlock_prevention0% | 0% | 0% | 0% | 100%
iterating_sequence_modification0% | 0% | 0% | 0% | 100%
insecure_cryptography0% | 0% | 0% | 0% | 100%
cross_site_request_forgery0% | 0% | 0% | 0% | 100%
unnecessary_iteration0% | 0% | 0% | 0% | 100%
hardcoded_credentials0% | 0% | 0% | 0% | 100%
weak_obfuscation_of_request0% | 0% | 0% | 0% | 100%
cross_site_scripting0% | 0% | 0% | 0% | 100%
subprocess_correct_api0% | 0% | 0% | 0% | 100%
equality_vs_identity0% | 0% | 0% | 0% | 100%
code_injection0% | 0% | 0% | 0% | 100%
xml_external_entity0% | 0% | 0% | 0% | 100%
object_dict_modification0% | 0% | 0% | 0% | 100%
loose_file_permissions0% | 0% | 0% | 0% | 100%
improper_privilege_management0% | 0% | 0% | 0% | 100%
log_injection0% | 0% | 0% | 0% | 100%
default_argument_mutable_objects0% | 0% | 0% | 0% | 100%
lambda_override_reserved0% | 0% | 0% | 0% | 100%
insecure_connection0% | 0% | 0% | 0% | 100%
naive_datatime_time_zone_issues0% | 0% | 0% | 0% | 100%
deprecated_method0% | 0% | 0% | 0% | 100%
dangerous_global_variables0% | 0% | 0% | 0% | 100%
bad_exception_handling_practices0% | 0% | 0% | 0% | 100%
pep8_recommendations0% | 0% | 0% | 0% | 100%
lambda_client_reuse0% | 0% | 0% | 0% | 100%
multidimension_list_using_replication0% | 0% | 0% | 0% | 100%
multiple_values_in_return0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def polling_vs_waiters_noncompliant()
in src/python/detectors/aws_polling_instead_of_waiter/aws_polling_instead_of_waiter.py
32 9 1
def get_metrics_noncompliant()
in src/python/detectors/mutually_exclusive_calls_found/mutually_exclusive_calls_found.py
22 1 0
def get_metrics_compliant()
in src/python/detectors/mutually_exclusive_calls_found/mutually_exclusive_calls_found.py
20 1 0
def authenticate_on_subscribe_compliant()
in src/python/detectors/sns_unauthenticated_unsubscribe/sns_unauthenticated_unsubscribe.py
17 5 2
def s3_recursion_compliant()
in src/python/detectors/missing_pagination/missing_pagination.py
17 3 4
def sns_publish_noncompliant()
in src/python/detectors/sns_no_bind_subscribe_publish_rule/sns_no_bind_subscribe_publish_rule.py
15 2 3
def authenticate_on_subscribe_noncompliant()
in src/python/detectors/sns_unauthenticated_unsubscribe/sns_unauthenticated_unsubscribe.py
15 5 2
def s3_loop_noncompliant()
in src/python/detectors/missing_pagination/missing_pagination.py
14 3 2
def garbage_collect_noncompliant()
in src/python/detectors/multiprocessing_garbage_collection_prevention/multiprocessing_garbage_collection_prevention.py
13 2 1
def create_connection_noncompliant()
in src/python/detectors/improper_certificate_validation/improper_certificate_validation.py
13 1 0
def create_connection_compliant()
in src/python/detectors/improper_certificate_validation/improper_certificate_validation.py
13 1 0
def polling_vs_waiters_compliant()
in src/python/detectors/aws_polling_instead_of_waiter/aws_polling_instead_of_waiter.py
13 2 0
def post_tasks_noncompliant()
in src/python/detectors/semaphore_overflow_prevention/semaphore_overflow_prevention.py
12 3 2
def post_tasks_compliant()
in src/python/detectors/semaphore_overflow_prevention/semaphore_overflow_prevention.py
12 3 2
def kms_reencrypt_noncompliant()
in src/python/detectors/aws_kms_reencryption/aws_kms_reencryption.py
12 1 0
def execute_query_compliant()
in src/python/detectors/sql_injection/sql_injection.py
11 1 1
def garbage_collect_compliant()
in src/python/detectors/multiprocessing_garbage_collection_prevention/multiprocessing_garbage_collection_prevention.py
11 2 2
def get_users_compliant()
in src/python/detectors/ldap_injection/ldap_injection.py
11 2 1
def log_credentials_compliant()
in src/python/detectors/aws_logged_credentials/aws_logged_credentials.py
11 1 0
def subprocess_timeout_compliant()
in src/python/detectors/leaky_subprocess_timeout/leaky_subprocess_timeout.py
11 2 0