Nick9500/ministocks

View on GitHub

Showing 67 of 108 total issues

Method getQuotes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public HashMap<String, StockQuote> getQuotes(Cache cache, List<String> symbols) {
        HashMap<String, StockQuote> quotes = new HashMap<>();
        HashMap<String, String> fxChanges = this.fxChangeRepository.getChanges(cache, symbols);
        JSONArray jsonArray;
        JSONObject quoteJson;

    Method getQuotes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public HashMap<String, StockQuote> getQuotes(Cache cache, List<String> symbols) {
            HashMap<String, StockQuote> quotes = new HashMap<>();
            HashMap<String, String> fxChanges = this.fxChangeRepository.getChanges(cache, symbols);
            JSONArray jsonArray;
            JSONObject quoteJson;

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

          private HashMap<String, StockQuote> loadQuotes() {
              if (mCachedQuotes != null && !mCachedQuotes.isEmpty()) {
                  return mCachedQuotes;
              }
      
      
      Severity: Minor
      Found in src/main/java/nitezh/ministock/domain/StockQuoteRepository.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

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

          @Override
          protected void onResume() {
              super.onResume();
      
      
      
      Severity: Minor
      Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.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

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

          @Override
          public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
              // Perform some custom handling of some values
      
              if (key.startsWith("Stock") && !key.endsWith("_summary")) {
      Severity: Minor
      Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.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

      Method inputWithCallback has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static void inputWithCallback(Context context, String title, String body,
                                               String positiveButtonText, String negativeButtonText,
                                               String defaultInputText,
                                               final InputAlertCallable callable) {
      Severity: Major
      Found in src/main/java/nitezh/ministock/DialogTools.java - About 50 mins to fix

        Method updateStock has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public void updateStock(String symbol, String price, String date, String quantity,
                                    String limitHigh, String limitLow, String customDisplay) {
        Severity: Major
        Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 50 mins to fix

          Method alertWithCallback has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      Context context,
                      String title,
                      String body,
                      String positiveButtonText,
                      String negativeButtonText,
          Severity: Major
          Found in src/main/java/nitezh/ministock/DialogTools.java - About 50 mins to fix

            Method populateDisplayTotalChange has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private void populateDisplayTotalChange(NumberFormat numberFormat, String symbol, PortfolioStock stock, Map<String, String> itemInfo, String currentPrice, String buyPrice) {
            Severity: Minor
            Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 45 mins to fix

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

                  public static String getTrimmedDouble(double number, int digits, Integer maxPrecision) {
                      String numberAsString = Double.toString(number);
              
                      // Find the position of the decimal point
                      int decimalPos = numberAsString.indexOf(".");
              Severity: Minor
              Found in src/main/java/nitezh/ministock/utils/NumberTools.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

              Method populateDisplayHoldingValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private void populateDisplayHoldingValue(NumberFormat numberFormat, String symbol, PortfolioStock stock, Map<String, String> itemInfo, String currentPrice) {
              Severity: Minor
              Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 35 mins to fix

                Method applyUpdate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static void applyUpdate(Context context, int appWidgetId, UpdateType updateMode,
                                                   HashMap<String, StockQuote> quotes, String quotesTimeStamp) {
                Severity: Minor
                Found in src/main/java/nitezh/ministock/activities/widget/WidgetProviderBase.java - About 35 mins to fix

                  Method query has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
                  Severity: Minor
                  Found in src/main/java/nitezh/ministock/SymbolProvider.java - About 35 mins to fix

                    Method populateDisplayLastChange has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private void populateDisplayLastChange(NumberFormat numberFormat, String symbol, StockQuote quote, PortfolioStock stock, Map<String, String> itemInfo) {
                    Severity: Minor
                    Found in src/main/java/nitezh/ministock/domain/PortfolioStockRepository.java - About 35 mins to fix

                      Method choiceWithCallback has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                  Context context,
                                  String title,
                                  String negativeButtonText,
                                  final CharSequence[] choices,
                                  final InputAlertCallable callable
                      Severity: Minor
                      Found in src/main/java/nitezh/ministock/DialogTools.java - About 35 mins to fix

                        Method query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
                                if (!TextUtils.isEmpty(selection)) {
                                    throw new IllegalArgumentException("selection not allowed for " + uri);
                                }
                        Severity: Minor
                        Found in src/main/java/nitezh/ministock/SymbolProvider.java - 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

                        Method getImageViewSrcId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private int getImageViewSrcId(String backgroundStyle, Boolean useLargeFont) {
                                Integer imageViewSrcId;
                                switch (backgroundStyle) {
                                    case "transparent":
                                        if (useLargeFont) {
                        Severity: Minor
                        Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.java - 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

                        Method updateFromGlobal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private void updateFromGlobal(SharedPreferences sharedPreferences, String key, int valType) {
                                // Unregister the listener whenever a key changes
                                getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
                        
                                // Update the widget preferences with the interval
                        Severity: Minor
                        Found in src/main/java/nitezh/ministock/activities/PreferencesActivity.java - 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

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

                            private String getLabel(int widgetDisplay) {
                                // Set the widget view text in the footer
                                String label = "";
                                if (widget.isNarrow()) {
                                    switch (ViewType.values()[widgetDisplay]) {
                        Severity: Minor
                        Found in src/main/java/nitezh/ministock/activities/widget/WidgetView.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 buildRequestUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private String buildRequestUrl(List<String> symbols) {
                                StringBuilder sQuery = new StringBuilder();
                                for (String s : symbols) {
                                    if (!s.equals("")) {
                                        if (!sQuery.toString().equals("")) {

                        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