yashketkar/video-player

View on GitHub

Showing 144 of 144 total issues

Method beginFile has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public FileCacheEntry beginFile(String path, long lastModified, long fileSize) {
      int lastSlash = path.lastIndexOf('/');
      if (lastSlash >= 0 && lastSlash + 2 < path.length()) {
        if (path.regionMatches(lastSlash + 1, "._", 0, 2))
          return null;
Severity: Minor
Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 2 hrs 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 onKeyDown has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL;
    if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) {
      if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE) {
Severity: Minor
Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 2 hrs 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 setVideoLayout has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public void setVideoLayout(int layout, float aspectRatio) {
        LayoutParams lp = getLayoutParams();
        Pair<Integer, Integer> res = ScreenResolution.getResolution(mContext);
        int windowWidth = res.first.intValue(), windowHeight = res.second.intValue();
        float windowRatio = windowWidth / (float) windowHeight;
Severity: Minor
Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 2 hrs 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

File MediaStore.java has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (C) 2013 YIXIA.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
Severity: Minor
Found in vitamio/src/io/vov/vitamio/provider/MediaStore.java - About 2 hrs to fix

    Method prescan has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      private void prescan(String filePath) throws RemoteException {
        mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY);
        Cursor c = null;
        String where = null;
        String[] selectionArgs = null;
    Severity: Minor
    Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 2 hrs 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 getThumbnail has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static Bitmap getThumbnail(Context ctx, ContentResolver cr, long origId, long groupId, int kind, BitmapFactory.Options options, Uri baseUri) {
          Bitmap bitmap = null;
          MiniThumbFile thumbFile = MiniThumbFile.instance(baseUri);
          long magic = thumbFile.getMagic(origId);
          if (magic != 0) {
    Severity: Major
    Found in vitamio/src/io/vov/vitamio/provider/MediaStore.java - About 2 hrs to fix

      Method getCachedFeature has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private static int getCachedFeature() {
              if (cachedFeatureString == null) {
                  StringBuffer sb = new StringBuffer();
                  if ((cachedFeature & FEATURE_ARM_V5TE) > 0)
                      sb.append("V5TE ");
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/utils/CPU.java - About 2 hrs 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

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

              private static final byte ENCODE_WEBSAFE[] = {
                  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
                  'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
                  'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
                  'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_',
      Severity: Major
      Found in vitamio/src/io/vov/vitamio/utils/Base64.java and 1 other location - About 2 hrs to fix
      vitamio/src/io/vov/vitamio/utils/Base64.java on lines 552..557

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

      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

              private static final byte ENCODE[] = {
                  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
                  'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
                  'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
                  'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
      Severity: Major
      Found in vitamio/src/io/vov/vitamio/utils/Base64.java and 1 other location - About 2 hrs to fix
      vitamio/src/io/vov/vitamio/utils/Base64.java on lines 563..568

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

      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 onCreate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
      
      
      Severity: Minor
      Found in app/src/main/java/com/yashketkar/ykplayer/MainActivity.java - About 2 hrs to fix

        Method onCreate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
        
                adapter = new LiveTVAdapter(getActivity(), tvList);
        Severity: Minor
        Found in app/src/main/java/com/yashketkar/ykplayer/LiveTVFragment.java - About 1 hr to fix

          Method endFile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              private Uri endFile(FileCacheEntry entry) throws RemoteException {
                Uri tableUri;
                boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0;
                if (isVideo) {
                  tableUri = Video.Media.CONTENT_URI;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/MediaScanner.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

          Method transform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            private static Bitmap transform(Matrix scaler, Bitmap source, int targetWidth, int targetHeight, int options) {
              boolean scaleUp = (options & OPTIONS_SCALE_UP) != 0;
              boolean recycle = (options & OPTIONS_RECYCLE_INPUT) != 0;
          
              int deltaX = source.getWidth() - targetWidth;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/ThumbnailUtils.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

          Method getMagic has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            protected synchronized long getMagic(long id) {
              RandomAccessFile r = miniThumbDataFile();
              if (r != null) {
                long pos = id * BYTES_PER_MINTHUMB;
                FileLock lock = null;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.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

          Method onInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean onInfo(MediaPlayer mp, int what, int extra) {
                Log.d("onInfo: (%d, %d)", what, extra);
                  
                    if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/widget/VideoView.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

          Method prescan has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private void prescan(String filePath) throws RemoteException {
              mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY);
              Cursor c = null;
              String where = null;
              String[] selectionArgs = null;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

            Method transform has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private static Bitmap transform(Matrix scaler, Bitmap source, int targetWidth, int targetHeight, int options) {
                boolean scaleUp = (options & OPTIONS_SCALE_UP) != 0;
                boolean recycle = (options & OPTIONS_RECYCLE_INPUT) != 0;
            
                int deltaX = source.getWidth() - targetWidth;
            Severity: Minor
            Found in vitamio/src/io/vov/vitamio/ThumbnailUtils.java - About 1 hr to fix

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

                private static  boolean loadVVO_native_lib(String path, String name){
                    boolean load=false;
                    File file=new File(Vitamio.getBrowserLibraryPath() + "/"+ name );    
                    if(file.exists())    
                    {   
              Severity: Major
              Found in vitamio/src/io/vov/vitamio/MediaPlayer.java and 3 other locations - About 1 hr to fix
              vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 215..232
              vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 251..266
              vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 268..283

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

              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 4 locations. Consider refactoring.
              Open

                private static  boolean loadVAO_native_lib(String path, String name){
                    boolean load=false;
                    File file=new File(Vitamio.getBrowserLibraryPath() + "/"+ name );    
                    if(file.exists())    
                    {   
              Severity: Major
              Found in vitamio/src/io/vov/vitamio/MediaPlayer.java and 3 other locations - About 1 hr to fix
              vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 215..232
              vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 233..249
              vitamio/src/io/vov/vitamio/MediaPlayer.java on lines 268..283

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

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

                private RandomAccessFile miniThumbDataFile() {
                  if (mMiniThumbFile == null) {
                    removeOldFile();
                    String path = randomAccessFilePath(MINI_THUMB_DATA_FILE_VERSION);
                    File directory = new File(path).getParentFile();
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.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

              Severity
              Category
              Status
              Source
              Language