Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Function modify_leaderboard_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def modify_leaderboard_data(request):
    """
    API to update leaderboard data
    Arguments:
        request {dict} -- Request object
Severity: Minor
Found in apps/challenges/views.py - About 35 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_challenge_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def validate_challenge_config(request, challenge_host_team_pk):
    challenge_host_team = get_challenge_host_team_model(challenge_host_team_pk)

    response_data = {}

Severity: Minor
Found in apps/challenges/views.py - About 35 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 delete_ec2_instance_by_challenge_pk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def delete_ec2_instance_by_challenge_pk(request, challenge_pk):
    if not request.user.is_staff:
        response_data = {
            "error": "Sorry, you are not authorized for access EC2 operations."
        }
Severity: Minor
Found in apps/challenges/views.py - About 35 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 challenge_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def challenge_list(request, challenge_host_team_pk):
    try:
        challenge_host_team = ChallengeHostTeam.objects.get(
            pk=challenge_host_team_pk
        )
Severity: Minor
Found in apps/challenges/views.py - About 35 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_ec2_instance_details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_ec2_instance_details(request, challenge_pk):
    if not request.user.is_staff:
        response_data = {
            "error": "Sorry, you are not authorized for access EC2 operations."
        }
Severity: Minor
Found in apps/challenges/views.py - About 35 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def create_eks_cluster(challenge):
    """
    Called when Challenge is approved by the EvalAI admin
    calls the create_eks_nodegroup function

Severity: Minor
Found in apps/challenges/aws_utils.py - About 35 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 add_participant_team_to_approved_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def add_participant_team_to_approved_list(request, challenge_pk, participant_team_pk):
    """
    Add participant team to approved list
    """
    try:
Severity: Minor
Found in apps/challenges/views.py - About 35 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        super(StarChallengeSerializer, self).__init__(*args, **kwargs)
        context = kwargs.get("context")
        if context:
            challenge = context.get("challenge")
Severity: Minor
Found in apps/challenges/serializers.py - About 35 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_challenge_logo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_challenge_logo(self):
        image = self.yaml_file_data.get("image")
        if image and (
            image.endswith(".jpg")
            or image.endswith(".jpeg")
Severity: Minor
Found in apps/challenges/challenge_config_utils.py - About 35 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 check_sponsor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_sponsor(self):
        # Verify Sponsor is correct
        if "sponsors" in self.yaml_file_data:
            for sponsor in self.yaml_file_data["sponsors"]:
                if 'name' not in sponsor or 'website' not in sponsor:
Severity: Minor
Found in apps/challenges/challenge_config_utils.py - About 35 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 phaseSplitSelected has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  phaseSplitSelected(phaseSplit) {
    const SELF = this;
    SELF.selectedPhaseSplit = phaseSplit;
    SELF.highlightedEntry = null;

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

  countDownTimer(SELF, eachPhase) {
    if (!SELF.isClockStarted) {
      SELF.remainingTime = parseInt(eachPhase.limits.remaining_time, 10);
    }
    SELF.days = Math.floor(SELF.remainingTime / 24 / 60 / 60);

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

def add_tags_to_challenge(yaml_file_data, challenge):
    if "tags" in yaml_file_data:
        tags_data = yaml_file_data["tags"]
        new_tags = set(tags_data)
        # Remove tags not present in the YAML file
Severity: Minor
Found in apps/challenges/utils.py - About 35 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 storeMetadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  storeMetadata(data) {
    for (let i = 0; i < data.count; i++) {
      if (data.results[i].submission_meta_attributes) {
        const attributes = data.results[i].submission_meta_attributes;
        attributes.forEach(function (attribute) {

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

  ngAfterViewInit() {
    if(window && 'IntersectionObserver' in window) {
      const obs = new IntersectionObserver(entries => {
        entries.forEach(({ isIntersecting }) => {
          if (isIntersecting) {
Severity: Minor
Found in frontend_v2/src/app/Directives/image.lazyload.ts - About 35 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

        context = kwargs.get("context")
        if context:
Severity: Minor
Found in apps/challenges/serializers.py - About 35 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 fetchChallenges has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  fetchChallenges(filter = null, callback = null, approved_status = "approved", visibility = "public") {
    if (!filter) {
      const ALL_PATHS = Object.values(this.apiPathMapping);
      const ALL_KEYS = Object.keys(this.apiPathMapping);
      for (let i = 0; i < ALL_PATHS.length; i++) {

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

  fetchMyParticipatedChallenges(filter = null, callback = null) {
    const SELF = this;
    if (!filter) {
      const ALL_PATHS = Object.values(SELF.newApiPathMapping);
      const ALL_KEYS = Object.keys(SELF.newApiPathMapping);

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

  updateView() {
    this.teamView['team_name'] = this.team['team_name'];
    this.teamView['created_by'] = this.team['created_by'];
    this.teamView['team_url'] = this.team['team_url'];
    this.teamView['id'] = this.team['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

Function processUserDetails has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  processUserDetails() {
    let countLeft = 0;
    let count = 0;
    for (const i in this.user) {
      if (this.user.hasOwnProperty(i)) {
Severity: Minor
Found in frontend_v2/src/app/components/profile/profile.component.ts - About 35 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

Severity
Category
Status
Source
Language