aws-samples / amazon-codeguru-reviewer-python-detectors
Duplication

Places in code with 6 or more lines that are exactly the same.

Intro
  • For duplication, we look at places in code where there are 6 or more lines of code that are exactly the same.
  • Before duplication is calculated, the code is cleaned to remove empty lines, comments, and frequently duplicated constructs such as imports.
  • You should aim at having as little as possible (<5%) of duplicated code as high-level of duplication can lead to maintenance difficulties, poor factoring, and logical contradictions.
Learn more...
Duplication Overall
  • 16% duplication:
    • 876 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 148 duplicated lines
  • 9 duplicates
system16% (148 lines)
Duplication per Extension
py16% (148 lines)
Duplication per Component (primary)
mutually_exclusive_calls_found65% (26 lines)
multiprocessing_garbage_collection_prevention62% (20 lines)
sns_unauthenticated_unsubscribe60% (18 lines)
not_recommended_apis64% (18 lines)
semaphore_overflow_prevention80% (16 lines)
leaky_subprocess_timeout73% (14 lines)
catch_and_rethrow_exception63% (12 lines)
s3_verify_bucket_owner70% (12 lines)
improper_certificate_validation54% (12 lines)
lambda_override_reserved0% (0 lines)
sql_injection0% (0 lines)
sns_no_bind_subscribe_publish_rule0% (0 lines)
cross_site_scripting0% (0 lines)
subprocess_correct_api0% (0 lines)
ldap_injection0% (0 lines)
equality_vs_identity0% (0 lines)
insecure_hashing0% (0 lines)
insecure_connection0% (0 lines)
unnecessary_iteration0% (0 lines)
improper_input_validation0% (0 lines)
sns_set_return_subscription_arn0% (0 lines)
code_injection0% (0 lines)
xpath_injection0% (0 lines)
aws_logged_credentials0% (0 lines)
insecure_cors_policy0% (0 lines)
unrestricted_file_upload0% (0 lines)
multiprocessing_deadlock_prevention0% (0 lines)
aws_polling_instead_of_waiter0% (0 lines)
missing_none_check0% (0 lines)
aws_kms_reencryption0% (0 lines)
dict_get_method0% (0 lines)
incorrect_usage_of_process_terminate_api0% (0 lines)
multidimension_list_using_replication0% (0 lines)
xml_external_entity0% (0 lines)
missing_pagination0% (0 lines)
naive_datatime_time_zone_issues0% (0 lines)
deprecated_method0% (0 lines)
code_readability0% (0 lines)
object_dict_modification0% (0 lines)
iterating_sequence_modification0% (0 lines)
multiple_values_in_return0% (0 lines)
resource_leak0% (0 lines)
aws_unchecked_batch_failures0% (0 lines)
use_of_inefficient_api0% (0 lines)
dangerous_global_variables0% (0 lines)
path_traversal0% (0 lines)
insecure_cookie0% (0 lines)
hardcoded_credentials0% (0 lines)
bad_exception_handling_practices0% (0 lines)
hashlib_constructor0% (0 lines)
os_command_injection0% (0 lines)
weak_obfuscation_of_request0% (0 lines)
pep8_recommendations0% (0 lines)
string_concatenation0% (0 lines)
loose_file_permissions0% (0 lines)
lambda_client_reuse0% (0 lines)
untrusted_ami_images0% (0 lines)
clear_text_credentials0% (0 lines)
swallow_exceptions0% (0 lines)
insecure_cryptography0% (0 lines)
insecure_temp_file0% (0 lines)
log_injection0% (0 lines)
improper_error_handling0% (0 lines)
socket_close_platform_compatibility0% (0 lines)
ldap_authentication0% (0 lines)
socket_connection_timeout0% (0 lines)
improper_privilege_management0% (0 lines)
default_argument_mutable_objects0% (0 lines)
cross_site_request_forgery0% (0 lines)
Longest Duplicates
The list of 9 longest duplicates.
See data for all 9 duplicates...
Size#FoldersFilesLinesCode
13 x 2 src/python/detectors/mut...y_exclusive_calls_found
src/python/detectors/mut...y_exclusive_calls_found
mutually_exclusive_calls_found.py
mutually_exclusive_calls_found.py
7:19 (32%)
34:46 (32%)
view
10 x 2 src/python/detectors/mul...e_collection_prevention
src/python/detectors/mul...e_collection_prevention
multiprocessing_garbage_collection_pr...
multiprocessing_garbage_collection_pr...
8:20 (31%)
35:47 (31%)
view
9 x 2 src/python/detectors/not_recommended_apis
src/python/detectors/not_recommended_apis
not_recommended_apis_compliant.py
not_recommended_apis_noncompliant.py
9:20 (64%)
8:19 (64%)
view
9 x 2 src/python/detectors/sns...thenticated_unsubscribe
src/python/detectors/sns...thenticated_unsubscribe
sns_unauthenticated_unsubscribe.py
sns_unauthenticated_unsubscribe.py
7:15 (30%)
28:36 (30%)
view
8 x 2 src/python/detectors/semaphore_overflow_prevention
src/python/detectors/semaphore_overflow_prevention
semaphore_overflow_prevention.py
semaphore_overflow_prevention.py
8:17 (40%)
26:33 (40%)
view
7 x 2 src/python/detectors/leaky_subprocess_timeout
src/python/detectors/leaky_subprocess_timeout
leaky_subprocess_timeout.py
leaky_subprocess_timeout.py
7:15 (36%)
23:31 (36%)
view
6 x 2 src/python/detectors/catch_and_rethrow_exception
src/python/detectors/catch_and_rethrow_exception
catch_and_rethrow_exception.py
catch_and_rethrow_exception.py
6:12 (31%)
20:25 (31%)
view
6 x 2 src/python/detectors/imp..._certificate_validation
src/python/detectors/imp..._certificate_validation
improper_certificate_validation.py
improper_certificate_validation.py
13:18 (27%)
31:36 (27%)
view
6 x 2 src/python/detectors/s3_verify_bucket_owner
src/python/detectors/s3_verify_bucket_owner
s3_verify_bucket_owner.py
s3_verify_bucket_owner.py
7:14 (35%)
22:28 (35%)
view