Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        super(ZipChallengePhaseSplitSerializer, self).__init__(*args, **kwargs)

        context = kwargs.get("context")
        if context:
Severity: Minor
Found in apps/challenges/serializers.py - About 25 mins to fix

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 subscribe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def subscribe(request):
    if request.method == "GET":
        subscribers = Subscribers.objects.all().order_by("-pk")
        serializer = SubscribeSerializer(
            subscribers, many=True, context={"request": request}
Severity: Minor
Found in apps/web/views.py - About 25 mins to fix

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 is_challenge_config_yaml_html_field_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def is_challenge_config_yaml_html_field_valid(
    yaml_file_data, key, base_location
):
    """
    Arguments:
Severity: Minor
Found in apps/challenges/challenge_config_utils.py - About 25 mins to fix

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_eks_cluster_or_ec2_for_challenge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_eks_cluster_or_ec2_for_challenge(sender, instance, created, **kwargs):
    field_name = "approved_by_admin"
    import challenges.aws_utils as aws

    if not created and is_model_field_changed(instance, field_name):
Severity: Minor
Found in apps/challenges/models.py - About 25 mins to fix

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 ngOnInit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  ngOnInit() {
    if (this.params['title']) {
      this.title = this.params['title'];
    }
    if (this.params['content']) {
Severity: Minor
Found in frontend_v2/src/app/components/utility/confirm/confirm.component.ts - About 25 mins to fix

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 get_yaml_files_from_challenge_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_yaml_files_from_challenge_config(zip_ref):
    """
    Arguments:
        zip_ref {zipfile} -- reference to challenge config zip
    Returns:
Severity: Minor
Found in apps/challenges/challenge_config_utils.py - About 25 mins to fix

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 validate_dates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_dates(self):
        start_date = self.yaml_file_data.get("start_date")
        end_date = self.yaml_file_data.get("end_date")

        if not start_date or not end_date:
Severity: Minor
Found in apps/challenges/challenge_config_utils.py - About 25 mins to fix

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 checkTokenValidity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  checkTokenValidity(err, toast = true) {
    if (err.error !== null && typeof err.error === 'object' && err.error['detail']) {
      if (
        err.error['detail'].indexOf('Invalid token') !== -1 ||
        err.error['detail'].indexOf('Token has expired') !== -1
Severity: Minor
Found in frontend_v2/src/app/services/global.service.ts - About 25 mins to fix

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 isLoggedIn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  isLoggedIn() {
    const token = this.globalService.getAuthToken();
    if (token) {
      if (!this.authState['isLoggedIn']) {
        this.loggedIn(true);
Severity: Minor
Found in frontend_v2/src/app/services/auth.service.ts - About 25 mins to fix

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 updateUserDetails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  updateUserDetails() {
    const firstName = this.user['first_name'] === '-' ? '' : this.user['first_name'];
    const lastName = this.user['last_name'] === '-' ? '' : this.user['last_name'];
    const affiliation = this.user['affiliation'] === '-' ? '' : this.user['affiliation'];
    const googleScholarUrl = this.user['google_scholar_url'] === '-' ? '' : this.user['google_scholar_url'];
Severity: Minor
Found in frontend_v2/src/app/components/profile/profile.component.ts - About 25 mins to fix

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 downloadSubmission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  downloadSubmission() {
    if (this.challenge['id'] && this.selectedPhase && this.fileSelected) {
      const API_PATH = this.endpointsService.challengeSubmissionDownloadURL(
        this.challenge['id'],
        this.selectedPhase['id'],

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

Severity
Category
Status
Source
Language