Showing 1,371 of 1,371 total issues
Similar blocks of code found in 4 locations. Consider refactoring. Open
parameters.data = {
"new_password1": vm.getUser.new_password1,
"new_password2": vm.getUser.new_password2,
"uid": $state.params.user_id,
"token": $state.params.reset_token,
- Read upRead up
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 64.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
parameters.data = {
"username": vm.regUser.name,
"password1": vm.regUser.password,
"password2": vm.regUser.confirm_password,
"email": vm.regUser.email
- Read upRead up
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 64.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
parameters.data = {
"old_password": vm.user.old_password,
"new_password1": vm.user.new_password1,
"new_password2": vm.user.new_password2,
"uid": $state.params.user_id,
- Read upRead up
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 64.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function onSuccess
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function() {
vm.team.error = false;
$rootScope.notify("info", "You have removed yourself successfully");
Function onSuccess
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function() {
vm.team.error = false;
$rootScope.notify("info", "You have removed yourself successfully");
var parameters = {};
Function create_static_code_upload_submission_job_object
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_static_code_upload_submission_job_object(message, challenge):
"""Function to create the static code upload pod AWS EKS Job object
Arguments:
message {[dict]} -- Submission message from AWS SQS queue
Function ngOnInit
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.challengeService.currentChallenge.subscribe((challenge) => {
this.challenge = challenge;
});
Function stopParticipation
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
stopParticipation(event) {
event.preventDefault();
const participationState = this.challenge['is_registration_open'] ? 'Close' : 'Open';
const closeParticipationMsg = 'Participation is closed successfully';
const openParticipationMsg = 'Participation is opened successfully';
Function editEvaluationScript
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
editEvaluationScript() {
const SELF = this;
SELF.apiCall = (params) => {
const FORM_DATA: FormData = new FormData();
FORM_DATA.append('evaluation_script', params['evaluation_script']);
Function ngOnInit
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
if (this.authService.isLoggedIn()) {
this.isLoggedIn = true;
}
this.routerPublic = this.router;
Function start_job
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def start_job():
# Get metrics
staff_evalai_interface = create_evalai_interface(STAFF_AUTH_TOKEN)
- Read upRead up
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 stop_workers_for_challenges
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def stop_workers_for_challenges(response):
for challenge in response["results"]:
challenge_id = challenge["id"]
workers = challenge["workers"]
approved_by_admin = challenge["approved_by_admin"]
- Read upRead up
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 remove_participant_team_from_challenge
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def remove_participant_team_from_challenge(
request, challenge_pk, participant_team_pk
):
"""
API to remove the participant team from a challenge
- Read upRead up
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 manage_ec2_instance
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def manage_ec2_instance(request, challenge_pk, action):
if not request.user.is_staff:
response_data = {
"error": "Sorry, you are not authorized for access EC2 operations."
}
- Read upRead up
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 star_challenge
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def star_challenge(request, challenge_pk):
"""
API endpoint for starring and unstarring
a challenge.
"""
- Read upRead up
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 create_service_by_challenge_pk
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_service_by_challenge_pk(client, challenge, client_token):
"""
Creates the worker service for a challenge, and sets the number of workers to one.
Parameters:
- Read upRead up
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 __init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, *args, **kwargs):
super(ChallengePhaseCreateSerializer, self).__init__(*args, **kwargs)
context = kwargs.get("context")
if context:
challenge = context.get("challenge")
- Read upRead up
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 selectPhaseSplitId
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
selectPhaseSplitId(id, self) {
let i = 0;
for (i = 0; i < self.filteredPhaseSplits.length; i++) {
if (parseInt(id, 10) === self.filteredPhaseSplits[i]['id']) {
self.selectedPhaseSplit = self.filteredPhaseSplits[i];
- Read upRead up
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 onSuccess
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function() {
$rootScope.notify("success", "Team " + vm.team.name + " has been created successfully!");
vm.team.error = false;
vm.stopLoader();
vm.team = {};
Function startLoadingLogs
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
vm.startLoadingLogs = function () {
vm.logs_poller = $interval(function () {
if (vm.evaluation_module_error) {
vm.workerLogs = [];
vm.workerLogs.push(vm.evaluation_module_error);