iiitv/ChefLib

View on GitHub

Showing 37 of 37 total issues

Method main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int tc = inp.nextInt();
        while (tc-- != 0) {
            int n = inp.nextInt();
Severity: Minor
Found in 2017/SEPT/SEPT17/MINPERM/MINPERM.java - About 1 hr 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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    n = int(input())
    yes = []
    no = []
    answer = []
Severity: Minor
Found in 2017/MAY/MAY17/WSITES01/WSITES01.py - About 55 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

Method nextDouble has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
Severity: Minor
Found in 2017/MAY/MAY17/CHEFCODE/CHEFCODE.java - About 55 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

Avoid deeply nested control flow statements.
Open

                    if i == j + k:
                        appended = True
                        break
        if not appended:
Severity: Major
Found in 2017/JUNE/JUNE17/GOODSET/GOODSET.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for digit in range(10):
                            if occ[digit] == given[digit]:
                                passer = False
                                break
                        if passer:
    Severity: Major
    Found in 2017/APR/APRIL17/DGTCNT/DGTCNT.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for z in c:
                              if z <= y:
                                  # print(z)
                                  answer += (tmp * (y + z))
              print(answer % 1000000007)
      Severity: Major
      Found in 2017/JUNE/JUNE17/SUMQ/SUMQ.py - About 45 mins to fix

        Method main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static void main(String[] args) {
                Scanner inp = new Scanner(System.in);
                int tc = inp.nextInt();
                while (tc-- != 0) {
                    int n = inp.nextInt();
        Severity: Minor
        Found in 2017/SEPT/SEPT17/CHEFSUM/CHEFSUM.java - About 45 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

        Avoid deeply nested control flow statements.
        Open

                            for digit in s:
                                occ[int(digit)] += 1
                            for digit in range(10):
        Severity: Major
        Found in 2017/APR/APRIL17/DGTCNT/DGTCNT.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for s in moves:
                                  if s == 'D':
                                      if ci + 1 == n:
                                          break
                                      elif matrix[ci + 1][cj] == '.':
          Severity: Major
          Found in 2017/APR/APRIL17/RNDGRID/RNDGRID.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if passer:
                                    count += 1
                    else:
            Severity: Major
            Found in 2017/APR/APRIL17/DGTCNT/DGTCNT.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if answer == 0:
                                      answer = count
                                  else:
                                      answer = answer ^ count
                      print(answer)
              Severity: Major
              Found in 2017/APR/APRIL17/RNDGRID/RNDGRID.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if occ[digit] == given[digit]:
                                        passer = False
                                        break
                                if passer:
                Severity: Major
                Found in 2017/APR/APRIL17/DGTCNT/DGTCNT.py - About 45 mins to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          String next() {
                              while (st == null || !st.hasMoreElements()) {
                                  try {
                                      st = new StringTokenizer(br.readLine());
                                  } catch (IOException  e) {
                  Severity: Minor
                  Found in 2017/APR/APRIL17/SMARKET/SMARKET.java and 1 other location - About 45 mins to fix
                  2017/JAN/JAN17/CAPIMOVE/CAPIMOVE.java on lines 17..31

                  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 53.

                  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

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          String next()
                          {
                              while (st == null || !st.hasMoreElements())
                              {
                                  try
                  Severity: Minor
                  Found in 2017/JAN/JAN17/CAPIMOVE/CAPIMOVE.java and 1 other location - About 45 mins to fix
                  2017/APR/APRIL17/SMARKET/SMARKET.java on lines 27..36

                  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 53.

                  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

                  Further Reading

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

                  def sum_of_subsequences(n, p):
                      arr = list(map(int, input().split()))
                      maxi = 0
                      occ = 0
                      for i in range(n):
                  Severity: Minor
                  Found in 2017/APR/LTIME47/BEARSEG/BEARSEG.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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main():
                      t = int(input())
                      while t > 0:
                          l = []
                          l1 = []
                  Severity: Minor
                  Found in 2017/MAY/COOK82/COOK82A/COOK82A.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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main():
                      N = int(input())
                      for _ in range(N):
                          string = input()
                          my_list = string.split()
                  Severity: Minor
                  Found in 2017/JULY/JULY17/NITIKA/NITIKA.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

                  Severity
                  Category
                  Status
                  Source
                  Language