weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

Avoid too many return statements within this method.
Open

        return getPropertiesForProtoContainer((ObjectProtoContainer) object);

    Avoid too many return statements within this method.
    Open

          return Long.parseLong(newValue);

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

          public static long readLongAttribute(XmlPullParser in, String name, long defaultValue) {
              final String value = in.getAttributeValue(null, name);
              try {
                  return Long.parseLong(value);
              } catch (NumberFormatException e) {
      appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1486..1493

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

      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

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

          public static int readIntAttribute(XmlPullParser in, String name, int defaultValue) {
              final String value = in.getAttributeValue(null, name);
              try {
                  return Integer.parseInt(value);
              } catch (NumberFormatException e) {
      appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1509..1516

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

      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

                  responseStream = mEventReporter.interpretResponseStream(
                          requestId,
                          contentType != null ? contentType.toString() : null,
                          response.header("Content-Encoding"),
                          responseStream,
      okhttp3_interceptor/src/main/java/com/taobao/weex/okhttp3/WeexOkhttp3Interceptor.java on lines 101..106

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

      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

                  responseStream = mEventReporter.interpretResponseStream(
                          requestId,
                          contentType != null ? contentType.toString() : null,
                          response.header("Content-Encoding"),
                          responseStream,
      okhttp_interceptor/src/main/java/com/taobao/weex/okhttp/WeexOkhttpInterceptor.java on lines 91..96

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

      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

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

          @Override
          public void onReceive(Context context, Intent intent) {
            if (IWXDebugProxy.ACTION_DEBUG_INSTANCE_REFRESH.equals(intent.getAction())) {
              if (mRefreshListener != null) {
                mRefreshListener.onRefresh();
      Severity: Minor
      Found in appframework/src/main/java/com/alibaba/weex/commons/AbsWeexActivity.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 testAherfStyle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public void testAherfStyle(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_AHref")){
                     Log.e(TAG, "TC_AHref find");

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

          public void testDowngrade(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_Downgrade")){
                     Log.e(TAG, "TC_Downgrade find");

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

          public void testTextType(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_Text")){
                     Log.e(TAG, "TC_Text find");

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

          private static Field findField(String name, Class clazz) throws NoSuchFieldException {
              Class currentClass = clazz;
              while (currentClass != Object.class) {
                  for (Field field : currentClass.getDeclaredFields()) {
                      if (name.equals(field.getName())) {
      Severity: Minor
      Found in playground/app/src/androidTest/java/com/alibaba/weex/util/Falcon.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 getAllEditTextViews has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static ArrayList<View> getAllEditTextViews(View view) {
              ArrayList<View> allchildren = new ArrayList<View>();
              if (view instanceof ViewGroup) {
                  ViewGroup vp = (ViewGroup) view;
                  for (int i = 0; i < vp.getChildCount(); i++) {
      Severity: Minor
      Found in playground/app/src/androidTest/java/com/alibaba/weex/util/ViewUtil.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 testDowngrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public void testDowngrade(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_Downgrade")){
                     Log.e(TAG, "TC_Downgrade find");

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

        public static ArrayList<Pair<String, String>> convertHeaders(Map<String, List<String>> map) {
          ArrayList<Pair<String, String>> array = new ArrayList<Pair<String, String>>();
          for (Map.Entry<String, List<String>> mapEntry : map.entrySet()) {
            for (String mapEntryValue : mapEntry.getValue()) {
              // HttpURLConnection puts a weird null entry in the header map that corresponds to

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

          public static View findFirstScrollerByRootView(View  rootView){
      
              View firstScrollView = null;
      
              if(null != rootView){

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

          public void testDowngrade(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_Downgrade")){
                     Log.e(TAG, "TC_Downgrade find");

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

          public static int getDisplayHeight(AppCompatActivity activity) {
              int height = 0;
              if (activity != null && activity.getWindowManager() != null && activity.getWindowManager().getDefaultDisplay() != null) {
                  Point point=new Point();
                  activity.getWindowManager().getDefaultDisplay().getSize(point);
      Severity: Minor
      Found in appframework/src/main/java/com/alibaba/weex/commons/util/ScreenUtil.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 getActionBarHeight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static  int getActionBarHeight(Activity activity) {
              int actionBarHeight = 0;
              if(activity.getActionBar()!= null){
                  actionBarHeight = activity.getActionBar().getHeight();
              }

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

          public void testColorType(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_Color")){
                     Log.e(TAG, "TC_Color find");

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

          public void testDowngrade(){
      
              for(final View caseView : mCaseListIndexView){
                 if (((WXTextView)caseView).getText().toString().equals("TC_Downgrade")){
                     Log.e(TAG, "TC_Downgrade find");

      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