code analysis

45 views
Skip to first unread message

Manav Brar

unread,
Jul 24, 2017, 6:13:50 PM7/24/17
to Xtend Programming Language
Do we support the use of static code analysis for Xtend language? So spoiled by Java language variety set of code analysis tools and miss stuff like cyclomatic complexity. 

Sven Efftinge (sven@efftinge.de)

unread,
Jul 25, 2017, 2:19:26 AM7/25/17
to xtend...@googlegroups.com
You can use any java-specific tool, on the generated code or the byte code.

2017-07-25 0:13 GMT+02:00 Manav Brar <manav...@gmail.com>:
Do we support the use of static code analysis for Xtend language? So spoiled by Java language variety set of code analysis tools and miss stuff like cyclomatic complexity. 

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manav Brar

unread,
Jul 26, 2017, 10:29:49 PM7/26/17
to Xtend Programming Language
I had figured to start doing that perhaps related question 
often create enum state machines to get rid of long if(con1) else If(cond2) else if(cond3)... else code blocks to get around https://pmd.github.io/pmd-5.8.1/pmd-java/rules/java/codesize.html#CyclomaticComplexity
I can't seem to convert the code to xtend-lang 

get errors 

public enum ContactSourceSelect implements ValidString {


  HOT {  


    @Override

   boolean match(final Integer condition) {

     return Integer.valueOf(1).equals(condition);

   }  


   @Override

   public String valid() {

     return "Hot";

   }  


  },


  WARM {


   @Override

   boolean match(final Integer condition) {

     return Integer.valueOf(2).equals(condition);

   }  


   @Override

   public String valid() {

     return "Warm";

   }  


  },


  COLD {  


   @Override

   boolean match(final Integer condition) {

     return Integer.valueOf(3).equals(condition);

   }  


   @Override

   public String valid() {

     return "Cold";

   }  


  },


  NEW {  


   @Override

   boolean match(final Integer condition) {

     return Integer.valueOf(4).equals(condition);

   }  


   @Override

   public String valid() {

     return "New";

   }  


  },


  SOLD {  


   @Override

   boolean match(final Integer condition) {

     return Integer.valueOf(5).equals(condition);

   }  


   @Override

   public String valid() {

     return "Sold";

   }  


  },


  TRASH {


    @Override

    boolean match(Integer condition) {

     return Integer.valueOf(6).equals(condition);

    }  


    @Override

    public String valid() {

     return "Trash";

    }


  },


  DEFAULT {


    @Override

    boolean match(Integer condition) {

     return Boolean.TRUE.booleanValue();

    }


    @Override

    public String valid() {

     return "";

    }


  };


  public static ContactSourceSelect parse(final Integer condition) {

   for (ContactSourceSelect type : values()) {

     if (type.match(condition)) {

       return type;

     }

   }

   return DEFAULT;

 }

 abstract boolean match(final Integer condition);


}

public interface ValidString {

 String valid();

}


Lastly, I am a huge xtend-lang fan perhaps I can start contributing to the language feature development. I could start on something light mundane tasks perhaps 😊 

On Monday, July 24, 2017 at 11:19:26 PM UTC-7, Sven Efftinge wrote:
You can use any java-specific tool, on the generated code or the byte code.
2017-07-25 0:13 GMT+02:00 Manav Brar <manav...@gmail.com>:
Do we support the use of static code analysis for Xtend language? So spoiled by Java language variety set of code analysis tools and miss stuff like cyclomatic complexity. 

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.

Christian Dietrich

unread,
Jul 27, 2017, 1:29:26 AM7/27/17
to Xtend Programming Language
Reply all
Reply to author
Forward
0 new messages