Kuangcp/JavaBase

View on GitHub

Showing 349 of 349 total issues

Method T1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void T1() {
        if (sym == 3) {
            next();
            F();
            T1();

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

  private void readAndSend() {
    try {
      String line;
      while ((line = keyIn.readLine()) != null) {
        //如果消息中含 : 并且是//用户名 开头,则是判断为私聊
Severity: Minor
Found in network/src/main/java/com/github/kuangcp/bio/onechatone/Client.java - 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

Method filterClassName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private boolean filterClassName(String className) {
    if (!className.endsWith(suffix)) {
      return false;
    }

Severity: Minor
Found in class/src/main/java/com/github/kuangcp/read/ClassScanner.java - 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

Method F has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void F() {
        if (sym == 5) {
            next();
        } else if (sym == 6) {
            next();

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

  public Set<Class<?>> getPackageAllClasses(String basePackage, boolean recursive) {
    Set<Class<?>> classes = new LinkedHashSet<>();
    String packageName = basePackage;
    if (basePackage.endsWith(".")) {
      packageName = basePackage.substring(0, basePackage.length() - 1);
Severity: Minor
Found in class/src/main/java/com/github/kuangcp/read/ClassScanner.java - 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

Method isNeedContinue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean isNeedContinue(List<Fraction> list) {
        boolean flag = false;
        for (Fraction b : list) {
            if (b.isPositive()) {
                flag = true;

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

    private void testMap(Map<Key, String> m) {
        while (true) {
            for (int i = 0; i < 10000; i++) {
                // 因此这个判断就失效了
                if (!m.containsKey(new Key(i))) {
Severity: Minor
Found in class/src/main/java/jvm/oom/HeapOOM.java - 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

Method calculRate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static Integer calculRate(Map<Integer, Integer> map) {
    if (null == map || map.size() == 0) {
      return 0;
    }
    int weightSum = 0;
Severity: Minor
Found in class/src/main/java/com/github/kuangcp/generic/sample/SampleUtil.java - 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

Method intercept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        MetaObject metaObject;
        MappedStatement mappedStatement;
        Object target = invocation.getTarget();

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